xen-orchestra/@vates/read-chunk
Julien Fontanet 3f42199f8f feat(normalize-packages): dont use files field
A centralized npmignore is easier to use and maintain.
2021-04-23 14:47:34 +02:00
..
.npmignore feat: unified .npmignore for all packages 2021-04-07 13:58:14 +02:00
index.js feat(read-chunk): ensure function is properly named 2021-04-07 14:02:50 +02:00
index.spec.js chore(read-chunk): add tests 2021-04-07 13:03:56 +02:00
package.json feat(normalize-packages): dont use files field 2021-04-23 14:47:34 +02:00
README.md feat(*/README.md): better badges 2020-06-01 14:41:52 +02:00
USAGE.md fix(read-chunk/USAGE): fix pkg name 2020-05-28 14:48:27 +02:00

@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