W3cubDocs

/DOM

ByteLengthQueuingStrategy

This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The ByteLengthQueuingStrategy interface of the 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 queuingStrategy = new ByteLengthQueuingStrategy({ highWaterMark: 1 });

const readableStream = new ReadableStream({
  start(controller) {
    ...
  },
  pull(controller) {
    ...
  },
  cancel(err) {
    console.log("stream error:", err);
  }
}, queuingStrategy);

var size = queueingStrategy.size(chunk);

Specifications

Specification Status Comment
Streams
The definition of 'ByteLengthQueuingStrategy' in that specification.
Living Standard Initial definition.

Browser Compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 58 No support ? 45 ?
Feature Android Webview Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support 58 58 No support ? 45 ?

© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/ByteLengthQueuingStrategy