Naive node.js buffer stream reader
JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test
.gitignore
LICENSE
README.md
package.json
reader.js

README.md

buffer-stream-reader

Naive node.js buffer stream reader

var BufferStreamReader = require('buffer-stream-reader');
    
var buffer = new Buffer('word1 word2 word3');
var reader = new BufferStreamReader(buffer, { encoding: 'utf8' });

reader.on('readable', function onReadable () {
  while ((chunk = reader.read()) !== null) {
    console.log(chunk.toSring()); // Should print 'word1 word2 word3'
  }
});