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

Revise backpressure examples in streams documentation

未关闭
#94 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
45/100
Issue 类型
文档
描述清晰度
基本清楚
活跃度
停滞
领域
documentation

调研方向

先查看当前关于 streams 和 backpressure 的文档及其压缩示例,然后检查讨论和其中引用的 pull request 90 以了解背景。完成的标准是:文档对比 Node.js 的 buffering API 和 streaming API,包含 CommonJS 和 ESM 示例,解释忽略 backpressure 及其对内存的影响,并删除关于归档比较的注释。

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

描述

Problem

The current backpressure documentation contains examples that may be confusing or technically inaccurate.

Specifically:

The compression example uses the zip command in a way that does not clearly demonstrate the role of Node.js stream backpressure.
It implies that using a command-line compression utility loads the entire file into memory, which is generally not true and depends on the implementation.
The example focuses on comparing archive outputs rather than illustrating the memory and throughput implications of buffering versus streaming.

See discussion: https://stackoverflow.com/questions/79821132/node-js-back-pressure-documentation-whats-the-relevance-of-their-example

Proposed Solution

Update the examples to use Node.js APIs directly:

Replace the current zip example with fs.readFileSync() + zlib.gzipSync() examples (CommonJS and ESM variants) to demonstrate a buffering approach.
Add a corresponding streaming example using Node.js streams and zlib.createGzip().
Include an explicit example showing a stream implementation that ignores backpressure and explain why it can lead to excessive memory consumption or out-of-memory conditions.
Remove the note about comparing the resulting archives, as it does not help explain backpressure behavior.

Motivation

The primary goal of the backpressure documentation should be to help readers understand how streams regulate data flow and memory usage. Using examples based entirely on Node.js APIs makes the comparison clearer

https://github.com/nodejs/learn/pull/90

主要语言
JavaScript
星标
29
派生
165
平均合并
1 天 18 小时
30 天内合并 PR
2

贡献指南

打开贡献指南

从这里开始

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

nodejs/learn 的其他 Issue

查看 nodejs/learn 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

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