ByteLengthQueuingStrategy: size() メソッド
size()
は ByteLengthQueuingStrategy
インターフェイスのメソッドで、指定されたチャンクの byteLength
プロパティを返します。
構文
js
size(chunk)
引数
chunk
-
ストリームを通して渡されるデータのチャンク。
返値
指定されたチャンクのバイト長を表す整数です。
例
js
const queuingStrategy = new ByteLengthQueuingStrategy({ highWaterMark: 1 });
const readableStream = new ReadableStream(
{
start(controller) {
// …
},
pull(controller) {
// …
},
cancel(err) {
console.log("stream error:", err);
},
},
queuingStrategy,
);
const size = queueingStrategy.size(chunk);
仕様書
Specification |
---|
Streams # blqs-size |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
size |
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()
コンストラクター