idbkv-chunk-store
v1.1.2
Published
Abstract chunk store built on idb-kv: the lightweight and simple API for indexeddb with automatic batching
Downloads
13
Maintainers
Readme
idbkv-chunk-store
Abstract chunk store implementation built on idb-kv: a small IndexedDB wrapper that automatically batches for performance.
Install
npm install idbkv-chunk-store
Usage
var IdbkvChunkStore = require('idbkv-chunk-store')
var store = new IdbkvChunkStore(10,
{
name: 'example', // data will persist to future instances with this same name Default='idbkv-chunk-store'
length: 37, // allows partial final chunks Default=Infinity
batchInterval: 10 // sets batch interval for idb-kv Default=10ms
}
)
store.put(0, Buffer.from('0123456789'), (err) => {
if (err) throw err
store.get(0, (err, chunk) => {
if (err) throw err
console.log(chunk) // outputs '0123456789' as a buffer
})
})
Compatibility
idb-kv uses async functions, so those need to be supported to use this library.