Missing close call on blob-get-stream causes the stream to never finish reading

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

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

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
38/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
javascript
領域
api

調査の方向性

File API blob-get-stream algorithm と Streams specification の ReadableStream close algorithm から始めてください。提供された Blob.stream() BYOB-reader の例を再現し、すべてのバイトがキューに入れられた後、読み取りが最終的に done=true を返すことを確認してください。

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

説明

I believe blog get stream algorithm is missing a call to close that stream, which results in consumers of that readable stream never 'finishing' reading that stream.

For example, without a call to "close", from my reading 'done' will never get set to true for the following test:

let buffer = new ArrayBuffer(200);
let bytesReceived = 0;
let offset = 0;

let blob = new Blob(['Data to be read! 🦬']);

const stream = blob.stream();
const reader = stream.getReader({ mode: "byob" });

while (true) {
  let result = await reader.read(new type(buffer, offset, buffer.byteLength - offset));

  if (result.done) {
    return;
  }

  buffer = result.value.buffer;
  offset += result.value.byteLength;
  bytesReceived += result.value.byteLength;
}

I think the fix should be just adding a close into the blob-get-stream algorithm after all bytes have been queued into the stream.

主要言語
HTML
スター
118
フォーク
52
平均マージ
9日 16時間
マージ済み PR(30日)
1

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

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

はじめの一歩

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

w3c/FileAPI のほかの issue

w3c/FileAPI の issue をすべて見る

似ている issue

Backend & API Design の issue をもっと見る

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

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