0.0.0 • Published 1 year ago

tiny-nbd-server v0.0.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
1 year ago

tiny-nbd-server

NBD server implemention in JS focused around providing an API for implementing virtual block devices

npm install tiny-nbd-server

Usage

const NBDServer = require('nbd-server')

const server = new NBDServer({
  blockSize: 1024, // 1KB
  size: 16 * 1024 * 1024 * 1024, // 16GB block size
  async read (blockIndex) {
    // called when someone wants to read a block, you should return it
    // if no block exists for this index, return null
  },
  async write (blockIndex, block) {
    // called when someone wants to write a block, you should store it
  },
  async del (blockIndex) {
    // called when someone wants to delete a block
  }
})

server.listen('/tmp/nbd')

Dependencies

TODO

0.0.0

1 year ago