fs: document readStream.start and readStream.end

未關閉 適合新手
#67,848 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

@IMRANDIL 已經在處理了。

開始於 2026年11月29日。

  • #67870 來自 @IMRANDIL —— 未關閉

評估

難度
1/5
預估耗時
1 小時以內
新手友好度
90/100
Issue 類型
文件
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
javascript, node.js
領域
documentation

研究方向

找到 fs.ReadStream 和 fs.createReadStream() 的 API 文件。將既有的 readStream.start 和 readStream.end 屬性記錄為唯讀屬性,並說明其數字/undefined 與 Infinity 值;完成表示已清楚描述這些範圍屬性,且未變更執行階段的行為。

由索引模型根據 Issue 內容生成。

描述

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.
主要語言
JavaScript
星號
124k
分支
38k
平均合併
4 天 2 小時
30 天內合併 PR
266

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

nodejs/node 的其他 Issue

查看 nodejs/node 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。