Buffer and transform the n first bytes of a stream
$ npm install --save first-chunk-stream
const fs = ;const concatStream = ;const firstChunkStream = ;// unicorn.txt => unicorn rainbowfs;
The options object is passed to the
Duplex stream constructor allowing you to customize your stream behavior. In addition you can specify the following option:
How many bytes you want to buffer.
The function that gets the required
Note that the buffer can have a smaller length than the required one. In that case, it will be due to the fact that the complete stream contents has a length less than the
òptions.chunkLength value. You should check for this yourself if you strictly depend on the length.
MIT © Sindre Sorhus