Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Sync alternative to `fs.openAsBlob`

未关闭
#65,462 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
35/100
Issue 类型
功能
描述清晰度
需要澄清
活跃度
活跃
技术栈
javascript
领域
backend

调研方向

首先检查现有的 fs.openAsBlob 和 fs.createReadStream API 及其文档。在提出入口点之前,明确同步 File API 的形态、向 Response 暴露的元数据以及跨运行时行为。API 设计达成一致,并且其行为由测试和文档覆盖,即视为完成。

由索引模型根据 Issue 内容生成。

描述

feature request
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.

主要语言
JavaScript
星标
122k
派生
37.4k
平均合并
4 天 3 小时
30 天内合并 PR
279

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

nodejs/node 的其他 Issue

查看 nodejs/node 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。