binary-splitSplit streams of binary data. Similar to split but for Buffers. Whereas split is String specific, this library never converts binary data into non-binary data.
How fast is it?On a SSD w/ a Haswell i5 1.3ghz CPU and 4GB RAM reading a 2.6GB, 5.2 million entry line delimited JSON file takes 15 seconds. Using
splitfor the same benchmark takes 1m23s.
const split = require('binary-split') fs.createReadStream('log.txt') .pipe(split()) .on('data', line => console.log(line))
split(splitOn)Returns a stream. You can
.pipeother streams to it or
.writethem yourself (if you
.writedon't forget to
The stream will emit a stream of binary objects representing the split data.
Pass in the optional
splitOnargument to specify where to split the data. The default is your current operating systems EOL sequence (via
For more examples of usage see