nodejs / nodejs/node

Accept `Blob`s anywhere where a `Buffer` is currently accepted for writing

オープン
#53,090 コメント 12 件 リアクション 2 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

buffer feature request web streams
主要言語
JavaScript
スター
122k
フォーク
37.4k
平均マージ
4日 3時間
マージ済み PR(30日)
272

説明

What is the problem this feature will solve?

Because Buffers aren't immutable, any time a Buffer is passed to something which will perform an asynchronous write, there is a concurrency hazard where the buffer could conceivably get modified before it gets a chance to be written. This can lead to bugs which are hard to track down. (I speak from experience.)

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

Anywhere where Buffer is currently accepted for a write operation, e.g. and perhaps most notably stream.Writable.write() and stream.Writable.end(), also make it acceptable to pass a Blob. Blobs are always immutable.

What alternatives have you considered?

Just keep using Buffers, mostly keep my fingers crossed, and sometimes make copies of Buffers as a safeguard.

(Note: It also makes sense to have a way to optionally have Blobs returned from readable streams, but I figure that'd be a different feature request.)

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

Node.js の stream.Writable.write() と stream.Writable.end() のエントリポイントから始め、非同期書き込みで現在 Buffer を受け付けている他の API も調査します。必要な Blob の動作を判断し、関連する実装、テスト、API ドキュメントを更新して、readable-stream の戻り値の動作を変更せずに Blob 入力が一貫して受け付けられるようにします。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript
領域
api, backend
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
48/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。