ByteLengthQueuingStrategy.size()
ByteLengthQueuingStrategy
接口的 size()
方法返回给定分块的 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.