Package Exports
- it-split
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (it-split) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
it-split
Splits Uint8Arrays emitted by an (async) iterable by a delimiter
Install
$ npm install --save it-split
Usage
const split = require('it-split')
const encoder = new TextEncoder()
// This can also be an iterator, async iterator, generator, etc
const values = [
encoder.encode('hello\nwor'),
encoder.encode('ld')
]
const arr = await all(split(values))
console.info(arr) // [encoder.encode('hello'), encoder.encode('world')]
You can also split by arbitrary delimiters:
const values = [
Uint8Array.from([0, 1, 2, 3]),
Uint8Array.from([0, 1, 2, 3]),
Uint8Array.from([1, 1, 2])
]
const delimiter = Uint8Array.from([1, 2])
const arr = await all(split(values, {
delimiter
}))
console.info(arr) // [ Buffer.from([0]), Buffer.from([3, 0]), Buffer.from([3, 1]) ]