Extended next-chunk.
npm install p-read-next-stream-chunk
p-read-next-stream-chunk
========================
Extended next-chunk.
If you just want an alias module for directly importingnext-chunk's nextChunk function, without the extra features:
``javascript`
import pReadNextStreamChunk from 'p-read-next-stream-chunk/alias'
API
---
This module exports one function:
Tries to read one next chunk from someReadableStream.null
Returns a promise for that next chunk.
Should return at end of stream as per
[the objectMode spec][object-mode-spec].
opts is an optional options object.pReadNextStreamChunk
If it is set to a truthy value (e.g. an object), switches to factory mode,preset
returnung a function that remembers the someReadableStream.preset will ignore any arguments and return promises for stream chunks.
opts supports these keys:
* undef: Translate undefined chunks to this value.undefined
Default: ignoreEmptyStr`: If set to a truthy value and the chunk is an
*
empty string, ignore it.
Known issues
------------
* Needs more/better tests and docs.
* No support for read length limits and cancellation.
If you want those, have a look at @kevinoid's
promised-read.
[object-mode-spec]: https://nodejs.org/dist/latest-v11.x/docs/api/stream.html#stream_object_mode
License
-------
ISC