Napoleonic Panda Machine
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

chunk-store-stream

2.1.0 • Public • Published

chunk-store-stream travis npm downloads javascript style guide

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

abstract chunk store

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.

install

npm i chunk-store-stream

Downloadsweekly downloads

4,205

version

2.1.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
  • avatar
  • avatar