Sync alternative to `fs.openAsBlob`
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Needs clarification
- Activity status
- Active
- Tech stack
- javascript
- Domain
- backend
Research direction
Start by reviewing the existing fs.openAsBlob and fs.createReadStream APIs and their documentation. Clarify the synchronous File API shape, metadata exposed to Response, and cross-runtime behavior before proposing an entry point. Done means the API design is agreed and its behavior is covered by tests and documentation.
Written by the indexing model from the issue text.
Description
What is the problem this feature will solve?
I'm making a cross-runtime file streaming library (that needs to be fast) and this would make it way easier to do so since Bun.file() is already sync.
So the code might look like this if my suggestion made it to node:fs:
const getFile: (path: string) => File = globalThis.Bun
? Bun.file
: process.getBuiltinModule('fs').openAsWebFile;
// Usage
return new Response(getFile('./index.html'));
return new Response(getFile('./binary-data').slice(0, 100));
What is the feature you are proposing to solve the problem?
A new API, something like fs.openAsWebFile() that returns a File maybe?
It would have more info for the Response constructor to pick up as well.
What alternatives have you considered?
fs.createReadStream but that is also async and can be slower too.
- Dominant language
- JavaScript
- Stars
- 122k
- Forks
- 37.4k
- Avg merge
- 4d 4h
- Merged PRs (30d)
- 276
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 nodejs/node
-
doc
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
build
Difficulty 1/5 Under an hour Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
-
feature request
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Similar issues
-
bug customer-eng Durable Agents Inngest status: needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
optimization optimization:agents-md-curator
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
githubnext/gh-aw-cao#13475 ·
-
[BUG]: "Clear All" in Settings doesn't clear the saved analysis, old data comes back after reload Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
AOSSIE-Org/OrgExplorer#253 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
oxc-project/oxc#26944 ·
-
ai-observability bug team/ai-observability
Difficulty 2/5 1-3 hours Newbie friendliness 78/100