Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Revise backpressure examples in streams documentation

Aperta
#94 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
45/100
Tipo di issue
Documentazione
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
javascript, node.js
Ambito
documentation

Direzione di ricerca

Inizia esaminando la documentazione attuale su streams e backpressure e il relativo esempio di compressione, quindi consulta la discussione e la pull request 90 indicata per il contesto. Il lavoro è completato quando la documentazione mette a confronto le API di buffering e streaming di Node.js, include esempi CommonJS ed ESM, spiega la backpressure ignorata e le conseguenze sulla memoria e rimuove la nota sul confronto degli archivi.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
JavaScript
Stelle
29
Fork
165
Merge medio
1g 18h
PR unite (30g)
2

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di nodejs/learn

Tutte le issue di nodejs/learn

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.