idbkv-chunk-store

1.1.2 • Public • Published

idbkv-chunk-store

Greenkeeper badge Travis badge standard badge npm

Abstract chunk store implementation built on idb-kv: a small IndexedDB wrapper that automatically batches for performance.

abstract chunk store

Install

npm install idbkv-chunk-store

Usage

See abstract-chunk-store

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.

Package Sidebar

Install

npm i idbkv-chunk-store

Weekly Downloads

2

Version

1.1.2

License

MIT

Unpacked Size

8.55 kB

Total Files

6

Last publish

Collaborators

  • kayleepop