Stream instance to thenableConvert any
So it can be consumed both as a promise and as a stream
npm install stream-promise
Stream must be either readable or writable.
In case of readable streams, promise resolves with concatenated output, in case of writable streams resolve with
To achieve expected result stream should be converted immediately after initialization.
const streamPromise = ;;someReadableStream;;someReadableStream;
Already emitted data is accessible at
Sepearate promise (without touching stream object) can be created with
const streamToPromise = ;const someReadableStreamPromise = ;someReadableStreamPromise;
Applicable to readable streams. Set to true, if it's not intended to gather stream result and resolve with it.
Then the only purpose of promise would be to indicate a moment when data stream is finalized