xen-orchestra/@vates/read-chunk
2020-05-29 15:10:20 +02:00
..
index.js fix(read-chunk): not an ES module 2020-05-29 15:10:20 +02:00
package.json feat(@vates/read-chunk): 0.1.0 2020-05-28 14:49:00 +02:00
README.md fix(*/README): license link 2020-05-28 21:24:20 +02:00
USAGE.md fix(read-chunk/USAGE): fix pkg name 2020-05-28 14:48:27 +02:00

@vates/read-chunk Build Status

Package Version License PackagePhobia

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