binary-split
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/binary-split package

1.0.5 • Public • Published

binary-split

Split 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.

travis

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 split for the same benchmark takes 1m23s.

Example usage

const split = require('binary-split')
 
fs.createReadStream('log.txt')
  .pipe(split())
  .on('data', line => console.log(line))

API

split([splitOn])

Returns a stream. You can .pipe other streams to it or .write them yourself (if you .write don't forget to .end).

The stream will emit a stream of binary objects representing the split data.

Pass in the optional splitOn argument to specify where to split the data. The default is your current operating systems EOL sequence (via require('os').EOL).

For more examples of usage see test.js.

Collaborators

binary-split is only possible due to the excellent work of the following collaborators:

Readme

Keywords

none

Package Sidebar

Install

npm i binary-split

Weekly Downloads

6,957

Version

1.0.5

License

BSD-2-Clause

Unpacked Size

5.02 kB

Total Files

4

Last publish

Collaborators

  • maxogden
  • mourner