chunkify-stream is a duplex stream that combines incoming chunks into arrays of chunks.
Functions can be used to control how many chunks are combined and how they are combined.
The package exports a factory method that creates the duplex stream. The following options are supported:
combine: A callback function to control how the array of chunks is combined. The function will be called like this:
combine(chunks), where the
chunksis an array of the chunks. By default a function is used that passes the input array through.
split: A callback function to control when to split the chunks. The function will be called like this:
split(current, last, chunks).
currentis the current chunk, which is not yet part of the chunks.
lastis the last chunk, which is already part of the chunks.
chunksis the array of all collected chunks.
If the function returns
chunkswill be emitted and
currentgoes into the next collection of chunks. By default a function is used that always returns
false, so all chunks are combined into one big array.
const chunkify =const alphabeticWordList =// write the output to the consolealphabeticWordList// feed the stream with alphabetic sorted animal namesalphabeticWordListalphabeticWordListalphabeticWordListalphabeticWordListalphabeticWordList