ByteLengthQueuingStrategy: highWaterMark プロパティ
ByteLengthQueuingStrategy.highWaterMark
は読み取り専用プロパティで、背圧が適用される前に内部キューに格納することができる総バイト数を返します。
メモ: CountQueuingStrategy()
では highWaterMark
引数に単純な塊の数を指定しますが、 ByteLengthQueuingStrategy()
では、 highWaterMark
引数はバイト数を指定します。具体的には、チャンクのストリームが指定された場合に、背圧が適用される前に内部キューに何バイト分のチャンクを格納することができるか(チャンクの数ではありません)を指定します。
値
整数です。
例
js
const queuingStrategy = new ByteLengthQueuingStrategy({
highWaterMark: 1 * 1024,
});
const readableStream = new ReadableStream(
{
start(controller) {
// …
},
pull(controller) {
// …
},
cancel(err) {
console.log("stream error:", err);
},
},
queuingStrategy,
);
const size = queuingStrategy.size(chunk);
console.log(`highWaterMark value: ${queuingStrategy.highWaterMark}$`);
仕様書
Specification |
---|
Streams # ref-for-blqs-high-water-mark① |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
highWaterMark |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
関連情報
ByteLengthQueuingStrategy()
コンストラクター