stream-head1.1.1 • Public • Published
This package provides TypeScript types.
The default (and only) exported function takes a readable stream and returns a new stream (together with a buffer). The old stream must not be used anymore, it will be piped to the returned stream. The returned stream will contain everything from the input stream, the first
n bytes will be copied to the returned buffer, not consumed.
inputStream; // We get this from somewhere// Peek the first 64 bytes from the stream.;stream; // The new stream (don't use inputStream anymore!)head; // A Buffer with the first 64 bytes (or less if the stream was smaller)