Skip to content

mk-pmb/p-read-next-stream-chunk-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

p-read-next-stream-chunk

Extended next-chunk.

If you just want an alias module for directly importing next-chunk's nextChunk function, without the extra features:

import pReadNextStreamChunk from 'p-read-next-stream-chunk/alias'

API

This module exports one function:

pReadNextStreamChunk(someReadableStream[, opts])

Tries to read one next chunk from someReadableStream. Returns a promise for that next chunk. Should return null at end of stream as per the objectMode spec.

opts is an optional options object. If it is set to a truthy value (e.g. an object), pReadNextStreamChunk switches to factory mode, returnung a function preset 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. Default: undefined
  • 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.

 

License

ISC

About

Extended next-chunk.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published