new Chunk(data, stream)
Parameters:
| Name | Type | Description |
|---|---|---|
data |
Buffer | initial data |
stream |
stream.Readable | stream to read from |
Methods
-
hasNext() → {boolean}
-
Checks whether there are more chunks to read.
Returns:
- false if end of stream- Type
- boolean
-
next(onSuccess, onFailure) → {Promise}
-
Reads the next chunk in the stream.
Parameters:
Name Type Description onSuccessfunction the handler to call on success onFailurefunction the handler to call on failure Returns:
- a promise, resolved on success, rejected on failure- Type
- Promise