immediate-chunk-store
![javascript style guide](https://camo.githubusercontent.com/bde227e3207c7143032c0feb73889ffbda8eb1ef234b820b915ccaf74f9c66d7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f64655f7374796c652d7374616e646172642d627269676874677265656e2e737667)
Immediate put/get for abstract-chunk-store compliant stores
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.