GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - max-mapper/binary-split: a fast newline (or any delimiter) splitter stream - like require('split') but specific for binary data

BranchesTags
Open more actions menu

Latest commit

 

History

55 Commits
55 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
bench.js
bench.js
 
 
eslint.config.js
eslint.config.js
 
 
index.d.ts
index.d.ts
 
 
index.js
index.js
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
readme.md
readme.md
 
 
test.js
test.js
 
 
test.json
test.json
 
 

Repository files navigation

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.

Node

How fast is it?

It finds delimiters with native Buffer#indexOf and emits zero-copy slices of the input, so throughput is mostly bound by I/O and stream overhead — typically hundreds of MB/s to GB/s depending on line length.

Example usage

import fs from 'node:fs'
import split from 'binary-split'

for await (const line of fs.createReadStream('log.txt').pipe(split())) {
  console.log(line.toString())
}

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 readable side is in object mode: each line is emitted as a separate Buffer (a slice of the input, without the delimiter), whether you consume it with 'data' events, .read() or for await. Empty lines are skipped.

Pass in the optional splitOn argument (a string or Buffer) to specify where to split the data. The default is '\n'. Throws if splitOn is empty.

Collaborators

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

  • Max Ogden (@max-mapper)
  • Volodymyr Agafonkin (@mourner)
  • Martin Raifer (@tyrasd)
  • Julian Gruber (@juliangruber)

About

a fast newline (or any delimiter) splitter stream - like require('split') but specific for binary data

Resources

Readme
BSD-2-Clause license
Activity

Stars

79 stars

Watchers

2 watching

Forks

18 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.