Questions tagged [whatwg-streams-api]

This tag is for questions about the Streams API of the web platform.

Specification: https://streams.spec.whatwg.org/

Implementation status:

23 questions
30
votes
1 answer

Fetch with ReadableStream as Request Body

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) { …
Brad
  • 159,648
  • 54
  • 349
  • 530
20
votes
2 answers

How to get File upload progress with fetch() and WhatWG streams

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…
esamatti
  • 18,293
  • 11
  • 75
  • 82
10
votes
1 answer

Chrome: to play a video that is being downloaded via fetch/XHR

What I'm trying to achieve is to make Chrome load a video file as data (via the Fetch API, XHR, whatever) and to play it using
thorn0
  • 9,362
  • 3
  • 68
  • 96
4
votes
1 answer

Using Web Streams, create a TransformStream from several TransformStreams

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…
Shruggie
  • 869
  • 6
  • 20
4
votes
1 answer

Firefox v57 WritableStream

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…
Athan Clark
  • 3,886
  • 2
  • 21
  • 39
3
votes
1 answer

Streaming a client-side generated response as a download, without service worker

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:…
Brad
  • 159,648
  • 54
  • 349
  • 530
2
votes
1 answer

Fetch raw gzip-encoded web page into Uint8Array

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. …
2
votes
1 answer

How to know when a fetch ends without locking the body stream?

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…
D. Pardal
  • 6,173
  • 1
  • 17
  • 37
2
votes
1 answer

Manually erroring out a ReadableStream or TransformStream causes the error to be logged as an uncaught error

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…
John Weisz
  • 30,137
  • 13
  • 89
  • 132
1
vote
0 answers

Node.js FormData and File references

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…
Brad
  • 159,648
  • 54
  • 349
  • 530
1
vote
2 answers

Why does Web Streams API lack Duplex Stream?

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…
Qiulang
  • 10,295
  • 11
  • 80
  • 129
1
vote
1 answer

How to pipe two ReadableStreams into one WritableStream in Javascript?

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…
asdf3.14159
  • 694
  • 3
  • 19
1
vote
1 answer

Uploading ReadableStream as part of FormData from Browser

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…
1
vote
1 answer

Streams API: possible to undo .pipeTo()?

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…
chrstphrchvz
  • 657
  • 5
  • 18
1
vote
3 answers

Decoding HTTP Audio Stream from Icecast with minimal latency

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
1
2