xen-orchestra/@vates/read-chunk/USAGE.md

14 lines
329 B
Markdown
Raw Normal View History

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