function fromReadableStreamReader<GValue>(
reader: ReadableStreamReader<GValue>
): IObservable<IFromReadableStreamReaderObservableNotifications<GValue>>Creates an Observable from a ReadableStreamReader. It emits values in the form of Notifications.
See fromAsyncIterator for more details.
.read.
You should prefer to use fromReadableStream which ensures that the ReadableStream is not locked.
async function run() {
const response = await fetch('https://somefile');
const subscribe = fromReadableStream(response.body.getReader());
subscribe((notification) => {
console.log(notification.name, ':', notification.value);
})
}
run();Output:
next: ArrayBuffer
next: ArrayBuffer
complete