ByteLengthQueuingStrategy
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The ByteLengthQueuingStrategy
interface of the Streams API provides a built-in byte length queuing strategy that can be used when constructing streams.
Constructor
ByteLengthQueuingStrategy()
-
Creates a new
ByteLengthQueuingStrategy
object instance.
Properties
None.
Methods
ByteLengthQueuingStrategy.size()
-
Returns the given chunk's
byteLength
property.
Examples
const queueingStrategy = new ByteLengthQueuingStrategy({ highWaterMark: 1 });
const readableStream = new ReadableStream({
start(controller) {
...
},
pull(controller) {
...
},
cancel(err) {
console.log("stream error:", err);
}
}, queueingStrategy);
var size = queueingStrategy.size(chunk);
Specifications
Specification |
---|
Streams Standard # blqs-class |
Browser compatibility
BCD tables only load in the browser