'How to convert Web Stream to NodeJS native Stream
I am taking file input from user as
<input type="file"/>
It returns file object has Blob. This object has a method .stream() which returns ReadableStream. Now, i want to pass this stream to stream-json library. But it takes NodeJS native stream - Readable.
Now, how do i convert the ReadableStream (webstream) to Readable (node stream) ?
Solution 1:[1]
Node has an helper function:
https://nodejs.org/api/stream.html#streamreadablefromwebreadablestream-options
Another more complex way is to implement a node stream that consumes the web stream.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Mascarpone |
