ByteLengthQueuingStrategy: size() method
Note: This feature is available in Web Workers.
The size()
method of the
ByteLengthQueuingStrategy
interface returns the given chunk's
byteLength
property.
Syntax
js
size(chunk)
Parameters
chunk
-
A chunk of data being passed through the stream.
Return value
An integer representing the byte length of the given chunk.
Examples
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);
Specifications
Specification |
---|
Streams Standard # blqs-size |
Browser compatibility
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.
See also
ByteLengthQueuingStrategy()
constructor