Easy way to create a Readable Stream
JavaScript
Switch branches/tags
Nothing to show
Pull request Compare This branch is 1 commit ahead, 15 commits behind dominictarr:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples
test
LICENSE.APACHE2
LICENSE.MIT
index.js
package.json
readme.markdown

readme.markdown

from

An easy way to create a readable Stream.

from(function getChunk(bytes, buffer))

from takes a getChunk function and returns a stream.

getChunk is called each time read is called on the readable stream.

var from = require('from')

var stream = from(function getChunk(bytes, buffer) {
    //do some sort of data
    buffer.push(whatever)
    
    if(itsOver)
      this.emit('end')

    // return a chunk 
    return buffer.shift()
  })

License

MIT / Apache2