You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ESM-only. Use import split from 'binary-split'. require('binary-split') still works and returns the function directly, through Node's built-in require() of ES modules.
Requires Node 20.19+ or 22.12+.
The default delimiter is now '\n' on all platforms. It was os.EOL, which is '\r\n' on Windows. If you relied on that, pass '\r\n' explicitly.
Lines are always emitted separately. The readable side is now in object mode, so .read(), for await and stream.toArray() no longer merge lines together.
An empty splitOn now throws. Before, it caused an infinite loop.
Improvements
Faster: 2–10× on typical line lengths thanks to native Buffer#indexOf. Multi-byte delimiters like '\r\n' gain the most.
Linear time for long lines: a line spanning many chunks is now copied once instead of on every chunk. A 50MB line takes 8ms, down from 3.3s.
No runtime dependencies:through2 was replaced with Node's built-in stream.Transform.