{
"repo": "localdrive",
"timestamp": "2026-01-16T23:05:19.000Z",
"entryPoint": "index.js",
"exports": {
"packageJson": {
"main": "index.js"
}
},
"api": {
"file": "index.js",
"exports": [
{
"type": "default",
"name": "class"
}
],
"classes": [
{
"name": "Localdrive"
}
],
"functions": [
{
"name": "handleMetadataHooks"
},
{
"name": "isExecutable"
},
{
"name": "toIgnoreFunction"
},
{
"name": "lstat"
},
{
"name": "stat"
},
{
"name": "opendir"
},
{
"name": "readdir"
},
{
"name": "gcEmptyFolders"
},
{
"name": "isEmptyDirectory"
}
]
},
"readme": {
"content": "# localdrive\n\nFile system API that is similar to Hyperdrive\n\n```\nnpm i localdrive\n```\n\n## Usage\n\n```js\nconst Localdrive = require('localdrive')\n\nconst drive = new Localdrive('./my-project')\n\nawait drive.put('/blob.txt', Buffer.from('example'))\nawait drive.put('/images/logo.png', Buffer.from('..'))\nawait drive.put('/images/old-logo.png', Buffer.from('..'))\n\nconst buffer = await drive.get('/blob.txt')\nconsole.log(buffer) // => <Buffer ..> \"example\"\n\nconst entry = await drive.entry('/blob.txt')\nconsole.log(entry) // => { key, value: { executable, linkname, blob, metadata } }\n\nawait drive.del('/images/old-logo.png')\n\nawait drive.symlink('/images/logo.shortcut', '/images/logo.png')\n\nfor await (const file of drive.list('/images')) {\n console.log('list', file) // => { key, value }\n}\n\nconst rs = drive.createReadStream('/blob.txt')\nfor await (const chunk of rs) {\n console.log('rs', chunk) // => <Buffer ..>\n}\n\nconst ws = drive.createWriteStream('/blob.txt')\nws.write('new example')\nws.end()\nws.",
"sections": [
"intro",
"usage",
"api",
"examples",
"license"
],
"hasApi": true,
"hasExamples": true,
"exampleCount": 10,
"examples": [
"npm i localdrive",
"const Localdrive = require('localdrive')\n\nconst drive = new Localdrive('./my-project')\n\nawait drive.put('/blob.txt', Buffer.from('example'))\nawait drive.put('/images/logo.png', Buffer.from('..'))\nawait drive.put('/images/old-logo.png', Buffer.from('..'))\n\nconst buffer = await drive.get('/blob.txt')\nconsole.log(buffer) // => <Buffer ..> \"example\"\n\nconst entry = await drive.entry('/blob.txt')\nconsole.log(entry) // => { key, value: { executable, linkname, blob, metadata } }\n\nawait drive.del('/images/old-logo.png')\n\nawait drive.symlink('/images/logo.shortcut', '/images/logo.png')\n\nfor await (const file of drive.list('/images')) {\n console.log('list', file) // => { key, value }\n}\n\nconst rs = drive.createReadStream('/blob.txt')\nfor await (const chunk of rs) {\n console.log('rs', chunk) // => <Buffer ..>\n}\n\nconst ws = drive.createWriteStream('/blob.txt')\nws.write('new example')\nws.end()\nws.once('close', () => console.log('file saved'))",
"{\n followLinks: false, // If enabled then `entry(key)` will follow the `linkname`\n metadata: { // Hook functions are called accordingly\n get (key) {},\n put (key) {},\n del (key) {}\n },\n atomic: false, // Enable atomicity for file writing (tmp file and rename)\n roots: {} // For mapping key prefixes to different roots\n}"
]
},
"patterns": [
"streaming"
]
}