I'm trying to use fetch with a ReadableStream. In this example, the ReadableStream should simply repeat "Some data..." indefinitely.
fetch('/', {
method: 'POST',
body: new ReadableStream({
pull: function(controller) {
…
Note: I'm not looking for any alternatives. I know this can be done with XMLHttpRequest. I also don't care about browser support. I just want learn about the new/upcoming standards.
I have a File object and I can upload it with PUT using fetch like…
Is it possible to create a single TransformStream out of several other TransformStreams using whatwg streams (the web Streams API)?
For example, if I have two TransformStreams which run in sequence, like transformer1 and…
The Streams API is a nice method for interacting with potentially infinite streams of data in the Browser. ReadableStreams specifically give you methods for representing potentially infinite sources of data; where "processing" is done…
Suppose I have a large file I generate client-side that I want to allow the user to save to their hard drive.
The usual method would be to create a Blob, and then create an object URL for it:
const blob = new Blob([chunks], {type:…
I'm using fetch to retrieve a URL. This is in code that is acting as a proxy and if it gets a response with content-encoding: gzip, I want to get the raw data so I can send it back to the consumer without decoding it.
But I see no way to do this. …
I'm making requests to an API, but their server only allows a certain number of active connections, so I would like to limit the number of ongoing fetches. For my purposes, a fetch is only completed (not ongoing) when the HTTP response body arrives…
When calling ReadableStreamDefaultController.error or TransformStreamDefaultController.error with an Error object to manually error out a stream, the error is logged in the browser console, at the site of invocation, as an uncaught error, as if the…
Suppose I want to use the Fetch API to upload a local file as part of FormData with Node.js.
If this were a browser, I might have a file or blob reference already, such as from a file input element. In that case, I just append the file reference to…
I am familiar with the "old" nodejs stream, so the need of Duplex steam "streams that are both Readable and Writable (for example, net.Socket)" seem quite obvious.
To quote
Examples of Duplex streams include:
TCP sockets
zlib streams
crypto…
I have two ReadableStreams, and I want to pipe them into one WritableStream, where any data that comes through the ReadableStreams goes directly into the WritableStream right then.
I can do the opposite, by using ReadableStream.prototype.tee() to…
On my Create-React-App application, users can upload a file of potentially large sizes. From these files, I chunk and encrypt them (done in the client for transparency) while in the form of a stream. I'm now hoping to send this stream to an external…
The Streams API provides a neat way of piping a ReadableStream to a WritableStream using readableStream.pipeTo(writableStream). This would appear to be more convenient than obtaining readableStream.getReader() and manually gluing it to…
I'm using Icecast to stream live audio from internal microphones and want the listener to have as small a latency as possible.
A naive solution would be to simply access http://myhostname:8000/my_mountpoint to get the stream but the