xen-orchestra/@vates/read-chunk/README.md
2020-06-01 14:41:52 +02:00

1.3 KiB

@vates/read-chunk

Package Version License PackagePhobia Node compatibility

Read a chunk of a Node stream

Install

Installation of the npm package:

> npm install --save @vates/read-chunk

Usage

  • returns the next available chunk of data
  • like stream.read(), a number of bytes can be specified
  • returns null if the stream has ended
import { readChunk } from '@vates/read-chunk'
;(async () => {
  let chunk
  while ((chunk = await readChunk(stream, 1024)) !== null) {
    // do something with chunk
  }
})()

Contributions

Contributions are very welcomed, either on the documentation or on the code.

You may:

  • report any issue you've encountered;
  • fork and create a pull request.

License

ISC © Vates SAS