buffer-split-utils

0.2.0 • Public • Published

buffer-split-utils

Utilities for splitting buffers, especially useful for Transform objects in stream pipes.

Usage:

split(buffer, splitBuffer)

Split buffer at every occurrence of splitBuffer; returns an array of buffers.

splitOnce(buffer, splitBuffer)

Split buffer at the first occurrence of splitBuffer; returns an array of two buffers, Buffer objects before and after the first occurrence of splitBuffer respectively.

splitN(buffer, splitBuffer, n)

Split buffer at the first n occurrences of splitBuffer; returns an array of n+1 buffers; the first n items are the split Buffer objects, and the last Buffer is the remainder of buffer.

splitAtNth(buffer, splitBuffer, nth)

Split buffer at the nth occurrence of splitBuffer; returns an array of buffers.

splitOnceAtNth(buffer, splitBuffer, nth)

Split buffer once at the nth occurrence of splitBuffer; returns an array of two buffers, Buffer objects before and after the first occurrence of splitBuffer respectively.

splitNAtNth(buffer, splitBuffer, n, nth)

Split buffer n times at the nth occurrence of splitBuffer; returns an array of n+1 buffers, Buffer objects before and after the first occurrence of splitBuffer respectively.

nthIndexOf(buffer, splitBuffer, nth)

Returns the position of the nth occurrence of splitBuffer within buffer.

Package Sidebar

Install

npm i buffer-split-utils

Weekly Downloads

0

Version

0.2.0

License

ISC

Unpacked Size

2.98 MB

Total Files

83

Last publish

Collaborators

  • nick-bull