node package manager

chunk-store-stream

chunk-store-stream travis npm downloads

Convert an abstract-chunk-store store into a readable or writable stream

Read/write data from/to a chunk store, with streams.

Install

npm install chunk-store-stream

Usage

Create a read stream

var ChunkStoreStream = require('chunk-store-stream')
var FSChunkStore = require('fs-chunk-store') // any chunk store will work 
 
var chunkLength = 3
var store = new FSChunkStore(chunkLength)
 
// ... put some data in the store 
 
var stream = new ChunkStoreStream.read(store, chunkLength, { length: 6 })
stream.pipe(process.stdout)

Create a write stream

var ChunkStoreStream = require('chunk-store-stream')
var FSChunkStore = require('fs-chunk-store') // any chunk store will work 
var fs = require('fs')
 
var chunkLength = 3
var store = new FSChunkStore(chunkLength)
 
var stream = new ChunkStoreStream.write(store, chunkLength)
fs.createReadStream('file.txt').pipe(stream)

License

MIT. Copyright (c) Feross Aboukhadijeh.