Skip to content

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

License

Notifications You must be signed in to change notification settings

kklas/chunk-store-stream

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%