immediate-chunk-store

2.2.0 • Public • Published

immediate-chunk-store ci npm downloads javascript style guide

Immediate put/get for abstract-chunk-store compliant stores

abstract chunk store

Makes store.put() chunks immediately available for store.get(), even before the store.put() callback is called. Data is stored in memory until the store.put() is complete.

Install

npm install immediate-chunk-store

Usage

var ImmediateChunkStore = require('immediate-chunk-store')
var FSChunkStore = require('fs-chunk-store') // any chunk store will work

var store = new ImmediateChunkStore(new FSChunkStore(10))

store.put(0, Buffer.from('abc'), function () { /* yolo */ })

// And now, get the same chunk out BEFORE the put is complete
store.get(0, function (err, data) {
  if (err) throw err
  console.log(data.toString()) // 'abc'
})

License

MIT. Copyright (c) Feross Aboukhadijeh.

/immediate-chunk-store/

    Package Sidebar

    Install

    npm i immediate-chunk-store

    Weekly Downloads

    3,049

    Version

    2.2.0

    License

    MIT

    Unpacked Size

    5.41 kB

    Total Files

    4

    Last publish

    Collaborators

    • mafintosh
    • feross