nodejs / nodejs/node

Start moving to Uint8Array in new APIs?

未关闭
#41,588 36 条评论 95 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

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

描述

There was a suggestion by @jasnell to use Uint8Arrays in new APIs over Buffers as well as a weigh-in by @sindresorhus saying it is easier to author cross-platform APIs when using Uint8Arrays.

Here is a context https://github.com/nodejs/node/pull/41553#discussion_r786284208

That is, the ask here is that Node.js should prefer Uint8Arrays over Buffers in new APIs.

What does everyone think? Should we stick to Buffer (which is a subclass of Uint8Array as a reminder) or prefer Uint8Arrays over buffers when possible in new APIs?

cc @nodejs/buffer @nodejs/streams

贡献指南

打开贡献指南

从这里开始

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

调研方向

首先阅读 pull request #41553 中的背景和讨论,尤其是 @jasnell 和 @sindresorhus 提出的观点。审查 Node.js API 中现有的 Buffer 优先于 Uint8Array 的倾向;完成的标准是就新 API 达成并记录一项明确的项目决策。

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

评估

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

把新 issue 发到你的邮箱

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