{
"repo": "network-block-device",
"timestamp": "2026-01-16T23:56:26.840Z",
"entryPoint": "index.js",
"exports": {
"packageJson": {
"main": "index.js"
}
},
"api": {
"file": "index.js",
"exports": [
{
"type": "default",
"name": "class"
}
],
"classes": [
{
"name": "NBDServer"
},
{
"name": "NBDProtocol"
}
],
"functions": [
{
"name": "writeUint64BE"
},
{
"name": "readUint64BE"
},
{
"name": "noop"
},
{
"name": "noopPromise"
}
]
},
"readme": {
"content": "# network-block-device\n\nNBD server implemention in JS focused around providing an API for implementing virtual block devices\n\n```\nnpm install -g network-block-device\n```\n\n## Usage\n\n```js\nconst NBDServer = require('network-block-device')\n\nconst blocks = new Map()\n\nconst server = new NBDServer({\n blockSize: 1024, // 1KB\n size: 16 * 1024 * 1024 * 1024, // 16GB block size\n async read (blockIndex) {\n // called when someone wants to read a block, you should return it\n // if no block exists for this index, return null/undefined\n return blocks.get(blockIndex)\n },\n async write (blockIndex, block) {\n // called when someone wants to write a block, you should store it\n blocks.set(blockIndex, block)\n },\n async del (blockIndex) {\n // called when someone wants to delete a block\n blocks.delete(blockIndex)\n }\n})\n\nserver.listen('/tmp/nbd')\n```\n\n# Example\n\n**1. Installation**\n\nFirst of all, you need to install the nbd package, I compiled the version from sourceforge: https://",
"sections": [
"intro",
"usage",
"dependencies"
],
"hasApi": true,
"hasExamples": true,
"exampleCount": 8,
"examples": [
"npm install -g network-block-device",
"const NBDServer = require('network-block-device')\n\nconst blocks = new Map()\n\nconst server = new NBDServer({\n blockSize: 1024, // 1KB\n size: 16 * 1024 * 1024 * 1024, // 16GB block size\n async read (blockIndex) {\n // called when someone wants to read a block, you should return it\n // if no block exists for this index, return null/undefined\n return blocks.get(blockIndex)\n },\n async write (blockIndex, block) {\n // called when someone wants to write a block, you should store it\n blocks.set(blockIndex, block)\n },\n async del (blockIndex) {\n // called when someone wants to delete a block\n blocks.delete(blockIndex)\n }\n})\n\nserver.listen('/tmp/nbd')",
"npm install -g network-block-device"
]
},
"patterns": []
}