🚧 This is currently experimental and is unstable
A simple blob store for Hypercore built on Hyperbee, heavily inspired by andrewosh/hyperblobs.
Each blob is identified by unique (utf-8) key.
const db = new Hyperbee(core)
const blobs = new Hyperblobbee(db)
const key = 'my-first-file'
await blobs.put(key, Buffer.from('hello world', 'utf-8'))
await blobs.get(key) // Buffer.from('hello world', 'utf-8')
If the blob is large, there's a Streams interface (createReadStream
and createWriteStream
) too.
npm i hyperblobbee
const Hyperblobbee = require('hyperblobbee')
Create a new blob store wrapping a single Hyperbee instance.
Options can include:
{
blockSize: 65536, // The block size (bytes) that will be used when storing large blobs.
}
Store a new blob at key
. If the blob is large, it will be chunked according to opts.blockSize
(default 64KB).
Options can include:
{
blockSize: 65536, // The block size (bytes) that will be used when storing large blobs.
}
Create a Readable stream that will yield the key
blob.
Options match the get
options.
Create a Writable stream that will save a blob with key
.
MIT