ByteLengthQueuingStrategy
Streams API 的 ByteLengthQueuingStrategy 接口提供了一个队列策略,该队列策略提供了内置的字节长度并且可以在构造流的时候使用。
构造函数
ByteLengthQueuingStrategy()- 
    
创建一个新的
ByteLengthQueuingStrategy对象实例。 
实例属性
ByteLengthQueuingStrategy.highWaterMark只读- 
    
在应用背压之前,内部队列可以包含的字节总数。
 
实例方法
ByteLengthQueuingStrategy.size()- 
    
返回给定分块的
byteLength属性。 
示例
js
const queueingStrategy = new ByteLengthQueuingStrategy({ highWaterMark: 1 });
const readableStream = new ReadableStream({
  start(controller) {
    // …
  },
  pull(controller) {
    // …
  },
  cancel(err) {
    console.log("stream error:", err);
  }
}, queueingStrategy);
const size = queueingStrategy.size(chunk);
规范
| Specification | 
|---|
| Streams Standard  # blqs-class  | 
浏览器兼容性
BCD tables only load in the browser