fs: document readStream.start and readStream.end

Offen Anfängerfreundlich
#67,848 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

@IMRANDIL arbeitet bereits daran.

Seit 29.11.2026.

  • #67870 von @IMRANDIL — offen

Bewertung

Schwierigkeit
1/5
Geschätzter Aufwand
Unter einer Stunde
Anfängerfreundlichkeit
90/100
Issue-Typ
Dokumentation
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
javascript, node.js
Bereich
documentation

Rechercherichtung

Finde die API-Dokumentation für fs.ReadStream und fs.createReadStream(). Dokumentiere die bestehenden Eigenschaften readStream.start und readStream.end als schreibgeschützt, einschließlich ihrer Zahlen-/undefined- und Infinity-Werte; fertig bedeutet, dass die Bereichseigenschaften klar beschrieben sind, ohne das Laufzeitverhalten zu ändern.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

doc
What is the problem this feature will solve?

When a library is given an fs.ReadStream, it can do much better by reading the file directly than by consuming the stream. For example, a tar lister can seek over file bodies instead of reading them. On a 100 MiB archive of 4 files, that is 11 ms instead of 91 ms. Doing this is only correct if the stream has not been read yet, and if it covers the whole file.

readStream.path, readStream.bytesRead and readStream.pending are documented. The range the stream was created with is not. It is available as the undocumented readStream.start and readStream.end properties (end is Infinity by default).

What is the feature you are proposing to solve the problem?

Document readStream.start and readStream.end as read-only properties: the byte range given to fs.createReadStream() (start is undefined or a number, and end is Infinity by default).

What alternatives have you considered?
  • Asking the caller to pass a path instead of a stream: it is not always the caller's choice.
  • Reading the undocumented properties, which works today but has no guarantee.
Vorherrschende Sprache
JavaScript
Sterne
124k
Forks
38k
Ø Merge
4 T. 2 Std.
Gemergte PRs (30 T.)
266

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus nodejs/node

Alle Issues in nodejs/node

Ähnliche Issues

Weitere Issues zu JavaScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.