1.2.0 • Published 2 years ago
hyperbundle v1.2.0
hyperbundle
Bundle blobs and metadata
npm install hyperbundle
Usage
const bundle = new Hyperbundle(corestore, optionalKey)
const ws = bundle.createWriteStream('/blob.txt')
ws.write('hello')
ws.write('world')
ws.end()
ws.on('close', function () {
const rs = bundle.createReadStream('/blob.txt')
rs.pipe(process.stdout) // prints helloworld
})
API
stream = bundle.entries(opts)
Get all entries as Hyperbee nodes. Takes Hyperbee createReadStream options.
stream = bundle.diff(earlierLength)
Make a diff stream of the metadata data.
ws = bundle.createWriteStream(keyOrEntry, [opts])
Insert a blob. Options include
{
// set the executuable flag in the metadata
executable: true | false
}
rs = bundle.createReadStream(key)
Read out a blob
await bundle.put(key, buf, [opts])
Non-stream version of createWriteStream
.
buf = await bundle.get(key)
Non-stream version of createReadStream
.
await bundle.del(key)
Delete a blob.
node = await bundle.entry(key)
Get the Hyperbee node for a blob.
bundle.symlink(key, target)
Store a symlink. Symlinks are currently not followed on read.