level-blobs
Save binary blobs in level and stream then back. Similar to level-store but streams2 and with support for random access writes and reads
npm install level-blobs
Usage
var blobs = ;var level = ;var db = ;var bl = ;// create a write streamvar ws = blobs;ws;ws;ws;ws;
API
blobs(db, opts)
Create a new blobs instance. Options default to
blockSize: 65536 // byte size for each block of data storedbatch: 100 // batch at max 100 blocks when writing
bl.createReadStream(name, opts)
Create a read stream for name
. Options default to
start: 0 // start reading from this byte offsetend: Infinity // end at end-of-file or this offset (inclusive)
bl.createWriteStream(name, opts)
Create a write stream to name
. Options default to
start: 0 // start writing at this offset// if append === true start defaults to end-of-fileappend: false // set to true if you want to append to the file// if not true the file will be truncated before writing
bl.read(name, opts, cb)
Create a read stream and buffer the stream into a single buffer that is passed to the callback.
Options are passed to createReadStream
.
bl.write(name, data, opts, cb)
Write data
to name
and call the callback when done.
Options are passed to createWriteStream
.
bl.remove(name, cb)
Remove name
from the blob store
License
MIT