Consider Blob.fromStream (returns a Promise<Blob>)
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
Research direction
The issue names no repository files or tests. Start by comparing the current Blob, ReadableStream, and Response(...).blob() APIs described here; done would require a settled API design for Blob.fromStream, its options, and the related File question, followed by the applicable specification and conformance tests.
Written by the indexing model from the issue text.
Description
I'm filing this as a tracking issue, although I don't think it's particularly urgent. But maybe web developers have run into this more, in which case hearing from them would be great.
Anyway, right now, to convert a ReadableStream to a Blob, you have to do
const blob = await new Response(stream).blob();
which is pretty silly. Just as blob.stream() was added to avoid the silly new Request(blob).body pattern, perhaps we should consider adding a promise-returning Blob.fromStream() so you could do
const blob = await Blob.fromStream(stream);
There is a bigger savings if we add an options parameter:
const blob1 = new Blob([await new Response(stream).blob()], options);
const blob2 = Blob.fromStream(stream, options);
Points to consider:
- We could instead make this
stream.toBlob(), but I feel the layering of keeping streams ignorant of blobs is a bit cleaner. - We may not want to introduce this because it's better if people avoid using blobs? (Or is it just blob URLs that we dislike?)
- If someone wanted a
File, we could either addFile.fromStream(stream, fileName, options)or we could have people donew File([Blob.fromStream(stream)], fileName, options). ProbablyFile.fromStream()is nicer. - This does not allow creating a blob that represents an "in progress" stream, which I've heard people have wanted in order to have self-referential blobs. That would require new concepts and infrastructure. This proposal is basically just exposing existing infrastructure in a more straightforward way.
- Dominant language
- HTML
- Stars
- 118
- Forks
- 52
- Avg merge
- 9d 16h
- Merged PRs (30d)
- 1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from w3c/FileAPI
-
TPAC2026
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 1/5 Under an hour Newbie friendliness 62/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
use-agent-os/agent-os#3312 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
needs-acceptance wg/data-plane-networking
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
vllm-project/semantic-router#4024 · 1 comment ·
-
bug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
amponce/archive-movie-browser#165 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100