CINXE.COM
Streams Standard
<!doctype html><html lang="en"> <head> <meta charset="utf-8"> <meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport"> <meta content="#3c790a" name="theme-color"> <meta content="light dark" name="color-scheme"> <title>Streams Standard</title> <link crossorigin href="https://resources.whatwg.org/standard-shared-with-dev.css" rel="stylesheet"> <link crossorigin href="https://resources.whatwg.org/standard.css" rel="stylesheet"> <link crossorigin href="https://resources.whatwg.org/spec.css" rel="stylesheet"> <link crossorigin href="https://resources.whatwg.org/logo-streams.svg" rel="icon"> <script crossorigin defer src="https://resources.whatwg.org/commit-snapshot-shortcut-key.js"></script> <meta content="Bikeshed version 742f3d674, updated Mon Nov 4 14:56:54 2024 -0800" name="generator"> <meta content="fa4891a35ff05281ff8ed66f8ad447644ea7cec3" name="revision"> <style> div.algorithm + div.algorithm { margin-top: 3em; } </style> <style>/* Boilerplate: style-dfn-panel */ :root { --dfnpanel-bg: #ddd; --dfnpanel-text: var(--text); --dfnpanel-target-bg: #ffc; --dfnpanel-target-outline: orange; } @media (prefers-color-scheme: dark) { :root { --dfnpanel-bg: #222; --dfnpanel-text: var(--text); --dfnpanel-target-bg: #333; --dfnpanel-target-outline: silver; } } .dfn-panel { position: absolute; z-index: 35; width: 20em; width: 300px; height: auto; max-height: 500px; overflow: auto; padding: 0.5em 0.75em; font: small Helvetica Neue, sans-serif, Droid Sans Fallback; background: var(--dfnpanel-bg); color: var(--dfnpanel-text); border: outset 0.2em; white-space: normal; /* in case it's moved into a pre */ } .dfn-panel:not(.on) { display: none; } .dfn-panel * { margin: 0; padding: 0; text-indent: 0; } .dfn-panel > b { display: block; } .dfn-panel a { color: var(--dfnpanel-text); } .dfn-panel a:not(:hover) { text-decoration: none !important; border-bottom: none !important; } .dfn-panel a:focus { outline: 5px auto Highlight; outline: 5px auto -webkit-focus-ring-color; } .dfn-panel > b + b { margin-top: 0.25em; } .dfn-panel ul { padding: 0 0 0 1em; list-style: none; } .dfn-panel li a { max-width: calc(300px - 1.5em - 1em); overflow: hidden; text-overflow: ellipsis; } .dfn-panel.activated { display: inline-block; position: fixed; left: 8px; bottom: 2em; margin: 0 auto; max-width: calc(100vw - 1.5em - .4em - .5em); max-height: 30vh; transition: left 1s ease-out, bottom 1s ease-out; } .dfn-panel .link-item:hover { text-decoration: underline; } .dfn-panel .link-item .copy-icon { opacity: 0; } .dfn-panel .link-item:hover .copy-icon, .dfn-panel .link-item .copy-icon:focus { opacity: 1; } .dfn-panel .copy-icon { display: inline-block; margin-right: 0.5em; width: 0.85em; height: 1em; border-radius: 3px; background-color: #ccc; cursor: pointer; } .dfn-panel .copy-icon .icon { width: 100%; height: 100%; background-color: #fff; display: flex; justify-content: center; align-items: center; position: relative; } .dfn-panel .copy-icon .icon::before { content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 1px solid black; background-color: #ccc; opacity: 0.25; transform: translate(3px, -3px); } .dfn-panel .copy-icon:active .icon::before { opacity: 1; } .dfn-paneled[role="button"] { cursor: help; } .highlighted { animation: target-fade 3s; } @keyframes target-fade { from { background-color: var(--dfnpanel-target-bg); outline: 5px solid var(--dfnpanel-target-outline); } to { color: var(--a-normal-text); background-color: transparent; outline: transparent; } } </style> <style>/* Boilerplate: style-mdn-anno */ :root { --mdn-bg: #EEE; --mdn-shadow: #999; --mdn-nosupport-text: #ccc; --mdn-pass: green; --mdn-fail: red; } @media (prefers-color-scheme: dark) { :root { --mdn-bg: #222; --mdn-shadow: #444; --mdn-nosupport-text: #666; --mdn-pass: #690; --mdn-fail: #d22; } } .mdn-anno { background: var(--mdn-bg, #EEE); border-radius: .25em; box-shadow: 0 0 3px var(--mdn-shadow, #999); color: var(--text, black); font: 1em sans-serif; hyphens: none; max-width: min-content; overflow: hidden; padding: 0.2em; position: absolute; right: 0.3em; top: auto; white-space: nowrap; word-wrap: normal; z-index: 8; } .mdn-anno.unpositioned { display: none; } .mdn-anno.overlapping-main { opacity: .2; transition: opacity .1s; } .mdn-anno[open] { opacity: 1; z-index: 9; min-width: 9em; } .mdn-anno:hover { opacity: 1; outline: var(--text, black) 1px solid; } .mdn-anno > summary { font-weight: normal; text-align: right; cursor: pointer; display: block; } .mdn-anno > summary > .less-than-two-engines-flag { color: var(--mdn-fail); padding-right: 2px; } .mdn-anno > summary > .all-engines-flag { color: var(--mdn-pass); padding-right: 2px; } .mdn-anno > summary > span { color: #fff; background-color: #000; font-weight: normal; font-family: zillaslab, Palatino, "Palatino Linotype", serif; padding: 2px 3px 0px 3px; line-height: 1.3em; vertical-align: top; } .mdn-anno > .feature { margin-top: 20px; } .mdn-anno > .feature:not(:first-of-type) { border-top: 1px solid #999; margin-top: 6px; padding-top: 2px; } .mdn-anno > .feature > .less-than-two-engines-text { color: var(--mdn-fail); } .mdn-anno > .feature > .all-engines-text { color: var(--mdn-pass); } .mdn-anno > .feature > p { font-size: .75em; margin-top: 6px; margin-bottom: 0; } .mdn-anno > .feature > p + p { margin-top: 3px; } .mdn-anno > .feature > .support { display: block; font-size: 0.6em; margin: 0; padding: 0; margin-top: 2px; } .mdn-anno > .feature > .support + div { padding-top: 0.5em; } .mdn-anno > .feature > .support > hr { display: block; border: none; border-top: 1px dotted #999; padding: 3px 0px 0px 0px; margin: 2px 3px 0px 3px; } .mdn-anno > .feature > .support > hr::before { content: ""; } .mdn-anno > .feature > .support > span { padding: 0.2em 0; display: block; display: table; } .mdn-anno > .feature > .support > span.no { color: var(--mdn-nosupport-text); filter: grayscale(100%); } .mdn-anno > .feature > .support > span.no::before { opacity: 0.5; } .mdn-anno > .feature > .support > span:first-of-type { padding-top: 0.5em; } .mdn-anno > .feature > .support > span > span { padding: 0 0.5em; display: table-cell; } .mdn-anno > .feature > .support > span > span:first-child { width: 100%; } .mdn-anno > .feature > .support > span > span:last-child { width: 100%; white-space: pre; padding: 0; } .mdn-anno > .feature > .support > span::before { content: ' '; display: table-cell; min-width: 1.5em; height: 1.5em; background: no-repeat center center; background-size: contain; text-align: right; font-size: 0.75em; font-weight: bold; } .mdn-anno > .feature > .support > .chrome_android::before { background-image: url(https://resources.whatwg.org/browser-logos/chrome.svg); } .mdn-anno > .feature > .support > .firefox_android::before { background-image: url(https://resources.whatwg.org/browser-logos/firefox.png); } .mdn-anno > .feature > .support > .chrome::before { background-image: url(https://resources.whatwg.org/browser-logos/chrome.svg); } .mdn-anno > .feature > .support > .edge_blink::before { background-image: url(https://resources.whatwg.org/browser-logos/edge.svg); } .mdn-anno > .feature > .support > .edge::before { background-image: url(https://resources.whatwg.org/browser-logos/edge_legacy.svg); } .mdn-anno > .feature > .support > .firefox::before { background-image: url(https://resources.whatwg.org/browser-logos/firefox.png); } .mdn-anno > .feature > .support > .ie::before { background-image: url(https://resources.whatwg.org/browser-logos/ie.png); } .mdn-anno > .feature > .support > .safari_ios::before { background-image: url(https://resources.whatwg.org/browser-logos/safari-ios.svg); } .mdn-anno > .feature > .support > .nodejs::before { background-image: url(https://nodejs.org/static/images/favicons/favicon.ico); } .mdn-anno > .feature > .support > .opera_android::before { background-image: url(https://resources.whatwg.org/browser-logos/opera.svg); } .mdn-anno > .feature > .support > .opera::before { background-image: url(https://resources.whatwg.org/browser-logos/opera.svg); } .mdn-anno > .feature > .support > .safari::before { background-image: url(https://resources.whatwg.org/browser-logos/safari.png); } .mdn-anno > .feature > .support > .samsunginternet_android::before { background-image: url(https://resources.whatwg.org/browser-logos/samsung.svg); } .mdn-anno > .feature > .support > .webview_android::before { background-image: url(https://resources.whatwg.org/browser-logos/android-webview.png); } .name-slug-mismatch { color: red; } .caniuse-status:hover { z-index: 9; } /* dt, li, .issue, .note, and .example are "position: relative", so to put annotation at right margin, must move to right of containing block */; .h-entry:not(.status-LS) dt > .mdn-anno, .h-entry:not(.status-LS) li > .mdn-anno, .h-entry:not(.status-LS) .issue > .mdn-anno, .h-entry:not(.status-LS) .note > .mdn-anno, .h-entry:not(.status-LS) .example > .mdn-anno { right: -6.7em; } .h-entry p + .mdn-anno { margin-top: 0; } h2 + .mdn-anno.after { margin: -48px 0 0 0; } h3 + .mdn-anno.after { margin: -46px 0 0 0; } h4 + .mdn-anno.after { margin: -42px 0 0 0; } h5 + .mdn-anno.after { margin: -40px 0 0 0; } h6 + .mdn-anno.after { margin: -40px 0 0 0; } </style> <style>/* Boilerplate: style-ref-hints */ :root { --ref-hint-bg: #ddd; --ref-hint-text: var(--text); } @media (prefers-color-scheme: dark) { :root { --ref-hint-bg: #222; --ref-hint-text: var(--text); } } .ref-hint { display: inline-block; position: absolute; z-index: 35; width: 20em; width: 300px; height: auto; max-height: 500px; overflow: auto; padding: 0.5em 0.5em; font: small Helvetica Neue, sans-serif, Droid Sans Fallback; background: var(--ref-hint-bg); color: var(--ref-hint-text); border: outset 0.2em; white-space: normal; /* in case it's moved into a pre */ } .ref-hint * { margin: 0; padding: 0; text-indent: 0; } .ref-hint ul { padding: 0 0 0 1em; list-style: none; } </style> <style>/* Boilerplate: style-var-click-highlighting */ /* Colors were chosen in Lab using https://nixsensor.com/free-color-converter/ D50 2deg illuminant, L in [0,100], a and b in [-128, 128] 0 = lab(85,0,85) 1 = lab(85,80,30) 2 = lab(85,-40,40) 3 = lab(85,-50,0) 4 = lab(85,5,15) 5 = lab(85,-10,-50) 6 = lab(85,35,-15) For darkmode: 0 = oklab(50% 0% 108%) 1 = oklab(50% -51% 51%) 2 = oklab(50% -64% -20%) 3 = oklab(50% 6% 19%) 4 = oklab(50% -12% -64%) 5 = oklab(50% 44% -19%) 6 = oklab(50% 102% 38%) */ [data-algorithm] var { cursor: pointer; } var[data-var-color] { background-color: var(--var-bg); box-shadow: 0 0 0 2px var(--var-bg); } var[data-var-color] { --var-bg: #F4D200; } var[data-var-color="1"] { --var-bg: #FF87A2; } var[data-var-color="2"] { --var-bg: #96E885; } var[data-var-color="3"] { --var-bg: #3EEED2; } var[data-var-color="4"] { --var-bg: #EACFB6; } var[data-var-color="5"] { --var-bg: #82DDFF; } var[data-var-color="6"] { --var-vg: #FFBCF2; } @media (prefers-color-scheme: dark) { var[data-var-color] { --var-bg: #bc1a00; } var[data-var-color="1"] { --var-bg: #007f00; } var[data-var-color="2"] { --var-bg: #008698; } var[data-var-color="3"] { --var-bg: #7f5b2b; } var[data-var-color="4"] { --var-bg: #004df3; } var[data-var-color="5"] { --var-bg: #a1248a; } var[data-var-color="6"] { --var-vg: #ff0000; } } </style> <body class="h-entry status-LS"> <div class="head"> <a class="logo" href="https://whatwg.org/"> <img alt="WHATWG" class="darkmode-aware" crossorigin height="100" src="https://resources.whatwg.org/logo-streams.svg"> </a> <hgroup> <h1 class="p-name no-ref" id="title">Streams</h1> <p id="subtitle">Living Standard — Last Updated <time class="dt-updated" datetime="2024-12-03">3 December 2024</time> </p> </hgroup> <div data-fill-with="spec-metadata"> <dl> <dt>Participate: <dd><a href="https://github.com/whatwg/streams">GitHub whatwg/streams</a> (<a href="https://github.com/whatwg/streams/issues/new/choose">new issue</a>, <a href="https://github.com/whatwg/streams/issues">open issues</a>) <dd><a href="https://whatwg.org/chat">Chat on Matrix</a> <dt>Commits: <dd><a href="https://github.com/whatwg/streams/commits">GitHub whatwg/streams/commits</a> <dd><a href="/commit-snapshots/fa4891a35ff05281ff8ed66f8ad447644ea7cec3/" id="commit-snapshot-link">Snapshot as of this commit</a> <dd><a href="https://twitter.com/streamsstandard">@streamsstandard</a> <dt>Tests: <dd><a href="https://github.com/web-platform-tests/wpt/tree/master/streams">web-platform-tests streams/</a> (<a href="https://github.com/web-platform-tests/wpt/labels/streams">ongoing work</a>) <dt>Translations <small>(non-normative)</small>: <dd><span title="Japanese"><a href="https://triple-underscore.github.io/Streams-ja.html" hreflang="ja" lang="ja" rel="alternate">日本語</a></span> <dt>Demos: <dd><a href="https://streams.spec.whatwg.org/demos/">streams.spec.whatwg.org/demos</a> </dl> </div> <div data-fill-with="warning"></div> </div> <div class="p-summary" data-fill-with="abstract"> <h2 class="no-num no-toc no-ref heading settled" id="abstract"><span class="content">Abstract</span></h2> <p>This specification provides APIs for creating, composing, and consuming streams of data that map efficiently to low-level I/O primitives.</p> </div> <nav data-fill-with="table-of-contents" id="toc"> <h2 class="no-num no-toc no-ref" id="contents">Table of Contents</h2> <ol class="toc" role="directory"> <li><a href="#intro"><span class="secno">1</span> <span class="content">Introduction</span></a> <li> <a href="#model"><span class="secno">2</span> <span class="content">Model</span></a> <ol class="toc"> <li><a href="#rs-model"><span class="secno">2.1</span> <span class="content">Readable streams</span></a> <li><a href="#ws-model"><span class="secno">2.2</span> <span class="content">Writable streams</span></a> <li><a href="#ts-model"><span class="secno">2.3</span> <span class="content">Transform streams</span></a> <li><a href="#pipe-chains"><span class="secno">2.4</span> <span class="content">Pipe chains and backpressure</span></a> <li><a href="#queuing-strategies"><span class="secno">2.5</span> <span class="content">Internal queues and queuing strategies</span></a> <li><a href="#locking"><span class="secno">2.6</span> <span class="content">Locking</span></a> </ol> <li><a href="#conventions"><span class="secno">3</span> <span class="content">Conventions</span></a> <li> <a href="#rs"><span class="secno">4</span> <span class="content">Readable streams</span></a> <ol class="toc"> <li><a href="#rs-intro"><span class="secno">4.1</span> <span class="content">Using readable streams</span></a> <li> <a href="#rs-class"><span class="secno">4.2</span> <span class="content">The <code class="idl"><span>ReadableStream</span></code> class</span></a> <ol class="toc"> <li><a href="#rs-class-definition"><span class="secno">4.2.1</span> <span class="content">Interface definition</span></a> <li><a href="#rs-internal-slots"><span class="secno">4.2.2</span> <span class="content">Internal slots</span></a> <li><a href="#underlying-source-api"><span class="secno">4.2.3</span> <span class="content">The underlying source API</span></a> <li><a href="#rs-prototype"><span class="secno">4.2.4</span> <span class="content">Constructor, methods, and properties</span></a> <li><a href="#rs-asynciterator"><span class="secno">4.2.5</span> <span class="content">Asynchronous iteration</span></a> <li><a href="#rs-transfer"><span class="secno">4.2.6</span> <span class="content">Transfer via <code>postMessage()</code></span></a> </ol> <li> <a href="#generic-reader-mixin"><span class="secno">4.3</span> <span class="content">The <code class="idl"><span>ReadableStreamGenericReader</span></code> mixin</span></a> <ol class="toc"> <li><a href="#generic-reader-mixin-definition"><span class="secno">4.3.1</span> <span class="content">Mixin definition</span></a> <li><a href="#generic-reader-internal-slots"><span class="secno">4.3.2</span> <span class="content">Internal slots</span></a> <li><a href="#generic-reader-prototype"><span class="secno">4.3.3</span> <span class="content">Methods and properties</span></a> </ol> <li> <a href="#default-reader-class"><span class="secno">4.4</span> <span class="content">The <code class="idl"><span>ReadableStreamDefaultReader</span></code> class</span></a> <ol class="toc"> <li><a href="#default-reader-class-definition"><span class="secno">4.4.1</span> <span class="content">Interface definition</span></a> <li><a href="#default-reader-internal-slots"><span class="secno">4.4.2</span> <span class="content">Internal slots</span></a> <li><a href="#default-reader-prototype"><span class="secno">4.4.3</span> <span class="content">Constructor, methods, and properties</span></a> </ol> <li> <a href="#byob-reader-class"><span class="secno">4.5</span> <span class="content">The <code class="idl"><span>ReadableStreamBYOBReader</span></code> class</span></a> <ol class="toc"> <li><a href="#byob-reader-class-definition"><span class="secno">4.5.1</span> <span class="content">Interface definition</span></a> <li><a href="#byob-reader-internal-slots"><span class="secno">4.5.2</span> <span class="content">Internal slots</span></a> <li><a href="#byob-reader-prototype"><span class="secno">4.5.3</span> <span class="content">Constructor, methods, and properties</span></a> </ol> <li> <a href="#rs-default-controller-class"><span class="secno">4.6</span> <span class="content">The <code class="idl"><span>ReadableStreamDefaultController</span></code> class</span></a> <ol class="toc"> <li><a href="#rs-default-controller-class-definition"><span class="secno">4.6.1</span> <span class="content">Interface definition</span></a> <li><a href="#rs-default-controller-internal-slots"><span class="secno">4.6.2</span> <span class="content">Internal slots</span></a> <li><a href="#rs-default-controller-prototype"><span class="secno">4.6.3</span> <span class="content">Methods and properties</span></a> <li><a href="#rs-default-controller-internal-methods"><span class="secno">4.6.4</span> <span class="content">Internal methods</span></a> </ol> <li> <a href="#rbs-controller-class"><span class="secno">4.7</span> <span class="content">The <code class="idl"><span>ReadableByteStreamController</span></code> class</span></a> <ol class="toc"> <li><a href="#rbs-controller-class-definition"><span class="secno">4.7.1</span> <span class="content">Interface definition</span></a> <li><a href="#rbs-controller-internal-slots"><span class="secno">4.7.2</span> <span class="content">Internal slots</span></a> <li><a href="#rbs-controller-prototype"><span class="secno">4.7.3</span> <span class="content">Methods and properties</span></a> <li><a href="#rbs-controller-internal-methods"><span class="secno">4.7.4</span> <span class="content">Internal methods</span></a> </ol> <li> <a href="#rs-byob-request-class"><span class="secno">4.8</span> <span class="content">The <code class="idl"><span>ReadableStreamBYOBRequest</span></code> class</span></a> <ol class="toc"> <li><a href="#rs-byob-request-class-definition"><span class="secno">4.8.1</span> <span class="content">Interface definition</span></a> <li><a href="#rs-byob-request-internal-slots"><span class="secno">4.8.2</span> <span class="content">Internal slots</span></a> <li><a href="#rs-byob-request-prototype"><span class="secno">4.8.3</span> <span class="content">Methods and properties</span></a> </ol> <li> <a href="#rs-all-abstract-ops"><span class="secno">4.9</span> <span class="content">Abstract operations</span></a> <ol class="toc"> <li><a href="#rs-abstract-ops"><span class="secno">4.9.1</span> <span class="content">Working with readable streams</span></a> <li><a href="#rs-abstract-ops-used-by-controllers"><span class="secno">4.9.2</span> <span class="content">Interfacing with controllers</span></a> <li><a href="#rs-reader-abstract-ops"><span class="secno">4.9.3</span> <span class="content">Readers</span></a> <li><a href="#rs-default-controller-abstract-ops"><span class="secno">4.9.4</span> <span class="content">Default controllers</span></a> <li><a href="#rbs-controller-abstract-ops"><span class="secno">4.9.5</span> <span class="content">Byte stream controllers</span></a> </ol> </ol> <li> <a href="#ws"><span class="secno">5</span> <span class="content">Writable streams</span></a> <ol class="toc"> <li><a href="#ws-intro"><span class="secno">5.1</span> <span class="content">Using writable streams</span></a> <li> <a href="#ws-class"><span class="secno">5.2</span> <span class="content">The <code class="idl"><span>WritableStream</span></code> class</span></a> <ol class="toc"> <li><a href="#ws-class-definition"><span class="secno">5.2.1</span> <span class="content">Interface definition</span></a> <li><a href="#ws-internal-slots"><span class="secno">5.2.2</span> <span class="content">Internal slots</span></a> <li><a href="#underlying-sink-api"><span class="secno">5.2.3</span> <span class="content">The underlying sink API</span></a> <li><a href="#ws-prototype"><span class="secno">5.2.4</span> <span class="content">Constructor, methods, and properties</span></a> <li><a href="#ws-transfer"><span class="secno">5.2.5</span> <span class="content">Transfer via <code>postMessage()</code></span></a> </ol> <li> <a href="#default-writer-class"><span class="secno">5.3</span> <span class="content">The <code class="idl"><span>WritableStreamDefaultWriter</span></code> class</span></a> <ol class="toc"> <li><a href="#default-writer-class-definition"><span class="secno">5.3.1</span> <span class="content">Interface definition</span></a> <li><a href="#default-writer-internal-slots"><span class="secno">5.3.2</span> <span class="content">Internal slots</span></a> <li><a href="#default-writer-prototype"><span class="secno">5.3.3</span> <span class="content">Constructor, methods, and properties</span></a> </ol> <li> <a href="#ws-default-controller-class"><span class="secno">5.4</span> <span class="content">The <code class="idl"><span>WritableStreamDefaultController</span></code> class</span></a> <ol class="toc"> <li><a href="#ws-default-controller-class-definition"><span class="secno">5.4.1</span> <span class="content">Interface definition</span></a> <li><a href="#ws-default-controller-internal-slots"><span class="secno">5.4.2</span> <span class="content">Internal slots</span></a> <li><a href="#ws-default-controller-prototype"><span class="secno">5.4.3</span> <span class="content">Methods and properties</span></a> <li><a href="#ws-default-controller-internal-methods"><span class="secno">5.4.4</span> <span class="content">Internal methods</span></a> </ol> <li> <a href="#ws-all-abstract-ops"><span class="secno">5.5</span> <span class="content">Abstract operations</span></a> <ol class="toc"> <li><a href="#ws-abstract-ops"><span class="secno">5.5.1</span> <span class="content">Working with writable streams</span></a> <li><a href="#ws-abstract-ops-used-by-controllers"><span class="secno">5.5.2</span> <span class="content">Interfacing with controllers</span></a> <li><a href="#ws-writer-abstract-ops"><span class="secno">5.5.3</span> <span class="content">Writers</span></a> <li><a href="#ws-default-controller-abstract-ops"><span class="secno">5.5.4</span> <span class="content">Default controllers</span></a> </ol> </ol> <li> <a href="#ts"><span class="secno">6</span> <span class="content">Transform streams</span></a> <ol class="toc"> <li><a href="#ts-intro"><span class="secno">6.1</span> <span class="content">Using transform streams</span></a> <li> <a href="#ts-class"><span class="secno">6.2</span> <span class="content">The <code class="idl"><span>TransformStream</span></code> class</span></a> <ol class="toc"> <li><a href="#ts-class-definition"><span class="secno">6.2.1</span> <span class="content">Interface definition</span></a> <li><a href="#ts-internal-slots"><span class="secno">6.2.2</span> <span class="content">Internal slots</span></a> <li><a href="#transformer-api"><span class="secno">6.2.3</span> <span class="content">The transformer API</span></a> <li><a href="#ts-prototype"><span class="secno">6.2.4</span> <span class="content">Constructor and properties</span></a> <li><a href="#ts-transfer"><span class="secno">6.2.5</span> <span class="content">Transfer via <code>postMessage()</code></span></a> </ol> <li> <a href="#ts-default-controller-class"><span class="secno">6.3</span> <span class="content">The <code class="idl"><span>TransformStreamDefaultController</span></code> class</span></a> <ol class="toc"> <li><a href="#ts-default-controller-class-definition"><span class="secno">6.3.1</span> <span class="content">Interface definition</span></a> <li><a href="#ts-default-controller-internal-slots"><span class="secno">6.3.2</span> <span class="content">Internal slots</span></a> <li><a href="#ts-default-controller-prototype"><span class="secno">6.3.3</span> <span class="content">Methods and properties</span></a> </ol> <li> <a href="#ts-all-abstract-ops"><span class="secno">6.4</span> <span class="content">Abstract operations</span></a> <ol class="toc"> <li><a href="#ts-abstract-ops"><span class="secno">6.4.1</span> <span class="content">Working with transform streams</span></a> <li><a href="#ts-default-controller-abstract-ops"><span class="secno">6.4.2</span> <span class="content">Default controllers</span></a> <li><a href="#ts-default-sink-abstract-ops"><span class="secno">6.4.3</span> <span class="content">Default sinks</span></a> <li><a href="#ts-default-source-abstract-ops"><span class="secno">6.4.4</span> <span class="content">Default sources</span></a> </ol> </ol> <li> <a href="#qs"><span class="secno">7</span> <span class="content">Queuing strategies</span></a> <ol class="toc"> <li><a href="#qs-api"><span class="secno">7.1</span> <span class="content">The queuing strategy API</span></a> <li> <a href="#blqs-class"><span class="secno">7.2</span> <span class="content">The <code class="idl"><span>ByteLengthQueuingStrategy</span></code> class</span></a> <ol class="toc"> <li><a href="#blqs-class-definition"><span class="secno">7.2.1</span> <span class="content">Interface definition</span></a> <li><a href="#blqs-internal-slots"><span class="secno">7.2.2</span> <span class="content">Internal slots</span></a> <li><a href="#blqs-prototype"><span class="secno">7.2.3</span> <span class="content">Constructor and properties</span></a> </ol> <li> <a href="#cqs-class"><span class="secno">7.3</span> <span class="content">The <code class="idl"><span>CountQueuingStrategy</span></code> class</span></a> <ol class="toc"> <li><a href="#cqs-class-definition"><span class="secno">7.3.1</span> <span class="content">Interface definition</span></a> <li><a href="#cqs-internal-slots"><span class="secno">7.3.2</span> <span class="content">Internal slots</span></a> <li><a href="#cqs-prototype"><span class="secno">7.3.3</span> <span class="content">Constructor and properties</span></a> </ol> <li><a href="#qs-abstract-ops"><span class="secno">7.4</span> <span class="content">Abstract operations</span></a> </ol> <li> <a href="#other-stuff"><span class="secno">8</span> <span class="content">Supporting abstract operations</span></a> <ol class="toc"> <li><a href="#queue-with-sizes"><span class="secno">8.1</span> <span class="content">Queue-with-sizes</span></a> <li><a href="#transferrable-streams"><span class="secno">8.2</span> <span class="content">Transferable streams</span></a> <li><a href="#misc-abstract-ops"><span class="secno">8.3</span> <span class="content">Miscellaneous</span></a> </ol> <li> <a href="#other-specs"><span class="secno">9</span> <span class="content">Using streams in other specifications</span></a> <ol class="toc"> <li> <a href="#other-specs-rs"><span class="secno">9.1</span> <span class="content">Readable streams</span></a> <ol class="toc"> <li><a href="#other-specs-rs-create"><span class="secno">9.1.1</span> <span class="content">Creation and manipulation</span></a> <li><a href="#other-specs-rs-reading"><span class="secno">9.1.2</span> <span class="content">Reading</span></a> <li><a href="#other-specs-rs-introspect"><span class="secno">9.1.3</span> <span class="content">Introspection</span></a> </ol> <li> <a href="#other-specs-ws"><span class="secno">9.2</span> <span class="content">Writable streams</span></a> <ol class="toc"> <li><a href="#other-specs-ws-creation"><span class="secno">9.2.1</span> <span class="content">Creation and manipulation</span></a> <li><a href="#other-specs-ws-writing"><span class="secno">9.2.2</span> <span class="content">Writing</span></a> </ol> <li> <a href="#other-specs-ts"><span class="secno">9.3</span> <span class="content">Transform streams</span></a> <ol class="toc"> <li><a href="#other-specs-ts-creation"><span class="secno">9.3.1</span> <span class="content">Creation and manipulation</span></a> <li><a href="#other-specs-ts-wrapping"><span class="secno">9.3.2</span> <span class="content">Wrapping into a custom class</span></a> </ol> <li> <a href="#other-specs-pairs"><span class="secno">9.4</span> <span class="content">Other stream pairs</span></a> <ol class="toc"> <li><a href="#other-specs-duplex"><span class="secno">9.4.1</span> <span class="content">Duplex streams</span></a> <li><a href="#other-specs-endpoints"><span class="secno">9.4.2</span> <span class="content">Endpoint pairs</span></a> </ol> <li><a href="#other-specs-piping"><span class="secno">9.5</span> <span class="content">Piping</span></a> </ol> <li> <a href="#creating-examples"><span class="secno">10</span> <span class="content">Examples of creating streams</span></a> <ol class="toc"> <li><a href="#example-rs-push-no-backpressure"><span class="secno">10.1</span> <span class="content">A readable stream with an underlying push source (no backpressure support)</span></a> <li><a href="#example-rs-push-backpressure"><span class="secno">10.2</span> <span class="content">A readable stream with an underlying push source and backpressure support</span></a> <li><a href="#example-rbs-push"><span class="secno">10.3</span> <span class="content">A readable byte stream with an underlying push source (no backpressure support)</span></a> <li><a href="#example-rs-pull"><span class="secno">10.4</span> <span class="content">A readable stream with an underlying pull source</span></a> <li><a href="#example-rbs-pull"><span class="secno">10.5</span> <span class="content">A readable byte stream with an underlying pull source</span></a> <li><a href="#example-ws-no-backpressure"><span class="secno">10.6</span> <span class="content">A writable stream with no backpressure or success signals</span></a> <li><a href="#example-ws-backpressure"><span class="secno">10.7</span> <span class="content">A writable stream with backpressure and success signals</span></a> <li><a href="#example-both"><span class="secno">10.8</span> <span class="content">A { readable, writable } stream pair wrapping the same underlying resource</span></a> <li><a href="#example-ts-lipfuzz"><span class="secno">10.9</span> <span class="content">A transform stream that replaces template tags</span></a> <li><a href="#example-ts-sync-mapper"><span class="secno">10.10</span> <span class="content">A transform stream created from a sync mapper function</span></a> <li><a href="#example-identity-transform-usages"><span class="secno">10.11</span> <span class="content">Using an identity transform stream as a primitive to create new readable streams</span></a> </ol> <li><a href="#acks"><span class="secno"></span> <span class="content">Acknowledgments</span></a> <li><a href="#ipr"><span class="secno"></span> <span class="content">Intellectual property rights</span></a> <li> <a href="#index"><span class="secno"></span> <span class="content">Index</span></a> <ol class="toc"> <li><a href="#index-defined-here"><span class="secno"></span> <span class="content">Terms defined by this specification</span></a> <li><a href="#index-defined-elsewhere"><span class="secno"></span> <span class="content">Terms defined by reference</span></a> </ol> <li> <a href="#references"><span class="secno"></span> <span class="content">References</span></a> <ol class="toc"> <li><a href="#normative"><span class="secno"></span> <span class="content">Normative References</span></a> <li><a href="#informative"><span class="secno"></span> <span class="content">Informative References</span></a> </ol> <li><a href="#idl-index"><span class="secno"></span> <span class="content">IDL Index</span></a> </ol> </nav> <main> <h2 class="heading settled" data-level="1" id="intro"><span class="secno">1. </span><span class="content">Introduction</span><a class="self-link" href="#intro"></a></h2> <div class="non-normative"> <p><em>This section is non-normative.</em></p> <p>Large swathes of the web platform are built on streaming data: that is, data that is created, processed, and consumed in an incremental fashion, without ever reading all of it into memory. The Streams Standard provides a common set of APIs for creating and interfacing with such streaming data, embodied in <a data-link-type="dfn" href="#readable-stream" id="ref-for-readable-stream">readable streams</a>, <a data-link-type="dfn" href="#writable-stream" id="ref-for-writable-stream">writable streams</a>, and <a data-link-type="dfn" href="#transform-stream" id="ref-for-transform-stream">transform streams</a>.</p> <p>These APIs have been designed to efficiently map to low-level I/O primitives, including specializations for byte streams where appropriate. They allow easy composition of multiple streams into <a data-link-type="dfn" href="#pipe-chain" id="ref-for-pipe-chain">pipe chains</a>, or can be used directly via <a data-link-type="dfn" href="#reader" id="ref-for-reader">readers</a> and <a data-link-type="dfn" href="#writer" id="ref-for-writer">writers</a>. Finally, they are designed to automatically provide <a data-link-type="dfn" href="#backpressure" id="ref-for-backpressure">backpressure</a> and queuing.</p> <p>This standard provides the base stream primitives which other parts of the web platform can use to expose their streaming data. For example, <a data-link-type="biblio" href="#biblio-fetch" title="Fetch Standard">[FETCH]</a> exposes <code class="idl"><a data-link-type="idl" href="https://fetch.spec.whatwg.org/#response" id="ref-for-response">Response</a></code> bodies as <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream">ReadableStream</a></code> instances. More generally, the platform is full of streaming abstractions waiting to be expressed as streams: multimedia streams, file streams, inter-global communication, and more benefit from being able to process data incrementally instead of buffering it all into memory and processing it in one go. By providing the foundation for these streams to be exposed to developers, the Streams Standard enables use cases like:</p> <ul> <li data-md> <p>Video effects: piping a readable video stream through a transform stream that applies effects in real time.</p> <li data-md> <p>Decompression: piping a file stream through a transform stream that selectively decompresses files from a <kbd>.tgz</kbd> archive, turning them into <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/embedded-content.html#the-img-element" id="ref-for-the-img-element">img</a></code> elements as the user scrolls through an image gallery.</p> <li data-md> <p>Image decoding: piping an HTTP response stream through a transform stream that decodes bytes into bitmap data, and then through another transform that translates bitmaps into PNGs. If installed inside the <code class="idl"><a data-link-type="idl" href="https://w3c.github.io/ServiceWorker/#service-worker-global-scope-fetch-event" id="ref-for-service-worker-global-scope-fetch-event">fetch</a></code> hook of a service worker, this would allow developers to transparently polyfill new image formats. <a data-link-type="biblio" href="#biblio-service-workers" title="Service Workers">[SERVICE-WORKERS]</a></p> </ul> <p>Web developers can also use the APIs described here to create their own streams, with the same APIs as those provided by the platform. Other developers can then transparently compose platform-provided streams with those supplied by libraries. In this way, the APIs described here provide unifying abstraction for all streams, encouraging an ecosystem to grow around these shared and composable interfaces.</p> </div> <h2 class="heading settled" data-level="2" id="model"><span class="secno">2. </span><span class="content">Model</span><a class="self-link" href="#model"></a></h2> <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="chunk">chunk</dfn> is a single piece of data that is written to or read from a stream. It can be of any type; streams can even contain chunks of different types. A chunk will often not be the most atomic unit of data for a given stream; for example a byte stream might contain chunks consisting of 16 KiB <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-typedarray-objects" id="ref-for-sec-typedarray-objects">Uint8Array</a></code>s, instead of single bytes.</p> <h3 class="heading settled" data-level="2.1" id="rs-model"><span class="secno">2.1. </span><span class="content">Readable streams</span><a class="self-link" href="#rs-model"></a></h3> <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="readable-stream">readable stream</dfn> represents a source of data, from which you can read. In other words, data comes <em>out</em> of a readable stream. Concretely, a readable stream is an instance of the <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream①">ReadableStream</a></code> class.</p> <p>Although a readable stream can be created with arbitrary behavior, most readable streams wrap a lower-level I/O source, called the <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="underlying-source">underlying source</dfn>. There are two types of underlying source: push sources and pull sources.</p> <p><dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="push source" data-noexport id="push-source">Push sources</dfn> push data at you, whether or not you are listening for it. They may also provide a mechanism for pausing and resuming the flow of data. An example push source is a TCP socket, where data is constantly being pushed from the OS level, at a rate that can be controlled by changing the TCP window size.</p> <p><dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="pull source" data-noexport id="pull-source">Pull sources</dfn> require you to request data from them. The data may be available synchronously, e.g. if it is held by the operating system’s in-memory buffers, or asynchronously, e.g. if it has to be read from disk. An example pull source is a file handle, where you seek to specific locations and read specific amounts.</p> <p>Readable streams are designed to wrap both types of sources behind a single, unified interface. For web developer–created streams, the implementation details of a source are provided by <a href="#underlying-source-api">an object with certain methods and properties</a> that is passed to the <code class="idl"><a data-link-type="idl" href="#rs-constructor" id="ref-for-rs-constructor">ReadableStream()</a></code> constructor.</p> <p><a data-link-type="dfn" href="#chunk" id="ref-for-chunk">Chunks</a> are enqueued into the stream by the stream’s <a data-link-type="dfn" href="#underlying-source" id="ref-for-underlying-source">underlying source</a>. They can then be read one at a time via the stream’s public interface, in particular by using a <a data-link-type="dfn" href="#reader" id="ref-for-reader①">readable stream reader</a> acquired using the stream’s <code class="idl"><a data-link-type="idl" href="#rs-get-reader" id="ref-for-rs-get-reader">getReader()</a></code> method.</p> <p>Code that reads from a readable stream using its public interface is known as a <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="consumer">consumer</dfn>.</p> <p>Consumers also have the ability to <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="cancel a readable stream" data-noexport id="cancel-a-readable-stream">cancel</dfn> a readable stream, using its <code class="idl"><a data-link-type="idl" href="#rs-cancel" id="ref-for-rs-cancel">cancel()</a></code> method. This indicates that the consumer has lost interest in the stream, and will immediately close the stream, throw away any queued <a data-link-type="dfn" href="#chunk" id="ref-for-chunk①">chunks</a>, and execute any cancellation mechanism of the <a data-link-type="dfn" href="#underlying-source" id="ref-for-underlying-source①">underlying source</a>.</p> <p>Consumers can also <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="tee a readable stream" data-noexport id="tee-a-readable-stream">tee</dfn> a readable stream using its <code class="idl"><a data-link-type="idl" href="#rs-tee" id="ref-for-rs-tee">tee()</a></code> method. This will <a data-link-type="dfn" href="#lock" id="ref-for-lock">lock</a> the stream, making it no longer directly usable; however, it will create two new streams, called <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="branches of a readable stream tee" data-noexport id="branches-of-a-readable-stream-tee">branches</dfn>, which can be consumed independently.</p> <p>For streams representing bytes, an extended version of the <a data-link-type="dfn" href="#readable-stream" id="ref-for-readable-stream①">readable stream</a> is provided to handle bytes efficiently, in particular by minimizing copies. The <a data-link-type="dfn" href="#underlying-source" id="ref-for-underlying-source②">underlying source</a> for such a readable stream is called an <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="underlying-byte-source">underlying byte source</dfn>. A readable stream whose underlying source is an underlying byte source is sometimes called a <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="readable-byte-stream">readable byte stream</dfn>. Consumers of a readable byte stream can acquire a <a data-link-type="dfn" href="#byob-reader" id="ref-for-byob-reader">BYOB reader</a> using the stream’s <code class="idl"><a data-link-type="idl" href="#rs-get-reader" id="ref-for-rs-get-reader①">getReader()</a></code> method.</p> <h3 class="heading settled" data-level="2.2" id="ws-model"><span class="secno">2.2. </span><span class="content">Writable streams</span><a class="self-link" href="#ws-model"></a></h3> <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="writable-stream">writable stream</dfn> represents a destination for data, into which you can write. In other words, data goes <em>in</em> to a writable stream. Concretely, a writable stream is an instance of the <code class="idl"><a data-link-type="idl" href="#writablestream" id="ref-for-writablestream">WritableStream</a></code> class.</p> <p>Analogously to readable streams, most writable streams wrap a lower-level I/O sink, called the <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="underlying-sink">underlying sink</dfn>. Writable streams work to abstract away some of the complexity of the underlying sink, by queuing subsequent writes and only delivering them to the underlying sink one by one.</p> <p><a data-link-type="dfn" href="#chunk" id="ref-for-chunk②">Chunks</a> are written to the stream via its public interface, and are passed one at a time to the stream’s <a data-link-type="dfn" href="#underlying-sink" id="ref-for-underlying-sink">underlying sink</a>. For web developer-created streams, the implementation details of the sink are provided by <a href="#underlying-sink-api">an object with certain methods</a> that is passed to the <code class="idl"><a data-link-type="idl" href="#ws-constructor" id="ref-for-ws-constructor">WritableStream()</a></code> constructor.</p> <p>Code that writes into a writable stream using its public interface is known as a <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="producer">producer</dfn>.</p> <p>Producers also have the ability to <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="abort a writable stream" data-noexport id="abort-a-writable-stream">abort</dfn> a writable stream, using its <code class="idl"><a data-link-type="idl" href="#ws-abort" id="ref-for-ws-abort">abort()</a></code> method. This indicates that the producer believes something has gone wrong, and that future writes should be discontinued. It puts the stream in an errored state, even without a signal from the <a data-link-type="dfn" href="#underlying-sink" id="ref-for-underlying-sink①">underlying sink</a>, and it discards all writes in the stream’s <a data-link-type="dfn" href="#internal-queues" id="ref-for-internal-queues">internal queue</a>.</p> <h3 class="heading settled" data-level="2.3" id="ts-model"><span class="secno">2.3. </span><span class="content">Transform streams</span><a class="self-link" href="#ts-model"></a></h3> <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="transform-stream">transform stream</dfn> consists of a pair of streams: a <a data-link-type="dfn" href="#writable-stream" id="ref-for-writable-stream①">writable stream</a>, known as its <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="writable-side">writable side</dfn>, and a <a data-link-type="dfn" href="#readable-stream" id="ref-for-readable-stream②">readable stream</a>, known as its <dfn class="dfn-paneled" data-dfn-type="dfn" data-export data-lt="readable side" id="readable-side">readable side</dfn>. In a manner specific to the transform stream in question, writes to the writable side result in new data being made available for reading from the readable side.</p> <p>Concretely, any object with a <code>writable</code> property and a <code>readable</code> property can serve as a transform stream. However, the standard <code class="idl"><a data-link-type="idl" href="#transformstream" id="ref-for-transformstream">TransformStream</a></code> class makes it much easier to create such a pair that is properly entangled. It wraps a <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="transformer">transformer</dfn>, which defines algorithms for the specific transformation to be performed. For web developer–created streams, the implementation details of a transformer are provided by <a href="#transformer-api">an object with certain methods and properties</a> that is passed to the <code class="idl"><a data-link-type="idl" href="#ts-constructor" id="ref-for-ts-constructor">TransformStream()</a></code> constructor. Other specifications might use the <code class="idl"><a data-link-type="idl" href="#generictransformstream" id="ref-for-generictransformstream">GenericTransformStream</a></code> mixin to create classes with the same <code>writable</code>/<code>readable</code> property pair but other custom APIs layered on top.</p> <p>An <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="identity-transform-stream">identity transform stream</dfn> is a type of transform stream which forwards all <a data-link-type="dfn" href="#chunk" id="ref-for-chunk③">chunks</a> written to its <a data-link-type="dfn" href="#writable-side" id="ref-for-writable-side">writable side</a> to its <a data-link-type="dfn" href="#readable-side" id="ref-for-readable-side">readable side</a>, without any changes. This can be useful in <a href="#example-transform-identity">a variety of scenarios</a>. By default, the <code class="idl"><a data-link-type="idl" href="#transformstream" id="ref-for-transformstream①">TransformStream</a></code> constructor will create an identity transform stream, when no <code class="idl"><a data-link-type="idl" href="#dom-transformer-transform" id="ref-for-dom-transformer-transform">transform()</a></code> method is present on the <a data-link-type="dfn" href="#transformer" id="ref-for-transformer">transformer</a> object.</p> <p>Some examples of potential transform streams include:</p> <ul> <li data-md> <p>A GZIP compressor, to which uncompressed bytes are written and from which compressed bytes are read;</p> <li data-md> <p>A video decoder, to which encoded bytes are written and from which uncompressed video frames are read;</p> <li data-md> <p>A text decoder, to which bytes are written and from which strings are read;</p> <li data-md> <p>A CSV-to-JSON converter, to which strings representing lines of a CSV file are written and from which corresponding JavaScript objects are read.</p> </ul> <h3 class="heading settled" data-level="2.4" id="pipe-chains"><span class="secno">2.4. </span><span class="content">Pipe chains and backpressure</span><a class="self-link" href="#pipe-chains"></a></h3> <p>Streams are primarily used by <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="piping">piping</dfn> them to each other. A readable stream can be piped directly to a writable stream, using its <code class="idl"><a data-link-type="idl" href="#rs-pipe-to" id="ref-for-rs-pipe-to">pipeTo()</a></code> method, or it can be piped through one or more transform streams first, using its <code class="idl"><a data-link-type="idl" href="#rs-pipe-through" id="ref-for-rs-pipe-through">pipeThrough()</a></code> method.</p> <p>A set of streams piped together in this way is referred to as a <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="pipe-chain">pipe chain</dfn>. In a pipe chain, the <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="original-source">original source</dfn> is the <a data-link-type="dfn" href="#underlying-source" id="ref-for-underlying-source③">underlying source</a> of the first readable stream in the chain; the <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="ultimate-sink">ultimate sink</dfn> is the <a data-link-type="dfn" href="#underlying-sink" id="ref-for-underlying-sink②">underlying sink</a> of the final writable stream in the chain.</p> <p>Once a pipe chain is constructed, it will propagate signals regarding how fast <a data-link-type="dfn" href="#chunk" id="ref-for-chunk④">chunks</a> should flow through it. If any step in the chain cannot yet accept chunks, it propagates a signal backwards through the pipe chain, until eventually the original source is told to stop producing chunks so fast. This process of normalizing flow from the original source according to how fast the chain can process chunks is called <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="backpressure">backpressure</dfn>.</p> <p>Concretely, the <a data-link-type="dfn" href="#original-source" id="ref-for-original-source">original source</a> is given the <code class="idl"><a data-link-type="idl" href="#rs-default-controller-desired-size" id="ref-for-rs-default-controller-desired-size">controller.desiredSize</a></code> (or <code class="idl"><a data-link-type="idl" href="#rbs-controller-desired-size" id="ref-for-rbs-controller-desired-size">byteController.desiredSize</a></code>) value, and can then adjust its rate of data flow accordingly. This value is derived from the <code class="idl"><a data-link-type="idl" href="#default-writer-desired-size" id="ref-for-default-writer-desired-size">writer.desiredSize</a></code> corresponding to the <a data-link-type="dfn" href="#ultimate-sink" id="ref-for-ultimate-sink">ultimate sink</a>, which gets updated as the ultimate sink finishes writing <a data-link-type="dfn" href="#chunk" id="ref-for-chunk⑤">chunks</a>. The <code class="idl"><a data-link-type="idl" href="#rs-pipe-to" id="ref-for-rs-pipe-to①">pipeTo()</a></code> method used to construct the chain automatically ensures this information propagates back through the <a data-link-type="dfn" href="#pipe-chain" id="ref-for-pipe-chain①">pipe chain</a>.</p> <p>When <a data-link-type="dfn" href="#tee-a-readable-stream" id="ref-for-tee-a-readable-stream">teeing</a> a readable stream, the <a data-link-type="dfn" href="#backpressure" id="ref-for-backpressure①">backpressure</a> signals from its two <a data-link-type="dfn" href="#branches-of-a-readable-stream-tee" id="ref-for-branches-of-a-readable-stream-tee">branches</a> will aggregate, such that if neither branch is read from, a backpressure signal will be sent to the <a data-link-type="dfn" href="#underlying-source" id="ref-for-underlying-source④">underlying source</a> of the original stream.</p> <p>Piping <a data-link-type="dfn" href="#lock" id="ref-for-lock①">locks</a> the readable and writable streams, preventing them from being manipulated for the duration of the pipe operation. This allows the implementation to perform important optimizations, such as directly shuttling data from the underlying source to the underlying sink while bypassing many of the intermediate queues.</p> <h3 class="heading settled" data-level="2.5" id="queuing-strategies"><span class="secno">2.5. </span><span class="content">Internal queues and queuing strategies</span><a class="self-link" href="#queuing-strategies"></a></h3> <p>Both readable and writable streams maintain <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="internal-queues">internal queues</dfn>, which they use for similar purposes. In the case of a readable stream, the internal queue contains <a data-link-type="dfn" href="#chunk" id="ref-for-chunk⑥">chunks</a> that have been enqueued by the <a data-link-type="dfn" href="#underlying-source" id="ref-for-underlying-source⑤">underlying source</a>, but not yet read by the consumer. In the case of a writable stream, the internal queue contains <a data-link-type="dfn" href="#chunk" id="ref-for-chunk⑦">chunks</a> which have been written to the stream by the producer, but not yet processed and acknowledged by the <a data-link-type="dfn" href="#underlying-sink" id="ref-for-underlying-sink③">underlying sink</a>.</p> <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="queuing-strategy">queuing strategy</dfn> is an object that determines how a stream should signal <a data-link-type="dfn" href="#backpressure" id="ref-for-backpressure②">backpressure</a> based on the state of its <a data-link-type="dfn" href="#internal-queues" id="ref-for-internal-queues①">internal queue</a>. The queuing strategy assigns a size to each <a data-link-type="dfn" href="#chunk" id="ref-for-chunk⑧">chunk</a>, and compares the total size of all chunks in the queue to a specified number, known as the <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="high-water-mark">high water mark</dfn>. The resulting difference, high water mark minus total size, is used to determine the <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="desired size to fill a stream's internal queue" data-noexport id="desired-size-to-fill-a-streams-internal-queue">desired size to fill the stream’s queue</dfn>.</p> <p>For readable streams, an underlying source can use this desired size as a backpressure signal, slowing down chunk generation so as to try to keep the desired size above or at zero. For writable streams, a producer can behave similarly, avoiding writes that would cause the desired size to go negative.</p> <p><a href="#qs-api">Concretely</a>, a queuing strategy for web developer–created streams is given by any JavaScript object with a <code class="idl"><a data-link-type="idl" href="#dom-queuingstrategy-highwatermark" id="ref-for-dom-queuingstrategy-highwatermark">highWaterMark</a></code> property. For byte streams the <code class="idl"><a data-link-type="idl" href="#dom-queuingstrategy-highwatermark" id="ref-for-dom-queuingstrategy-highwatermark①">highWaterMark</a></code> always has units of bytes. For other streams the default unit is <a data-link-type="dfn" href="#chunk" id="ref-for-chunk⑨">chunks</a>, but a <code class="idl"><a data-link-type="idl" href="#dom-queuingstrategy-size" id="ref-for-dom-queuingstrategy-size">size()</a></code> function can be included in the strategy object which returns the size for a given chunk. This permits the <code class="idl"><a data-link-type="idl" href="#dom-queuingstrategy-highwatermark" id="ref-for-dom-queuingstrategy-highwatermark②">highWaterMark</a></code> to be specified in arbitrary floating-point units.</p> <div class="example" id="example-simple-queuing-strategy"> <a class="self-link" href="#example-simple-queuing-strategy"></a> A simple example of a queuing strategy would be one that assigns a size of one to each chunk, and has a high water mark of three. This would mean that up to three chunks could be enqueued in a readable stream, or three chunks written to a writable stream, before the streams are considered to be applying backpressure. <p>In JavaScript, such a strategy could be written manually as <code class="highlight"><c- p>{</c-> highWaterMark<c- o>:</c-> <c- mf>3</c-><c- p>,</c-> size<c- p>()</c-> <c- p>{</c-> <c- k>return</c-> <c- mf>1</c-><c- p>;</c-> <c- p>}}</c-></code>, or using the built-in <code class="idl"><a data-link-type="idl" href="#countqueuingstrategy" id="ref-for-countqueuingstrategy">CountQueuingStrategy</a></code> class, as <code class="highlight"><c- ow>new</c-> CountQueuingStrategy<c- p>({</c-> highWaterMark<c- o>:</c-> <c- mf>3</c-> <c- p>})</c-></code>.</p> </div> <h3 class="heading settled" data-level="2.6" id="locking"><span class="secno">2.6. </span><span class="content">Locking</span><a class="self-link" href="#locking"></a></h3> <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="reader|readable stream reader" data-noexport id="reader">readable stream reader</dfn>, or simply reader, is an object that allows direct reading of <a data-link-type="dfn" href="#chunk" id="ref-for-chunk①⓪">chunks</a> from a <a data-link-type="dfn" href="#readable-stream" id="ref-for-readable-stream③">readable stream</a>. Without a reader, a <a data-link-type="dfn" href="#consumer" id="ref-for-consumer">consumer</a> can only perform high-level operations on the readable stream: <a data-link-type="dfn" href="#cancel-a-readable-stream" id="ref-for-cancel-a-readable-stream">canceling</a> the stream, or <a data-link-type="dfn" href="#piping" id="ref-for-piping">piping</a> the readable stream to a writable stream. A reader is acquired via the stream’s <code class="idl"><a data-link-type="idl" href="#rs-get-reader" id="ref-for-rs-get-reader②">getReader()</a></code> method.</p> <p>A <a data-link-type="dfn" href="#readable-byte-stream" id="ref-for-readable-byte-stream">readable byte stream</a> has the ability to vend two types of readers: <dfn class="dfn-paneled" data-dfn-type="dfn" data-export data-lt="default reader" id="default-reader">default readers</dfn> and <dfn class="dfn-paneled" data-dfn-type="dfn" data-export data-lt="BYOB reader" id="byob-reader">BYOB readers</dfn>. BYOB ("bring your own buffer") readers allow reading into a developer-supplied buffer, thus minimizing copies. A non-byte readable stream can only vend default readers. Default readers are instances of the <code class="idl"><a data-link-type="idl" href="#readablestreamdefaultreader" id="ref-for-readablestreamdefaultreader">ReadableStreamDefaultReader</a></code> class, while BYOB readers are instances of <code class="idl"><a data-link-type="idl" href="#readablestreambyobreader" id="ref-for-readablestreambyobreader">ReadableStreamBYOBReader</a></code>.</p> <p>Similarly, a <dfn class="dfn-paneled" data-dfn-type="dfn" data-export data-lt="writer|writable stream writer" id="writer">writable stream writer</dfn>, or simply writer, is an object that allows direct writing of <a data-link-type="dfn" href="#chunk" id="ref-for-chunk①①">chunks</a> to a <a data-link-type="dfn" href="#writable-stream" id="ref-for-writable-stream②">writable stream</a>. Without a writer, a <a data-link-type="dfn" href="#producer" id="ref-for-producer">producer</a> can only perform the high-level operations of <a data-link-type="dfn" href="#abort-a-writable-stream" id="ref-for-abort-a-writable-stream">aborting</a> the stream or <a data-link-type="dfn" href="#piping" id="ref-for-piping①">piping</a> a readable stream to the writable stream. Writers are represented by the <code class="idl"><a data-link-type="idl" href="#writablestreamdefaultwriter" id="ref-for-writablestreamdefaultwriter">WritableStreamDefaultWriter</a></code> class.</p> <p class="note" role="note">Under the covers, these high-level operations actually use a reader or writer themselves.</p> <p>A given readable or writable stream only has at most one reader or writer at a time. We say in this case the stream is <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="lock|locked to a reader|locked to a writer" data-noexport id="lock">locked</dfn>, and that the reader or writer is <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="active|active reader|active writer" data-noexport id="active">active</dfn>. This state can be determined using the <code class="idl"><a data-link-type="idl" href="#rs-locked" id="ref-for-rs-locked">readableStream.locked</a></code> or <code class="idl"><a data-link-type="idl" href="#ws-locked" id="ref-for-ws-locked">writableStream.locked</a></code> properties.</p> <p>A reader or writer also has the capability to <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="release a lock|release a read lock|release a write lock" data-noexport id="release-a-lock">release its lock</dfn>, which makes it no longer active, and allows further readers or writers to be acquired. This is done via the <code class="idl"><a data-link-type="idl" href="#default-reader-release-lock" id="ref-for-default-reader-release-lock">defaultReader.releaseLock()</a></code>, <code class="idl"><a data-link-type="idl" href="#byob-reader-release-lock" id="ref-for-byob-reader-release-lock">byobReader.releaseLock()</a></code>, or <code class="idl"><a data-link-type="idl" href="#default-writer-release-lock" id="ref-for-default-writer-release-lock">writer.releaseLock()</a></code> method, as appropriate.</p> <h2 class="heading settled" data-level="3" id="conventions"><span class="secno">3. </span><span class="content">Conventions</span><a class="self-link" href="#conventions"></a></h2> <p>This specification depends on the Infra Standard. <a data-link-type="biblio" href="#biblio-infra" title="Infra Standard">[INFRA]</a></p> <p>This specification uses the <a data-link-type="dfn" href="https://tc39.es/ecma262/#sec-algorithm-conventions-abstract-operations" id="ref-for-sec-algorithm-conventions-abstract-operations">abstract operation</a> concept from the JavaScript specification for its internal algorithms. This includes treating their return values as <a data-link-type="dfn" href="https://tc39.es/ecma262/multipage/ecmascript-data-types-and-values.html#sec-completion-record-specification-type" id="ref-for-sec-completion-record-specification-type">completion records</a>, and the use of ! and ? prefixes for unwrapping those completion records. <a data-link-type="biblio" href="#biblio-ecmascript" title="ECMAScript Language Specification">[ECMASCRIPT]</a></p> <p>This specification also uses the <a data-link-type="dfn" href="https://tc39.es/ecma262/#sec-object-internal-methods-and-internal-slots" id="ref-for-sec-object-internal-methods-and-internal-slots">internal slot</a> concept and notation from the JavaScript specification. (Although, the internal slots are on Web IDL <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-platform-object" id="ref-for-dfn-platform-object">platform objects</a> instead of on JavaScript objects.)</p> <p class="note" role="note">The reasons for the usage of these foreign JavaScript specification conventions are largely historical. We urge you to avoid following our example when writing your own web specifications. </p> <p>In this specification, all numbers are represented as double-precision 64-bit IEEE 754 floating point values (like the JavaScript <a data-link-type="dfn" href="https://tc39.es/ecma262/multipage/ecmascript-data-types-and-values.html#sec-ecmascript-language-types-number-type" id="ref-for-sec-ecmascript-language-types-number-type">Number type</a> or Web IDL <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#idl-unrestricted-double" id="ref-for-idl-unrestricted-double">unrestricted double</a></code> type), and all arithmetic operations performed on them must be done in the standard way for such values. This is particularly important for the data structure described in <a href="#queue-with-sizes">§ 8.1 Queue-with-sizes</a>. <a data-link-type="biblio" href="#biblio-ieee-754" title="IEEE Standard for Floating-Point Arithmetic">[IEEE-754]</a></p> <h2 class="heading settled" data-level="4" id="rs"><span class="secno">4. </span><span class="content">Readable streams</span><a class="self-link" href="#rs"></a></h2> <h3 class="heading settled" data-level="4.1" id="rs-intro"><span class="secno">4.1. </span><span class="content">Using readable streams</span><a class="self-link" href="#rs-intro"></a></h3> <div class="example" id="example-basic-pipe-to"> <a class="self-link" href="#example-basic-pipe-to"></a> The simplest way to consume a readable stream is to simply <a data-link-type="dfn" href="#piping" id="ref-for-piping②">pipe</a> it to a <a data-link-type="dfn" href="#writable-stream" id="ref-for-writable-stream③">writable stream</a>. This ensures that <a data-link-type="dfn" href="#backpressure" id="ref-for-backpressure③">backpressure</a> is respected, and any errors (either writing or reading) are propagated through the chain: <pre class="highlight">readableStream<c- p>.</c->pipeTo<c- p>(</c->writableStream<c- p>)</c-> <c- p>.</c->then<c- p>(()</c-> <c- p>=></c-> console<c- p>.</c->log<c- p>(</c-><c- u>"All data successfully written!"</c-><c- p>))</c-> <c- p>.</c-><c- k>catch</c-><c- p>(</c->e <c- p>=></c-> console<c- p>.</c->error<c- p>(</c-><c- u>"Something went wrong!"</c-><c- p>,</c-> e<c- p>));</c-> </pre> </div> <div class="example" id="example-pipe-as-chunks-receiver"> <a class="self-link" href="#example-pipe-as-chunks-receiver"></a> If you simply want to be alerted of each new chunk from a readable stream, you can <a data-link-type="dfn" href="#piping" id="ref-for-piping③">pipe</a> it to a new <a data-link-type="dfn" href="#writable-stream" id="ref-for-writable-stream④">writable stream</a> that you custom-create for that purpose: <pre class="highlight">readableStream<c- p>.</c->pipeTo<c- p>(</c-><c- ow>new</c-> WritableStream<c- p>({</c-> write<c- p>(</c->chunk<c- p>)</c-> <c- p>{</c-> console<c- p>.</c->log<c- p>(</c-><c- u>"Chunk received"</c-><c- p>,</c-> chunk<c- p>);</c-> <c- p>},</c-> close<c- p>()</c-> <c- p>{</c-> console<c- p>.</c->log<c- p>(</c-><c- u>"All data successfully read!"</c-><c- p>);</c-> <c- p>},</c-> abort<c- p>(</c->e<c- p>)</c-> <c- p>{</c-> console<c- p>.</c->error<c- p>(</c-><c- u>"Something went wrong!"</c-><c- p>,</c-> e<c- p>);</c-> <c- p>}</c-> <c- p>}));</c-> </pre> <p>By returning promises from your <code class="idl"><a data-link-type="idl" href="#dom-underlyingsink-write" id="ref-for-dom-underlyingsink-write">write()</a></code> implementation, you can signal <a data-link-type="dfn" href="#backpressure" id="ref-for-backpressure④">backpressure</a> to the readable stream.</p> </div> <div class="example" id="example-manual-read"> <a class="self-link" href="#example-manual-read"></a> Although readable streams will usually be used by piping them to a writable stream, you can also read them directly by acquiring a <a data-link-type="dfn" href="#reader" id="ref-for-reader②">reader</a> and using its <code>read()</code> method to get successive chunks. For example, this code logs the next <a data-link-type="dfn" href="#chunk" id="ref-for-chunk①②">chunk</a> in the stream, if available: <pre class="highlight"><c- a>const</c-> reader <c- o>=</c-> readableStream<c- p>.</c->getReader<c- p>();</c-> reader<c- p>.</c->read<c- p>().</c->then<c- p>(</c-> <c- p>({</c-> value<c- p>,</c-> done <c- p>})</c-> <c- p>=></c-> <c- p>{</c-> <c- k>if</c-> <c- p>(</c->done<c- p>)</c-> <c- p>{</c-> console<c- p>.</c->log<c- p>(</c-><c- u>"The stream was already closed!"</c-><c- p>);</c-> <c- p>}</c-> <c- k>else</c-> <c- p>{</c-> console<c- p>.</c->log<c- p>(</c->value<c- p>);</c-> <c- p>}</c-> <c- p>},</c-> e <c- p>=></c-> console<c- p>.</c->error<c- p>(</c-><c- u>"The stream became errored and cannot be read from!"</c-><c- p>,</c-> e<c- p>)</c-> <c- p>);</c-> </pre> <p>This more manual method of reading a stream is mainly useful for library authors building new high-level operations on streams, beyond the provided ones of <a data-link-type="dfn" href="#piping" id="ref-for-piping④">piping</a> and <a data-link-type="dfn" href="#tee-a-readable-stream" id="ref-for-tee-a-readable-stream①">teeing</a>.</p> </div> <div class="example" id="example-manual-read-bytes"> <a class="self-link" href="#example-manual-read-bytes"></a> The above example showed using the readable stream’s <a data-link-type="dfn" href="#default-reader" id="ref-for-default-reader">default reader</a>. If the stream is a <a data-link-type="dfn" href="#readable-byte-stream" id="ref-for-readable-byte-stream①">readable byte stream</a>, you can also acquire a <a data-link-type="dfn" href="#byob-reader" id="ref-for-byob-reader①">BYOB reader</a> for it, which allows more precise control over buffer allocation in order to avoid copies. For example, this code reads the first 1024 bytes from the stream into a single memory buffer: <pre class="highlight"><c- a>const</c-> reader <c- o>=</c-> readableStream<c- p>.</c->getReader<c- p>({</c-> mode<c- o>:</c-> <c- u>"byob"</c-> <c- p>});</c-> <c- a>let</c-> startingAB <c- o>=</c-> <c- ow>new</c-> ArrayBuffer<c- p>(</c-><c- mf>1024</c-><c- p>);</c-> <c- a>const</c-> buffer <c- o>=</c-> <c- k>await</c-> readInto<c- p>(</c->startingAB<c- p>);</c-> console<c- p>.</c->log<c- p>(</c-><c- u>"The first 1024 bytes: "</c-><c- p>,</c-> buffer<c- p>);</c-> <c- k>async</c-> <c- a>function</c-> readInto<c- p>(</c->buffer<c- p>)</c-> <c- p>{</c-> <c- a>let</c-> offset <c- o>=</c-> <c- mf>0</c-><c- p>;</c-> <c- k>while</c-> <c- p>(</c->offset <c- o><</c-> buffer<c- p>.</c->byteLength<c- p>)</c-> <c- p>{</c-> <c- a>const</c-> <c- p>{</c-> value<c- o>:</c-> view<c- p>,</c-> done <c- p>}</c-> <c- o>=</c-> <c- k>await</c-> reader<c- p>.</c->read<c- p>(</c-><c- ow>new</c-> Uint8Array<c- p>(</c->buffer<c- p>,</c-> offset<c- p>,</c-> buffer<c- p>.</c->byteLength <c- o>-</c-> offset<c- p>));</c-> buffer <c- o>=</c-> view<c- p>.</c->buffer<c- p>;</c-> <c- k>if</c-> <c- p>(</c->done<c- p>)</c-> <c- p>{</c-> <c- k>break</c-><c- p>;</c-> <c- p>}</c-> offset <c- o>+=</c-> view<c- p>.</c->byteLength<c- p>;</c-> <c- p>}</c-> <c- k>return</c-> buffer<c- p>;</c-> <c- p>}</c-> </pre> <p>An important thing to note here is that the final <code>buffer</code> value is different from the <code>startingAB</code>, but it (and all intermediate buffers) shares the same backing memory allocation. At each step, the buffer is <a href="#transfer-array-buffer" id="ref-for-transfer-array-buffer">transferred</a> to a new <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-arraybuffer-objects" id="ref-for-sec-arraybuffer-objects">ArrayBuffer</a></code> object. The <code>view</code> is destructured from the return value of reading a new <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-typedarray-objects" id="ref-for-sec-typedarray-objects①">Uint8Array</a></code>, with that <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-arraybuffer-objects" id="ref-for-sec-arraybuffer-objects①">ArrayBuffer</a></code> object as its <code>buffer</code> property, the offset that bytes were written to as its <code>byteOffset</code> property, and the number of bytes that were written as its <code>byteLength</code> property.</p> <p>Note that this example is mostly educational. For practical purposes, the <code class="idl"><a data-link-type="idl" href="#dom-readablestreambyobreaderreadoptions-min" id="ref-for-dom-readablestreambyobreaderreadoptions-min">min</a></code> option of <code class="idl"><a data-link-type="idl" href="#byob-reader-read" id="ref-for-byob-reader-read">read()</a></code> provides an easier and more direct way to read an exact number of bytes:</p> <pre class="highlight"><c- a>const</c-> reader <c- o>=</c-> readableStream<c- p>.</c->getReader<c- p>({</c-> mode<c- o>:</c-> <c- u>"byob"</c-> <c- p>});</c-> <c- a>const</c-> <c- p>{</c-> value<c- o>:</c-> view<c- p>,</c-> done <c- p>}</c-> <c- o>=</c-> <c- k>await</c-> reader<c- p>.</c->read<c- p>(</c-><c- ow>new</c-> Uint8Array<c- p>(</c-><c- mf>1024</c-><c- p>),</c-> <c- p>{</c-> min<c- o>:</c-> <c- mf>1024</c-> <c- p>});</c-> console<c- p>.</c->log<c- p>(</c-><c- u>"The first 1024 bytes: "</c-><c- p>,</c-> view<c- p>);</c-> </pre> </div> <h3 class="heading settled" data-level="4.2" id="rs-class"><span class="secno">4.2. </span><span class="content">The <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream②">ReadableStream</a></code> class</span><a class="self-link" href="#rs-class"></a></h3> <p>The <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream③">ReadableStream</a></code> class is a concrete instance of the general <a data-link-type="dfn" href="#readable-stream" id="ref-for-readable-stream④">readable stream</a> concept. It is adaptable to any <a data-link-type="dfn" href="#chunk" id="ref-for-chunk①③">chunk</a> type, and maintains an internal queue to keep track of data supplied by the <a data-link-type="dfn" href="#underlying-source" id="ref-for-underlying-source⑥">underlying source</a> but not yet read by any consumer.</p> <h4 class="heading settled" data-level="4.2.1" id="rs-class-definition"><span class="secno">4.2.1. </span><span class="content">Interface definition</span><a class="self-link" href="#rs-class-definition"></a></h4> <p>The Web IDL definition for the <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream④">ReadableStream</a></code> class is given as follows:</p> <pre class="idl highlight def">[Exposed=*, <a class="idl-code" data-link-type="extended-attribute" href="https://html.spec.whatwg.org/multipage/structured-data.html#transferable" id="ref-for-transferable"><c- g>Transferable</c-></a>] <c- b>interface</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="interface" data-export id="readablestream"><code><c- g>ReadableStream</c-></code></dfn> { <a class="idl-code" data-link-type="constructor" href="#rs-constructor" id="ref-for-rs-constructor①"><c- g>constructor</c-></a>(<c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-object" id="ref-for-idl-object"><c- b>object</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableStream/ReadableStream(underlyingSource, strategy), ReadableStream/constructor(underlyingSource, strategy), ReadableStream/ReadableStream(underlyingSource), ReadableStream/constructor(underlyingSource), ReadableStream/ReadableStream(), ReadableStream/constructor()" data-dfn-type="argument" data-export id="dom-readablestream-readablestream-underlyingsource-strategy-underlyingsource"><code><c- g>underlyingSource</c-></code></dfn>, <c- b>optional</c-> <a data-link-type="idl-name" href="#dictdef-queuingstrategy" id="ref-for-dictdef-queuingstrategy"><c- n>QueuingStrategy</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableStream/ReadableStream(underlyingSource, strategy), ReadableStream/constructor(underlyingSource, strategy), ReadableStream/ReadableStream(underlyingSource), ReadableStream/constructor(underlyingSource), ReadableStream/ReadableStream(), ReadableStream/constructor()" data-dfn-type="argument" data-export id="dom-readablestream-readablestream-underlyingsource-strategy-strategy"><code><c- g>strategy</c-></code></dfn> = {}); <c- b>static</c-> <a data-link-type="idl-name" href="#readablestream" id="ref-for-readablestream⑤"><c- n>ReadableStream</c-></a> <a class="idl-code" data-link-type="method" href="#rs-from" id="ref-for-rs-from"><c- g>from</c-></a>(<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any" id="ref-for-idl-any"><c- b>any</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableStream/from(asyncIterable)" data-dfn-type="argument" data-export id="dom-readablestream-from-asynciterable-asynciterable"><code><c- g>asyncIterable</c-></code></dfn>); <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-boolean" id="ref-for-idl-boolean"><c- b>boolean</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="boolean" href="#rs-locked" id="ref-for-rs-locked①"><c- g>locked</c-></a>; <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise" id="ref-for-idl-promise"><c- b>Promise</c-></a><<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined" id="ref-for-idl-undefined"><c- b>undefined</c-></a>> <a class="idl-code" data-link-type="method" href="#rs-cancel" id="ref-for-rs-cancel①"><c- g>cancel</c-></a>(<c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any" id="ref-for-idl-any①"><c- b>any</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableStream/cancel(reason), ReadableStream/cancel()" data-dfn-type="argument" data-export id="dom-readablestream-cancel-reason-reason"><code><c- g>reason</c-></code></dfn>); <a data-link-type="idl-name" href="#typedefdef-readablestreamreader" id="ref-for-typedefdef-readablestreamreader"><c- n>ReadableStreamReader</c-></a> <a class="idl-code" data-link-type="method" href="#rs-get-reader" id="ref-for-rs-get-reader③"><c- g>getReader</c-></a>(<c- b>optional</c-> <a data-link-type="idl-name" href="#dictdef-readablestreamgetreaderoptions" id="ref-for-dictdef-readablestreamgetreaderoptions"><c- n>ReadableStreamGetReaderOptions</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableStream/getReader(options), ReadableStream/getReader()" data-dfn-type="argument" data-export id="dom-readablestream-getreader-options-options"><code><c- g>options</c-></code></dfn> = {}); <a data-link-type="idl-name" href="#readablestream" id="ref-for-readablestream⑥"><c- n>ReadableStream</c-></a> <a class="idl-code" data-link-type="method" href="#rs-pipe-through" id="ref-for-rs-pipe-through①"><c- g>pipeThrough</c-></a>(<a data-link-type="idl-name" href="#dictdef-readablewritablepair" id="ref-for-dictdef-readablewritablepair"><c- n>ReadableWritablePair</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableStream/pipeThrough(transform, options), ReadableStream/pipeThrough(transform)" data-dfn-type="argument" data-export id="dom-readablestream-pipethrough-transform-options-transform"><code><c- g>transform</c-></code></dfn>, <c- b>optional</c-> <a data-link-type="idl-name" href="#dictdef-streampipeoptions" id="ref-for-dictdef-streampipeoptions"><c- n>StreamPipeOptions</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableStream/pipeThrough(transform, options), ReadableStream/pipeThrough(transform)" data-dfn-type="argument" data-export id="dom-readablestream-pipethrough-transform-options-options"><code><c- g>options</c-></code></dfn> = {}); <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise" id="ref-for-idl-promise①"><c- b>Promise</c-></a><<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined" id="ref-for-idl-undefined①"><c- b>undefined</c-></a>> <a class="idl-code" data-link-type="method" href="#rs-pipe-to" id="ref-for-rs-pipe-to②"><c- g>pipeTo</c-></a>(<a data-link-type="idl-name" href="#writablestream" id="ref-for-writablestream①"><c- n>WritableStream</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableStream/pipeTo(destination, options), ReadableStream/pipeTo(destination)" data-dfn-type="argument" data-export id="dom-readablestream-pipeto-destination-options-destination"><code><c- g>destination</c-></code></dfn>, <c- b>optional</c-> <a data-link-type="idl-name" href="#dictdef-streampipeoptions" id="ref-for-dictdef-streampipeoptions①"><c- n>StreamPipeOptions</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableStream/pipeTo(destination, options), ReadableStream/pipeTo(destination)" data-dfn-type="argument" data-export id="dom-readablestream-pipeto-destination-options-options"><code><c- g>options</c-></code></dfn> = {}); <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#idl-sequence" id="ref-for-idl-sequence"><c- b>sequence</c-></a><<a data-link-type="idl-name" href="#readablestream" id="ref-for-readablestream⑦"><c- n>ReadableStream</c-></a>> <a class="idl-code" data-link-type="method" href="#rs-tee" id="ref-for-rs-tee①"><c- g>tee</c-></a>(); <c- b>async</c-> <c- b>iterable</c-><<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any" id="ref-for-idl-any②"><c- b>any</c-></a>>(<c- b>optional</c-> <a data-link-type="idl-name" href="#dictdef-readablestreamiteratoroptions" id="ref-for-dictdef-readablestreamiteratoroptions"><c- n>ReadableStreamIteratorOptions</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableStream" data-dfn-type="argument" data-export id="dom-readablestream-options"><code><c- g>options</c-></code></dfn> = {}); }; <c- b>typedef</c-> (<a data-link-type="idl-name" href="#readablestreamdefaultreader" id="ref-for-readablestreamdefaultreader①"><c- n>ReadableStreamDefaultReader</c-></a> <c- b>or</c-> <a data-link-type="idl-name" href="#readablestreambyobreader" id="ref-for-readablestreambyobreader①"><c- n>ReadableStreamBYOBReader</c-></a>) <dfn class="dfn-paneled idl-code" data-dfn-type="typedef" data-export id="typedefdef-readablestreamreader"><code><c- g>ReadableStreamReader</c-></code></dfn>; <c- b>enum</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="enum" data-export id="enumdef-readablestreamreadermode"><code><c- g>ReadableStreamReaderMode</c-></code></dfn> { <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableStreamReaderMode" data-dfn-type="enum-value" data-export id="dom-readablestreamreadermode-byob"><code><c- s>"byob"</c-></code></dfn> }; <c- b>dictionary</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="dictionary" data-export id="dictdef-readablestreamgetreaderoptions"><code><c- g>ReadableStreamGetReaderOptions</c-></code></dfn> { <a data-link-type="idl-name" href="#enumdef-readablestreamreadermode" id="ref-for-enumdef-readablestreamreadermode"><c- n>ReadableStreamReaderMode</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableStreamGetReaderOptions" data-dfn-type="dict-member" data-export data-type="ReadableStreamReaderMode" id="dom-readablestreamgetreaderoptions-mode"><code><c- g>mode</c-></code></dfn>; }; <c- b>dictionary</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="dictionary" data-export id="dictdef-readablestreamiteratoroptions"><code><c- g>ReadableStreamIteratorOptions</c-></code></dfn> { <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-boolean" id="ref-for-idl-boolean①"><c- b>boolean</c-></a> <dfn class="dfn-paneled idl-code" data-default="false" data-dfn-for="ReadableStreamIteratorOptions" data-dfn-type="dict-member" data-export data-type="boolean" id="dom-readablestreamiteratoroptions-preventcancel"><code><c- g>preventCancel</c-></code></dfn> = <c- b>false</c->; }; <c- b>dictionary</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="dictionary" data-export id="dictdef-readablewritablepair"><code><c- g>ReadableWritablePair</c-></code></dfn> { <c- b>required</c-> <a data-link-type="idl-name" href="#readablestream" id="ref-for-readablestream⑧"><c- n>ReadableStream</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableWritablePair" data-dfn-type="dict-member" data-export data-type="ReadableStream" id="dom-readablewritablepair-readable"><code><c- g>readable</c-></code></dfn>; <c- b>required</c-> <a data-link-type="idl-name" href="#writablestream" id="ref-for-writablestream②"><c- n>WritableStream</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableWritablePair" data-dfn-type="dict-member" data-export data-type="WritableStream" id="dom-readablewritablepair-writable"><code><c- g>writable</c-></code></dfn>; }; <c- b>dictionary</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="dictionary" data-export id="dictdef-streampipeoptions"><code><c- g>StreamPipeOptions</c-></code></dfn> { <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-boolean" id="ref-for-idl-boolean②"><c- b>boolean</c-></a> <dfn class="dfn-paneled idl-code" data-default="false" data-dfn-for="StreamPipeOptions" data-dfn-type="dict-member" data-export data-type="boolean" id="dom-streampipeoptions-preventclose"><code><c- g>preventClose</c-></code></dfn> = <c- b>false</c->; <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-boolean" id="ref-for-idl-boolean③"><c- b>boolean</c-></a> <dfn class="dfn-paneled idl-code" data-default="false" data-dfn-for="StreamPipeOptions" data-dfn-type="dict-member" data-export data-type="boolean" id="dom-streampipeoptions-preventabort"><code><c- g>preventAbort</c-></code></dfn> = <c- b>false</c->; <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-boolean" id="ref-for-idl-boolean④"><c- b>boolean</c-></a> <dfn class="dfn-paneled idl-code" data-default="false" data-dfn-for="StreamPipeOptions" data-dfn-type="dict-member" data-export data-type="boolean" id="dom-streampipeoptions-preventcancel"><code><c- g>preventCancel</c-></code></dfn> = <c- b>false</c->; <a data-link-type="idl-name" href="https://dom.spec.whatwg.org/#abortsignal" id="ref-for-abortsignal"><c- n>AbortSignal</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="StreamPipeOptions" data-dfn-type="dict-member" data-export data-type="AbortSignal" id="dom-streampipeoptions-signal"><code><c- g>signal</c-></code></dfn>; }; </pre> <h4 class="heading settled" data-level="4.2.2" id="rs-internal-slots"><span class="secno">4.2.2. </span><span class="content">Internal slots</span><a class="self-link" href="#rs-internal-slots"></a></h4> <p>Instances of <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream⑨">ReadableStream</a></code> are created with the internal slots described in the following table:</p> <table> <thead> <tr> <th>Internal Slot <th>Description (<em>non-normative</em>) <tbody> <tr> <td><dfn class="dfn-paneled" data-dfn-for="ReadableStream" data-dfn-type="dfn" data-noexport id="readablestream-controller">[[controller]]</dfn> <td class="non-normative">A <code class="idl"><a data-link-type="idl" href="#readablestreamdefaultcontroller" id="ref-for-readablestreamdefaultcontroller">ReadableStreamDefaultController</a></code> or <code class="idl"><a data-link-type="idl" href="#readablebytestreamcontroller" id="ref-for-readablebytestreamcontroller">ReadableByteStreamController</a></code> created with the ability to control the state and queue of this stream <tr> <td><dfn class="dfn-paneled" data-dfn-for="ReadableStream" data-dfn-type="dfn" data-export id="readablestream-detached">[[Detached]]</dfn> <td class="non-normative">A boolean flag set to true when the stream is transferred <tr> <td><dfn class="dfn-paneled" data-dfn-for="ReadableStream" data-dfn-type="dfn" data-noexport id="readablestream-disturbed">[[disturbed]]</dfn> <td class="non-normative">A boolean flag set to true when the stream has been read from or canceled <tr> <td><dfn class="dfn-paneled" data-dfn-for="ReadableStream" data-dfn-type="dfn" data-noexport id="readablestream-reader">[[reader]]</dfn> <td class="non-normative">A <code class="idl"><a data-link-type="idl" href="#readablestreamdefaultreader" id="ref-for-readablestreamdefaultreader②">ReadableStreamDefaultReader</a></code> or <code class="idl"><a data-link-type="idl" href="#readablestreambyobreader" id="ref-for-readablestreambyobreader②">ReadableStreamBYOBReader</a></code> instance, if the stream is <a data-link-type="dfn" href="#lock" id="ref-for-lock②">locked to a reader</a>, or undefined if it is not <tr> <td><dfn class="dfn-paneled" data-dfn-for="ReadableStream" data-dfn-type="dfn" data-noexport id="readablestream-state">[[state]]</dfn> <td class="non-normative">A string containing the stream’s current state, used internally; one of "<code>readable</code>", "<code>closed</code>", or "<code>errored</code>" <tr> <td><dfn class="dfn-paneled" data-dfn-for="ReadableStream" data-dfn-type="dfn" data-noexport id="readablestream-storederror">[[storedError]]</dfn> <td class="non-normative">A value indicating how the stream failed, to be given as a failure reason or exception when trying to operate on an errored stream </table> <h4 class="heading settled" data-level="4.2.3" id="underlying-source-api"><span class="secno">4.2.3. </span><span class="content">The underlying source API</span><a class="self-link" href="#underlying-source-api"></a></h4> <p>The <code class="idl"><a data-link-type="idl" href="#rs-constructor" id="ref-for-rs-constructor②">ReadableStream()</a></code> constructor accepts as its first argument a JavaScript object representing the <a data-link-type="dfn" href="#underlying-source" id="ref-for-underlying-source⑦">underlying source</a>. Such objects can contain any of the following properties:</p> <pre class="idl highlight def"><c- b>dictionary</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="dictionary" data-export id="dictdef-underlyingsource"><code><c- g>UnderlyingSource</c-></code></dfn> { <a data-link-type="idl-name" href="#callbackdef-underlyingsourcestartcallback" id="ref-for-callbackdef-underlyingsourcestartcallback"><c- n>UnderlyingSourceStartCallback</c-></a> <a class="idl-code" data-link-type="dict-member" data-type="UnderlyingSourceStartCallback" href="#dom-underlyingsource-start" id="ref-for-dom-underlyingsource-start"><c- g>start</c-></a>; <a data-link-type="idl-name" href="#callbackdef-underlyingsourcepullcallback" id="ref-for-callbackdef-underlyingsourcepullcallback"><c- n>UnderlyingSourcePullCallback</c-></a> <a class="idl-code" data-link-type="dict-member" data-type="UnderlyingSourcePullCallback" href="#dom-underlyingsource-pull" id="ref-for-dom-underlyingsource-pull"><c- g>pull</c-></a>; <a data-link-type="idl-name" href="#callbackdef-underlyingsourcecancelcallback" id="ref-for-callbackdef-underlyingsourcecancelcallback"><c- n>UnderlyingSourceCancelCallback</c-></a> <a class="idl-code" data-link-type="dict-member" data-type="UnderlyingSourceCancelCallback" href="#dom-underlyingsource-cancel" id="ref-for-dom-underlyingsource-cancel"><c- g>cancel</c-></a>; <a data-link-type="idl-name" href="#enumdef-readablestreamtype" id="ref-for-enumdef-readablestreamtype"><c- n>ReadableStreamType</c-></a> <a class="idl-code" data-link-type="dict-member" data-type="ReadableStreamType" href="#dom-underlyingsource-type" id="ref-for-dom-underlyingsource-type"><c- g>type</c-></a>; [<a class="idl-code" data-link-type="extended-attribute" href="https://webidl.spec.whatwg.org/#EnforceRange" id="ref-for-EnforceRange"><c- g>EnforceRange</c-></a>] <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-unsigned-long-long" id="ref-for-idl-unsigned-long-long"><c- b>unsigned</c-> <c- b>long</c-> <c- b>long</c-></a> <a class="idl-code" data-link-type="dict-member" data-type="unsigned long long" href="#dom-underlyingsource-autoallocatechunksize" id="ref-for-dom-underlyingsource-autoallocatechunksize"><c- g>autoAllocateChunkSize</c-></a>; }; <c- b>typedef</c-> (<a data-link-type="idl-name" href="#readablestreamdefaultcontroller" id="ref-for-readablestreamdefaultcontroller①"><c- n>ReadableStreamDefaultController</c-></a> <c- b>or</c-> <a data-link-type="idl-name" href="#readablebytestreamcontroller" id="ref-for-readablebytestreamcontroller①"><c- n>ReadableByteStreamController</c-></a>) <dfn class="dfn-paneled idl-code" data-dfn-type="typedef" data-export id="typedefdef-readablestreamcontroller"><code><c- g>ReadableStreamController</c-></code></dfn>; <c- b>callback</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="callback" data-export id="callbackdef-underlyingsourcestartcallback"><code><c- g>UnderlyingSourceStartCallback</c-></code></dfn> = <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any" id="ref-for-idl-any③"><c- b>any</c-></a> (<a data-link-type="idl-name" href="#typedefdef-readablestreamcontroller" id="ref-for-typedefdef-readablestreamcontroller"><c- n>ReadableStreamController</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="UnderlyingSourceStartCallback" data-dfn-type="argument" data-export id="dom-underlyingsourcestartcallback-controller"><code><c- g>controller</c-></code></dfn>); <c- b>callback</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="callback" data-export id="callbackdef-underlyingsourcepullcallback"><code><c- g>UnderlyingSourcePullCallback</c-></code></dfn> = <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise" id="ref-for-idl-promise②"><c- b>Promise</c-></a><<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined" id="ref-for-idl-undefined②"><c- b>undefined</c-></a>> (<a data-link-type="idl-name" href="#typedefdef-readablestreamcontroller" id="ref-for-typedefdef-readablestreamcontroller①"><c- n>ReadableStreamController</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="UnderlyingSourcePullCallback" data-dfn-type="argument" data-export id="dom-underlyingsourcepullcallback-controller"><code><c- g>controller</c-></code></dfn>); <c- b>callback</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="callback" data-export id="callbackdef-underlyingsourcecancelcallback"><code><c- g>UnderlyingSourceCancelCallback</c-></code></dfn> = <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise" id="ref-for-idl-promise③"><c- b>Promise</c-></a><<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined" id="ref-for-idl-undefined③"><c- b>undefined</c-></a>> (<c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any" id="ref-for-idl-any④"><c- b>any</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="UnderlyingSourceCancelCallback" data-dfn-type="argument" data-export id="dom-underlyingsourcecancelcallback-reason"><code><c- g>reason</c-></code></dfn>); <c- b>enum</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="enum" data-export id="enumdef-readablestreamtype"><code><c- g>ReadableStreamType</c-></code></dfn> { <a class="idl-code" data-link-type="enum-value" href="#dom-readablestreamtype-bytes" id="ref-for-dom-readablestreamtype-bytes"><c- s>"bytes"</c-></a> }; </pre> <dl> <dt><dfn class="dfn-paneled idl-code" data-dfn-for="UnderlyingSource" data-dfn-type="dict-member" data-export data-lt="start" id="dom-underlyingsource-start"><code>start(<var>controller</var>)</code></dfn>, <span> of type <a data-link-type="idl-name" href="#callbackdef-underlyingsourcestartcallback" id="ref-for-callbackdef-underlyingsourcestartcallback①">UnderlyingSourceStartCallback</a></span> <dd> <p>A function that is called immediately during creation of the <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream①⓪">ReadableStream</a></code>. </p> <p>Typically this is used to adapt a <a data-link-type="dfn" href="#push-source" id="ref-for-push-source">push source</a> by setting up relevant event listeners, as in the example of <a href="#example-rs-push-no-backpressure">§ 10.1 A readable stream with an underlying push source (no backpressure support)</a>, or to acquire access to a <a data-link-type="dfn" href="#pull-source" id="ref-for-pull-source">pull source</a>, as in <a href="#example-rs-pull">§ 10.4 A readable stream with an underlying pull source</a>. </p> <p>If this setup process is asynchronous, it can return a promise to signal success or failure; a rejected promise will error the stream. Any thrown exceptions will be re-thrown by the <code class="idl"><a data-link-type="idl" href="#rs-constructor" id="ref-for-rs-constructor③">ReadableStream()</a></code> constructor. </p> <dt><dfn class="dfn-paneled idl-code" data-dfn-for="UnderlyingSource" data-dfn-type="dict-member" data-export data-lt="pull" id="dom-underlyingsource-pull"><code>pull(<var>controller</var>)</code></dfn>, <span> of type <a data-link-type="idl-name" href="#callbackdef-underlyingsourcepullcallback" id="ref-for-callbackdef-underlyingsourcepullcallback①">UnderlyingSourcePullCallback</a></span> <dd> <p>A function that is called whenever the stream’s <a data-link-type="dfn" href="#internal-queues" id="ref-for-internal-queues②">internal queue</a> of chunks becomes not full, i.e. whenever the queue’s <a data-link-type="dfn" href="#desired-size-to-fill-a-streams-internal-queue" id="ref-for-desired-size-to-fill-a-streams-internal-queue">desired size</a> becomes positive. Generally, it will be called repeatedly until the queue reaches its <a data-link-type="dfn" href="#high-water-mark" id="ref-for-high-water-mark">high water mark</a> (i.e. until the <a data-link-type="dfn" href="#desired-size-to-fill-a-streams-internal-queue" id="ref-for-desired-size-to-fill-a-streams-internal-queue①">desired size</a> becomes non-positive). </p> <p>For <a data-link-type="dfn" href="#push-source" id="ref-for-push-source①">push sources</a>, this can be used to resume a paused flow, as in <a href="#example-rs-push-backpressure">§ 10.2 A readable stream with an underlying push source and backpressure support</a>. For <a data-link-type="dfn" href="#pull-source" id="ref-for-pull-source①">pull sources</a>, it is used to acquire new <a data-link-type="dfn" href="#chunk" id="ref-for-chunk①④">chunks</a> to enqueue into the stream, as in <a href="#example-rs-pull">§ 10.4 A readable stream with an underlying pull source</a>. </p> <p>This function will not be called until <code class="idl"><a data-link-type="idl" href="#dom-underlyingsource-start" id="ref-for-dom-underlyingsource-start①">start()</a></code> successfully completes. Additionally, it will only be called repeatedly if it enqueues at least one chunk or fulfills a BYOB request; a no-op <code class="idl"><a data-link-type="idl" href="#dom-underlyingsource-pull" id="ref-for-dom-underlyingsource-pull①">pull()</a></code> implementation will not be continually called. </p> <p>If the function returns a promise, then it will not be called again until that promise fulfills. (If the promise rejects, the stream will become errored.) This is mainly used in the case of pull sources, where the promise returned represents the process of acquiring a new chunk. Throwing an exception is treated the same as returning a rejected promise. </p> <dt><dfn class="dfn-paneled idl-code" data-dfn-for="UnderlyingSource" data-dfn-type="dict-member" data-export data-lt="cancel" id="dom-underlyingsource-cancel"><code>cancel(<var>reason</var>)</code></dfn>, <span> of type <a data-link-type="idl-name" href="#callbackdef-underlyingsourcecancelcallback" id="ref-for-callbackdef-underlyingsourcecancelcallback①">UnderlyingSourceCancelCallback</a></span> <dd> <p>A function that is called whenever the <a data-link-type="dfn" href="#consumer" id="ref-for-consumer①">consumer</a> <a data-link-type="dfn" href="#cancel-a-readable-stream" id="ref-for-cancel-a-readable-stream①">cancels</a> the stream, via <code class="idl"><a data-link-type="idl" href="#rs-cancel" id="ref-for-rs-cancel②">stream.cancel()</a></code> or <code class="idl"><a data-link-type="idl" href="#generic-reader-cancel" id="ref-for-generic-reader-cancel">reader.cancel()</a></code>. It takes as its argument the same value as was passed to those methods by the consumer. </p> <p>Readable streams can additionally be canceled under certain conditions during <a data-link-type="dfn" href="#piping" id="ref-for-piping⑤">piping</a>; see the definition of the <code class="idl"><a data-link-type="idl" href="#rs-pipe-to" id="ref-for-rs-pipe-to③">pipeTo()</a></code> method for more details. </p> <p>For all streams, this is generally used to release access to the underlying resource; see for example <a href="#example-rs-push-no-backpressure">§ 10.1 A readable stream with an underlying push source (no backpressure support)</a>. </p> <p>If the shutdown process is asynchronous, it can return a promise to signal success or failure; the result will be communicated via the return value of the <code>cancel()</code> method that was called. Throwing an exception is treated the same as returning a rejected promise. </p> <div class="note" role="note"> <p>Even if the cancelation process fails, the stream will still close; it will not be put into an errored state. This is because a failure in the cancelation process doesn’t matter to the consumer’s view of the stream, once they’ve expressed disinterest in it by canceling. The failure is only communicated to the immediate caller of the corresponding method. </p> <p>This is different from the behavior of the <code class="idl"><a data-link-type="idl" href="#dom-underlyingsink-close" id="ref-for-dom-underlyingsink-close">close</a></code> and <code class="idl"><a data-link-type="idl" href="#dom-underlyingsink-abort" id="ref-for-dom-underlyingsink-abort">abort</a></code> options of a <code class="idl"><a data-link-type="idl" href="#writablestream" id="ref-for-writablestream③">WritableStream</a></code>'s <a data-link-type="dfn" href="#underlying-sink" id="ref-for-underlying-sink④">underlying sink</a>, which upon failure put the corresponding <code class="idl"><a data-link-type="idl" href="#writablestream" id="ref-for-writablestream④">WritableStream</a></code> into an errored state. Those correspond to specific actions the <a data-link-type="dfn" href="#producer" id="ref-for-producer①">producer</a> is requesting and, if those actions fail, they indicate something more persistently wrong. </p> </div> <dt><dfn class="dfn-paneled idl-code" data-dfn-for="UnderlyingSource" data-dfn-type="dict-member" data-export id="dom-underlyingsource-type"><code>type</code></dfn> (byte streams only), <span> of type <a data-link-type="idl-name" href="#enumdef-readablestreamtype" id="ref-for-enumdef-readablestreamtype①">ReadableStreamType</a></span> <dd> <p>Can be set to "<dfn class="dfn-paneled idl-code" data-dfn-for="ReadableStreamType" data-dfn-type="enum-value" data-export data-lt=""bytes"|bytes" id="dom-readablestreamtype-bytes"><code>bytes</code></dfn>" to signal that the constructed <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream①①">ReadableStream</a></code> is a <a data-link-type="dfn" href="#readable-byte-stream" id="ref-for-readable-byte-stream②">readable byte stream</a>. This ensures that the resulting <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream①②">ReadableStream</a></code> will successfully be able to vend <a data-link-type="dfn" href="#byob-reader" id="ref-for-byob-reader②">BYOB readers</a> via its <code class="idl"><a data-link-type="idl" href="#rs-get-reader" id="ref-for-rs-get-reader④">getReader()</a></code> method. It also affects the <var>controller</var> argument passed to the <code class="idl"><a data-link-type="idl" href="#dom-underlyingsource-start" id="ref-for-dom-underlyingsource-start②">start()</a></code> and <code class="idl"><a data-link-type="idl" href="#dom-underlyingsource-pull" id="ref-for-dom-underlyingsource-pull②">pull()</a></code> methods; see below. </p> <p>For an example of how to set up a readable byte stream, including using the different controller interface, see <a href="#example-rbs-push">§ 10.3 A readable byte stream with an underlying push source (no backpressure support)</a>. </p> <p>Setting any value other than "<code class="idl"><a data-link-type="idl" href="#dom-readablestreamtype-bytes" id="ref-for-dom-readablestreamtype-bytes①">bytes</a></code>" or undefined will cause the <code class="idl"><a data-link-type="idl" href="#rs-constructor" id="ref-for-rs-constructor④">ReadableStream()</a></code> constructor to throw an exception. </p> <dt><dfn class="dfn-paneled idl-code" data-dfn-for="UnderlyingSource" data-dfn-type="dict-member" data-export id="dom-underlyingsource-autoallocatechunksize"><code>autoAllocateChunkSize</code></dfn> (byte streams only), <span> of type <a data-link-type="idl-name" href="https://webidl.spec.whatwg.org/#idl-unsigned-long-long" id="ref-for-idl-unsigned-long-long①">unsigned long long</a></span> <dd> <p>Can be set to a positive integer to cause the implementation to automatically allocate buffers for the underlying source code to write into. In this case, when a <a data-link-type="dfn" href="#consumer" id="ref-for-consumer②">consumer</a> is using a <a data-link-type="dfn" href="#default-reader" id="ref-for-default-reader①">default reader</a>, the stream implementation will automatically allocate an <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-arraybuffer-objects" id="ref-for-sec-arraybuffer-objects②">ArrayBuffer</a></code> of the given size, so that <code class="idl"><a data-link-type="idl" href="#rbs-controller-byob-request" id="ref-for-rbs-controller-byob-request">controller.byobRequest</a></code> is always present, as if the consumer was using a <a data-link-type="dfn" href="#byob-reader" id="ref-for-byob-reader③">BYOB reader</a>. </p> <p>This is generally used to cut down on the amount of code needed to handle consumers that use default readers, as can be seen by comparing <a href="#example-rbs-push">§ 10.3 A readable byte stream with an underlying push source (no backpressure support)</a> without auto-allocation to <a href="#example-rbs-pull">§ 10.5 A readable byte stream with an underlying pull source</a> with auto-allocation. </p> </dl> <p>The type of the <var>controller</var> argument passed to the <code class="idl"><a data-link-type="idl" href="#dom-underlyingsource-start" id="ref-for-dom-underlyingsource-start③">start()</a></code> and <code class="idl"><a data-link-type="idl" href="#dom-underlyingsource-pull" id="ref-for-dom-underlyingsource-pull③">pull()</a></code> methods depends on the value of the <code class="idl"><a data-link-type="idl" href="#dom-underlyingsource-type" id="ref-for-dom-underlyingsource-type①">type</a></code> option. If <code class="idl"><a data-link-type="idl" href="#dom-underlyingsource-type" id="ref-for-dom-underlyingsource-type②">type</a></code> is set to undefined (including via omission), then <var>controller</var> will be a <code class="idl"><a data-link-type="idl" href="#readablestreamdefaultcontroller" id="ref-for-readablestreamdefaultcontroller②">ReadableStreamDefaultController</a></code>. If it’s set to "<code class="idl"><a data-link-type="idl" href="#dom-readablestreamtype-bytes" id="ref-for-dom-readablestreamtype-bytes②">bytes</a></code>", then <var>controller</var> will be a <code class="idl"><a data-link-type="idl" href="#readablebytestreamcontroller" id="ref-for-readablebytestreamcontroller②">ReadableByteStreamController</a></code>.</p> <h4 class="heading settled" data-level="4.2.4" id="rs-prototype"><span class="secno">4.2.4. </span><span class="content">Constructor, methods, and properties</span><a class="self-link" href="#rs-prototype"></a></h4> <dl class="domintro non-normative"> <dt><code><var>stream</var> = new <code class="idl"><a data-link-type="idl" href="#rs-constructor" id="ref-for-rs-constructor⑤">ReadableStream</a></code>(<var>underlyingSource</var>[, <var>strategy</var>])</code> <dd> <p>Creates a new <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream①③">ReadableStream</a></code> wrapping the provided <a data-link-type="dfn" href="#underlying-source" id="ref-for-underlying-source⑧">underlying source</a>. See <a href="#underlying-source-api">§ 4.2.3 The underlying source API</a> for more details on the <var>underlyingSource</var> argument. </p> <p>The <var>strategy</var> argument represents the stream’s <a data-link-type="dfn" href="#queuing-strategy" id="ref-for-queuing-strategy">queuing strategy</a>, as described in <a href="#qs-api">§ 7.1 The queuing strategy API</a>. If it is not provided, the default behavior will be the same as a <code class="idl"><a data-link-type="idl" href="#countqueuingstrategy" id="ref-for-countqueuingstrategy①">CountQueuingStrategy</a></code> with a <a data-link-type="dfn" href="#high-water-mark" id="ref-for-high-water-mark①">high water mark</a> of 1. </p> <dt><code><var>stream</var> = <code class="idl"><a data-link-type="idl" href="#rs-from" id="ref-for-rs-from①">ReadableStream.from</a></code>(<var>asyncIterable</var>)</code> <dd> <p>Creates a new <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream①④">ReadableStream</a></code> wrapping the provided <a data-link-type="dfn" href="https://tc39.es/ecma262/#sec-iterable-interface" id="ref-for-sec-iterable-interface">iterable</a> or <a data-link-type="dfn" href="https://tc39.es/ecma262/#sec-asynciterable-interface" id="ref-for-sec-asynciterable-interface">async iterable</a>. </p> <p>This can be used to adapt various kinds of objects into a <a data-link-type="dfn" href="#readable-stream" id="ref-for-readable-stream⑤">readable stream</a>, such as an <a data-link-type="dfn" href="https://tc39.es/ecma262/#sec-array-objects" id="ref-for-sec-array-objects">array</a>, an <a data-link-type="dfn" href="https://tc39.es/ecma262/#sec-asyncgenerator-objects" id="ref-for-sec-asyncgenerator-objects">async generator</a>, or a <a href="https://nodejs.org/api/stream.html#class-streamreadable">Node.js readable stream</a>. </p> <dt><code><var>isLocked</var> = <var>stream</var>.<code class="idl"><a data-link-type="idl" href="#rs-locked" id="ref-for-rs-locked②">locked</a></code></code> <dd> <p>Returns whether or not the readable stream is <a data-link-type="dfn" href="#lock" id="ref-for-lock③">locked to a reader</a>. </p> <dt><code>await <var>stream</var>.<code class="idl"><a data-link-type="idl" href="#rs-cancel" id="ref-for-rs-cancel③">cancel</a></code>([ <var>reason</var> ])</code> <dd> <p><a data-link-type="dfn" href="#cancel-a-readable-stream" id="ref-for-cancel-a-readable-stream②">Cancels</a> the stream, signaling a loss of interest in the stream by a consumer. The supplied <var>reason</var> argument will be given to the underlying source’s <code class="idl"><a data-link-type="idl" href="#dom-underlyingsource-cancel" id="ref-for-dom-underlyingsource-cancel①">cancel()</a></code> method, which might or might not use it. </p> <p>The returned promise will fulfill if the stream shuts down successfully, or reject if the underlying source signaled that there was an error doing so. Additionally, it will reject with a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror">TypeError</a></code> (without attempting to cancel the stream) if the stream is currently <a data-link-type="dfn" href="#lock" id="ref-for-lock④">locked</a>. </p> <dt><code><var>reader</var> = <var>stream</var>.<code class="idl"><a data-link-type="idl" href="#rs-get-reader" id="ref-for-rs-get-reader⑤">getReader</a></code>()</code> <dd> <p>Creates a <code class="idl"><a data-link-type="idl" href="#readablestreamdefaultreader" id="ref-for-readablestreamdefaultreader③">ReadableStreamDefaultReader</a></code> and <a data-link-type="dfn" href="#lock" id="ref-for-lock⑤">locks</a> the stream to the new reader. While the stream is locked, no other reader can be acquired until this one is <a data-link-type="dfn" href="#release-a-lock" id="ref-for-release-a-lock">released</a>. </p> <p>This functionality is especially useful for creating abstractions that desire the ability to consume a stream in its entirety. By getting a reader for the stream, you can ensure nobody else can interleave reads with yours or cancel the stream, which would interfere with your abstraction. </p> <dt><code><var>reader</var> = <var>stream</var>.<code class="idl"><a data-link-type="idl" href="#rs-get-reader" id="ref-for-rs-get-reader⑥">getReader</a></code>({ <code class="idl"><a data-link-type="idl" href="#dom-readablestreamgetreaderoptions-mode" id="ref-for-dom-readablestreamgetreaderoptions-mode">mode</a></code>: "<code class="idl"><a data-link-type="idl" href="#dom-readablestreamreadermode-byob" id="ref-for-dom-readablestreamreadermode-byob">byob</a></code>" })</code> <dd> <p>Creates a <code class="idl"><a data-link-type="idl" href="#readablestreambyobreader" id="ref-for-readablestreambyobreader③">ReadableStreamBYOBReader</a></code> and <a data-link-type="dfn" href="#lock" id="ref-for-lock⑥">locks</a> the stream to the new reader. </p> <p>This call behaves the same way as the no-argument variant, except that it only works on <a data-link-type="dfn" href="#readable-byte-stream" id="ref-for-readable-byte-stream③">readable byte streams</a>, i.e. streams which were constructed specifically with the ability to handle "bring your own buffer" reading. The returned <a data-link-type="dfn" href="#byob-reader" id="ref-for-byob-reader④">BYOB reader</a> provides the ability to directly read individual <a data-link-type="dfn" href="#chunk" id="ref-for-chunk①⑤">chunks</a> from the stream via its <code class="idl"><a data-link-type="idl" href="#byob-reader-read" id="ref-for-byob-reader-read①">read()</a></code> method, into developer-supplied buffers, allowing more precise control over allocation. </p> <dt><code><var>readable</var> = <var>stream</var>.<code class="idl"><a data-link-type="idl" href="#rs-pipe-through" id="ref-for-rs-pipe-through②">pipeThrough</a></code>({ <code class="idl"><a data-link-type="idl" href="#dom-readablewritablepair-writable" id="ref-for-dom-readablewritablepair-writable">writable</a></code>, <code class="idl"><a data-link-type="idl" href="#dom-readablewritablepair-readable" id="ref-for-dom-readablewritablepair-readable">readable</a></code> }[, { <code class="idl"><a data-link-type="idl" href="#dom-streampipeoptions-preventclose" id="ref-for-dom-streampipeoptions-preventclose">preventClose</a></code>, <code class="idl"><a data-link-type="idl" href="#dom-streampipeoptions-preventabort" id="ref-for-dom-streampipeoptions-preventabort">preventAbort</a></code>, <code class="idl"><a data-link-type="idl" href="#dom-streampipeoptions-preventcancel" id="ref-for-dom-streampipeoptions-preventcancel">preventCancel</a></code>, <code class="idl"><a data-link-type="idl" href="#dom-streampipeoptions-signal" id="ref-for-dom-streampipeoptions-signal">signal</a></code> }])</code> <dd> <p>Provides a convenient, chainable way of <a data-link-type="dfn" href="#piping" id="ref-for-piping⑥">piping</a> this <a data-link-type="dfn" href="#readable-stream" id="ref-for-readable-stream⑥">readable stream</a> through a <a data-link-type="dfn" href="#transform-stream" id="ref-for-transform-stream①">transform stream</a> (or any other <code>{ writable, readable }</code> pair). It simply pipes the stream into the writable side of the supplied pair, and returns the readable side for further use. </p> <p>Piping a stream will <a data-link-type="dfn" href="#lock" id="ref-for-lock⑦">lock</a> it for the duration of the pipe, preventing any other consumer from acquiring a reader. </p> <dt><code>await <var>stream</var>.<code class="idl"><a data-link-type="idl" href="#rs-pipe-to" id="ref-for-rs-pipe-to④">pipeTo</a></code>(<var>destination</var>[, { <code class="idl"><a data-link-type="idl" href="#dom-streampipeoptions-preventclose" id="ref-for-dom-streampipeoptions-preventclose①">preventClose</a></code>, <code class="idl"><a data-link-type="idl" href="#dom-streampipeoptions-preventabort" id="ref-for-dom-streampipeoptions-preventabort①">preventAbort</a></code>, <code class="idl"><a data-link-type="idl" href="#dom-streampipeoptions-preventcancel" id="ref-for-dom-streampipeoptions-preventcancel①">preventCancel</a></code>, <code class="idl"><a data-link-type="idl" href="#dom-streampipeoptions-signal" id="ref-for-dom-streampipeoptions-signal①">signal</a></code> }])</code> <dd> <p><a data-link-type="dfn" href="#piping" id="ref-for-piping⑦">Pipes</a> this <a data-link-type="dfn" href="#readable-stream" id="ref-for-readable-stream⑦">readable stream</a> to a given <a data-link-type="dfn" href="#writable-stream" id="ref-for-writable-stream⑤">writable stream</a> <var>destination</var>. The way in which the piping process behaves under various error conditions can be customized with a number of passed options. It returns a promise that fulfills when the piping process completes successfully, or rejects if any errors were encountered. </p> <p>Piping a stream will <a data-link-type="dfn" href="#lock" id="ref-for-lock⑧">lock</a> it for the duration of the pipe, preventing any other consumer from acquiring a reader.</p> <p>Errors and closures of the source and destination streams propagate as follows:</p> <ul> <li data-md> <p>An error in this source <a data-link-type="dfn" href="#readable-stream" id="ref-for-readable-stream⑧">readable stream</a> will <a data-link-type="dfn" href="#abort-a-writable-stream" id="ref-for-abort-a-writable-stream①">abort</a> <var>destination</var>, unless <code class="idl"><a data-link-type="idl" href="#dom-streampipeoptions-preventabort" id="ref-for-dom-streampipeoptions-preventabort②">preventAbort</a></code> is truthy. The returned promise will be rejected with the source’s error, or with any error that occurs during aborting the destination.</p> <li data-md> <p>An error in <var>destination</var> will <a data-link-type="dfn" href="#cancel-a-readable-stream" id="ref-for-cancel-a-readable-stream③">cancel</a> this source <a data-link-type="dfn" href="#readable-stream" id="ref-for-readable-stream⑨">readable stream</a>, unless <code class="idl"><a data-link-type="idl" href="#dom-streampipeoptions-preventcancel" id="ref-for-dom-streampipeoptions-preventcancel②">preventCancel</a></code> is truthy. The returned promise will be rejected with the destination’s error, or with any error that occurs during canceling the source.</p> <li data-md> <p>When this source <a data-link-type="dfn" href="#readable-stream" id="ref-for-readable-stream①⓪">readable stream</a> closes, <var>destination</var> will be closed, unless <code class="idl"><a data-link-type="idl" href="#dom-streampipeoptions-preventclose" id="ref-for-dom-streampipeoptions-preventclose②">preventClose</a></code> is truthy. The returned promise will be fulfilled once this process completes, unless an error is encountered while closing the destination, in which case it will be rejected with that error.</p> <li data-md> <p>If <var>destination</var> starts out closed or closing, this source <a data-link-type="dfn" href="#readable-stream" id="ref-for-readable-stream①①">readable stream</a> will be <a data-link-type="dfn" href="#cancel-a-readable-stream" id="ref-for-cancel-a-readable-stream④">canceled</a>, unless <code class="idl"><a data-link-type="idl" href="#dom-streampipeoptions-preventcancel" id="ref-for-dom-streampipeoptions-preventcancel③">preventCancel</a></code> is true. The returned promise will be rejected with an error indicating piping to a closed stream failed, or with any error that occurs during canceling the source.</p> </ul> <p>The <code class="idl"><a data-link-type="idl" href="#dom-streampipeoptions-signal" id="ref-for-dom-streampipeoptions-signal②">signal</a></code> option can be set to an <code class="idl"><a data-link-type="idl" href="https://dom.spec.whatwg.org/#abortsignal" id="ref-for-abortsignal①">AbortSignal</a></code> to allow aborting an ongoing pipe operation via the corresponding <code class="idl"><a data-link-type="idl" href="https://dom.spec.whatwg.org/#abortcontroller" id="ref-for-abortcontroller">AbortController</a></code>. In this case, this source <a data-link-type="dfn" href="#readable-stream" id="ref-for-readable-stream①②">readable stream</a> will be <a data-link-type="dfn" href="#cancel-a-readable-stream" id="ref-for-cancel-a-readable-stream⑤">canceled</a>, and <var>destination</var> <a data-link-type="dfn" href="#abort-a-writable-stream" id="ref-for-abort-a-writable-stream②">aborted</a>, unless the respective options <code class="idl"><a data-link-type="idl" href="#dom-streampipeoptions-preventcancel" id="ref-for-dom-streampipeoptions-preventcancel④">preventCancel</a></code> or <code class="idl"><a data-link-type="idl" href="#dom-streampipeoptions-preventabort" id="ref-for-dom-streampipeoptions-preventabort③">preventAbort</a></code> are set. </p> <dt><code>[<var>branch1</var>, <var>branch2</var>] = <var>stream</var>.<code class="idl"><a data-link-type="idl" href="#rs-tee" id="ref-for-rs-tee②">tee</a></code>()</code> <dd> <p><a data-link-type="dfn" href="#tee-a-readable-stream" id="ref-for-tee-a-readable-stream②">Tees</a> this readable stream, returning a two-element array containing the two resulting branches as new <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream①⑤">ReadableStream</a></code> instances. </p> <p>Teeing a stream will <a data-link-type="dfn" href="#lock" id="ref-for-lock⑨">lock</a> it, preventing any other consumer from acquiring a reader. To <a data-link-type="dfn" href="#cancel-a-readable-stream" id="ref-for-cancel-a-readable-stream⑥">cancel</a> the stream, cancel both of the resulting branches; a composite cancellation reason will then be propagated to the stream’s <a data-link-type="dfn" href="#underlying-source" id="ref-for-underlying-source⑨">underlying source</a>. </p> <p>If this stream is a <a data-link-type="dfn" href="#readable-byte-stream" id="ref-for-readable-byte-stream④">readable byte stream</a>, then each branch will receive its own copy of each <a data-link-type="dfn" href="#chunk" id="ref-for-chunk①⑥">chunk</a>. If not, then the chunks seen in each branch will be the same object. If the chunks are not immutable, this could allow interference between the two branches. </p> </dl> <div class="algorithm" data-algorithm="ReadableStream(underlyingSource, strategy)" data-algorithm-for="ReadableStream"> The <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableStream" data-dfn-type="constructor" data-export data-lt="ReadableStream(underlyingSource, strategy)|constructor(underlyingSource, strategy)|ReadableStream(underlyingSource)|constructor(underlyingSource)|ReadableStream()|constructor()" id="rs-constructor"><code>new ReadableStream(<var>underlyingSource</var>, <var>strategy</var>)</code></dfn> constructor steps are: <ol> <li data-md> <p>If <var>underlyingSource</var> is missing, set it to null.</p> <li data-md> <p>Let <var>underlyingSourceDict</var> be <var>underlyingSource</var>, <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-convert-ecmascript-to-idl-value" id="ref-for-dfn-convert-ecmascript-to-idl-value">converted to an IDL value</a> of type <code class="idl"><a data-link-type="idl" href="#dictdef-underlyingsource" id="ref-for-dictdef-underlyingsource">UnderlyingSource</a></code>.</p> <p class="note" role="note">We cannot declare the <var>underlyingSource</var> argument as having the <code class="idl"><a data-link-type="idl" href="#dictdef-underlyingsource" id="ref-for-dictdef-underlyingsource①">UnderlyingSource</a></code> type directly, because doing so would lose the reference to the original object. We need to retain the object so we can <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#invoke-a-callback-function" id="ref-for-invoke-a-callback-function">invoke</a> the various methods on it. </p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#initialize-readable-stream" id="ref-for-initialize-readable-stream">InitializeReadableStream</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this">this</a>).</p> <li data-md> <p>If <var>underlyingSourceDict</var>["<code class="idl"><a data-link-type="idl" href="#dom-underlyingsource-type" id="ref-for-dom-underlyingsource-type③">type</a></code>"] is "<code class="idl"><a data-link-type="idl" href="#dom-readablestreamtype-bytes" id="ref-for-dom-readablestreamtype-bytes③">bytes</a></code>":</p> <ol> <li data-md> <p>If <var>strategy</var>["<code class="idl"><a data-link-type="idl" href="#dom-queuingstrategy-size" id="ref-for-dom-queuingstrategy-size①">size</a></code>"] <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#map-exists" id="ref-for-map-exists">exists</a>, throw a <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#exceptiondef-rangeerror" id="ref-for-exceptiondef-rangeerror">RangeError</a></code> exception.</p> <li data-md> <p>Let <var>highWaterMark</var> be ? <a data-link-type="abstract-op" href="#validate-and-normalize-high-water-mark" id="ref-for-validate-and-normalize-high-water-mark">ExtractHighWaterMark</a>(<var>strategy</var>, 0).</p> <li data-md> <p>Perform ? <a data-link-type="abstract-op" href="#set-up-readable-byte-stream-controller-from-underlying-source" id="ref-for-set-up-readable-byte-stream-controller-from-underlying-source">SetUpReadableByteStreamControllerFromUnderlyingSource</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this①">this</a>, <var>underlyingSource</var>, <var>underlyingSourceDict</var>, <var>highWaterMark</var>).</p> </ol> <li data-md> <p>Otherwise,</p> <ol> <li data-md> <p class="assertion">Assert: <var>underlyingSourceDict</var>["<code class="idl"><a data-link-type="idl" href="#dom-underlyingsource-type" id="ref-for-dom-underlyingsource-type④">type</a></code>"] does not <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#map-exists" id="ref-for-map-exists①">exist</a>.</p> <li data-md> <p>Let <var>sizeAlgorithm</var> be ! <a data-link-type="abstract-op" href="#make-size-algorithm-from-size-function" id="ref-for-make-size-algorithm-from-size-function">ExtractSizeAlgorithm</a>(<var>strategy</var>).</p> <li data-md> <p>Let <var>highWaterMark</var> be ? <a data-link-type="abstract-op" href="#validate-and-normalize-high-water-mark" id="ref-for-validate-and-normalize-high-water-mark①">ExtractHighWaterMark</a>(<var>strategy</var>, 1).</p> <li data-md> <p>Perform ? <a data-link-type="abstract-op" href="#set-up-readable-stream-default-controller-from-underlying-source" id="ref-for-set-up-readable-stream-default-controller-from-underlying-source">SetUpReadableStreamDefaultControllerFromUnderlyingSource</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this②">this</a>, <var>underlyingSource</var>, <var>underlyingSourceDict</var>, <var>highWaterMark</var>, <var>sizeAlgorithm</var>).</p> </ol> </ol> </div> <div class="algorithm" data-algorithm="from(asyncIterable)" data-algorithm-for="ReadableStream"> The static <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableStream" data-dfn-type="method" data-export id="rs-from"><code>from(<var>asyncIterable</var>)</code></dfn> method steps are: <ol> <li data-md> <p>Return ? <a data-link-type="abstract-op" href="#readable-stream-from-iterable" id="ref-for-readable-stream-from-iterable">ReadableStreamFromIterable</a>(<var>asyncIterable</var>).</p> </ol> </div> <div class="algorithm" data-algorithm="locked" data-algorithm-for="ReadableStream"> The <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableStream" data-dfn-type="attribute" data-export id="rs-locked"><code>locked</code></dfn> getter steps are: <ol> <li data-md> <p>Return ! <a data-link-type="abstract-op" href="#is-readable-stream-locked" id="ref-for-is-readable-stream-locked">IsReadableStreamLocked</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this③">this</a>).</p> </ol> </div> <div class="algorithm" data-algorithm="cancel(reason)" data-algorithm-for="ReadableStream"> The <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableStream" data-dfn-type="method" data-export data-lt="cancel(reason)|cancel()" id="rs-cancel"><code>cancel(<var>reason</var>)</code></dfn> method steps are: <ol> <li data-md> <p>If ! <a data-link-type="abstract-op" href="#is-readable-stream-locked" id="ref-for-is-readable-stream-locked①">IsReadableStreamLocked</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this④">this</a>) is true, return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-rejected-with" id="ref-for-a-promise-rejected-with">a promise rejected with</a> a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror①">TypeError</a></code> exception.</p> <li data-md> <p>Return ! <a data-link-type="abstract-op" href="#readable-stream-cancel" id="ref-for-readable-stream-cancel">ReadableStreamCancel</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑤">this</a>, <var>reason</var>).</p> </ol> </div> <div class="algorithm" data-algorithm="getReader(options)" data-algorithm-for="ReadableStream"> The <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableStream" data-dfn-type="method" data-export data-lt="getReader(options)|getReader()" id="rs-get-reader"><code>getReader(<var>options</var>)</code></dfn> method steps are: <ol> <li data-md> <p>If <var>options</var>["<code class="idl"><a data-link-type="idl" href="#dom-readablestreamgetreaderoptions-mode" id="ref-for-dom-readablestreamgetreaderoptions-mode①">mode</a></code>"] does not <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#map-exists" id="ref-for-map-exists②">exist</a>, return ? <a data-link-type="abstract-op" href="#acquire-readable-stream-reader" id="ref-for-acquire-readable-stream-reader">AcquireReadableStreamDefaultReader</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑥">this</a>).</p> <li data-md> <p class="assertion">Assert: <var>options</var>["<code class="idl"><a data-link-type="idl" href="#dom-readablestreamgetreaderoptions-mode" id="ref-for-dom-readablestreamgetreaderoptions-mode②">mode</a></code>"] is "<code class="idl"><a data-link-type="idl" href="#dom-readablestreamreadermode-byob" id="ref-for-dom-readablestreamreadermode-byob①">byob</a></code>".</p> <li data-md> <p>Return ? <a data-link-type="abstract-op" href="#acquire-readable-stream-byob-reader" id="ref-for-acquire-readable-stream-byob-reader">AcquireReadableStreamBYOBReader</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑦">this</a>).</p> </ol> <div class="example" id="example-read-all-chunks"> <a class="self-link" href="#example-read-all-chunks"></a> An example of an abstraction that might benefit from using a reader is a function like the following, which is designed to read an entire readable stream into memory as an array of <a data-link-type="dfn" href="#chunk" id="ref-for-chunk①⑦">chunks</a>. <pre class="highlight"><c- a>function</c-> readAllChunks<c- p>(</c->readableStream<c- p>)</c-> <c- p>{</c-> <c- a>const</c-> reader <c- o>=</c-> readableStream<c- p>.</c->getReader<c- p>();</c-> <c- a>const</c-> chunks <c- o>=</c-> <c- p>[];</c-> <c- k>return</c-> pump<c- p>();</c-> <c- a>function</c-> pump<c- p>()</c-> <c- p>{</c-> <c- k>return</c-> reader<c- p>.</c->read<c- p>().</c->then<c- p>(({</c-> value<c- p>,</c-> done <c- p>})</c-> <c- p>=></c-> <c- p>{</c-> <c- k>if</c-> <c- p>(</c->done<c- p>)</c-> <c- p>{</c-> <c- k>return</c-> chunks<c- p>;</c-> <c- p>}</c-> chunks<c- p>.</c->push<c- p>(</c->value<c- p>);</c-> <c- k>return</c-> pump<c- p>();</c-> <c- p>});</c-> <c- p>}</c-> <c- p>}</c-> </pre> <p>Note how the first thing it does is obtain a reader, and from then on it uses the reader exclusively. This ensures that no other consumer can interfere with the stream, either by reading chunks or by <a data-link-type="dfn" href="#cancel-a-readable-stream" id="ref-for-cancel-a-readable-stream⑦">canceling</a> the stream.</p> </div> </div> <div class="algorithm" data-algorithm="pipeThrough(transform, options)" data-algorithm-for="ReadableStream"> The <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableStream" data-dfn-type="method" data-export data-lt="pipeThrough(transform, options)|pipeThrough(transform)" id="rs-pipe-through"><code>pipeThrough(<var>transform</var>, <var>options</var>)</code></dfn> method steps are: <ol> <li data-md> <p>If ! <a data-link-type="abstract-op" href="#is-readable-stream-locked" id="ref-for-is-readable-stream-locked②">IsReadableStreamLocked</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑧">this</a>) is true, throw a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror②">TypeError</a></code> exception.</p> <li data-md> <p>If ! <a data-link-type="abstract-op" href="#is-writable-stream-locked" id="ref-for-is-writable-stream-locked">IsWritableStreamLocked</a>(<var>transform</var>["<code class="idl"><a data-link-type="idl" href="#dom-readablewritablepair-writable" id="ref-for-dom-readablewritablepair-writable①">writable</a></code>"]) is true, throw a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror③">TypeError</a></code> exception.</p> <li data-md> <p>Let <var>signal</var> be <var>options</var>["<code class="idl"><a data-link-type="idl" href="#dom-streampipeoptions-signal" id="ref-for-dom-streampipeoptions-signal③">signal</a></code>"] if it <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#map-exists" id="ref-for-map-exists③">exists</a>, or undefined otherwise.</p> <li data-md> <p>Let <var>promise</var> be ! <a data-link-type="abstract-op" href="#readable-stream-pipe-to" id="ref-for-readable-stream-pipe-to">ReadableStreamPipeTo</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑨">this</a>, <var>transform</var>["<code class="idl"><a data-link-type="idl" href="#dom-readablewritablepair-writable" id="ref-for-dom-readablewritablepair-writable②">writable</a></code>"], <var>options</var>["<code class="idl"><a data-link-type="idl" href="#dom-streampipeoptions-preventclose" id="ref-for-dom-streampipeoptions-preventclose③">preventClose</a></code>"], <var>options</var>["<code class="idl"><a data-link-type="idl" href="#dom-streampipeoptions-preventabort" id="ref-for-dom-streampipeoptions-preventabort④">preventAbort</a></code>"], <var>options</var>["<code class="idl"><a data-link-type="idl" href="#dom-streampipeoptions-preventcancel" id="ref-for-dom-streampipeoptions-preventcancel⑤">preventCancel</a></code>"], <var>signal</var>).</p> <li data-md> <p>Set <var>promise</var>.[[PromiseIsHandled]] to true.</p> <li data-md> <p>Return <var>transform</var>["<code class="idl"><a data-link-type="idl" href="#dom-readablewritablepair-readable" id="ref-for-dom-readablewritablepair-readable①">readable</a></code>"].</p> </ol> <div class="example" id="example-pipe-chain"> <a class="self-link" href="#example-pipe-chain"></a> A typical example of constructing <a data-link-type="dfn" href="#pipe-chain" id="ref-for-pipe-chain②">pipe chain</a> using <code class="idl"><a data-link-type="idl" href="#rs-pipe-through" id="ref-for-rs-pipe-through③">pipeThrough(transform, options)</a></code> would look like <pre class="highlight">httpResponseBody <c- p>.</c->pipeThrough<c- p>(</c->decompressorTransform<c- p>)</c-> <c- p>.</c->pipeThrough<c- p>(</c->ignoreNonImageFilesTransform<c- p>)</c-> <c- p>.</c->pipeTo<c- p>(</c->mediaGallery<c- p>);</c-> </pre> </div> </div> <div class="algorithm" data-algorithm="pipeTo(destination, options)" data-algorithm-for="ReadableStream"> The <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableStream" data-dfn-type="method" data-export data-lt="pipeTo(destination, options)|pipeTo(destination)" id="rs-pipe-to"><code>pipeTo(<var>destination</var>, <var>options</var>)</code></dfn> method steps are: <ol> <li data-md> <p>If ! <a data-link-type="abstract-op" href="#is-readable-stream-locked" id="ref-for-is-readable-stream-locked③">IsReadableStreamLocked</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this①⓪">this</a>) is true, return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-rejected-with" id="ref-for-a-promise-rejected-with①">a promise rejected with</a> a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror④">TypeError</a></code> exception.</p> <li data-md> <p>If ! <a data-link-type="abstract-op" href="#is-writable-stream-locked" id="ref-for-is-writable-stream-locked①">IsWritableStreamLocked</a>(<var>destination</var>) is true, return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-rejected-with" id="ref-for-a-promise-rejected-with②">a promise rejected with</a> a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror⑤">TypeError</a></code> exception.</p> <li data-md> <p>Let <var>signal</var> be <var>options</var>["<code class="idl"><a data-link-type="idl" href="#dom-streampipeoptions-signal" id="ref-for-dom-streampipeoptions-signal④">signal</a></code>"] if it <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#map-exists" id="ref-for-map-exists④">exists</a>, or undefined otherwise.</p> <li data-md> <p>Return ! <a data-link-type="abstract-op" href="#readable-stream-pipe-to" id="ref-for-readable-stream-pipe-to①">ReadableStreamPipeTo</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this①①">this</a>, <var>destination</var>, <var>options</var>["<code class="idl"><a data-link-type="idl" href="#dom-streampipeoptions-preventclose" id="ref-for-dom-streampipeoptions-preventclose④">preventClose</a></code>"], <var>options</var>["<code class="idl"><a data-link-type="idl" href="#dom-streampipeoptions-preventabort" id="ref-for-dom-streampipeoptions-preventabort⑤">preventAbort</a></code>"], <var>options</var>["<code class="idl"><a data-link-type="idl" href="#dom-streampipeoptions-preventcancel" id="ref-for-dom-streampipeoptions-preventcancel⑥">preventCancel</a></code>"], <var>signal</var>).</p> </ol> <div class="example" id="example-pipe-abortsignal"> <a class="self-link" href="#example-pipe-abortsignal"></a> An ongoing <a data-link-type="dfn" href="#readablestream-pipe" id="ref-for-readablestream-pipe">pipe</a> operation can be stopped using an <code class="idl"><a data-link-type="idl" href="https://dom.spec.whatwg.org/#abortsignal" id="ref-for-abortsignal②">AbortSignal</a></code>, as follows: <pre class="highlight"><c- a>const</c-> controller <c- o>=</c-> <c- ow>new</c-> AbortController<c- p>();</c-> readable<c- p>.</c->pipeTo<c- p>(</c->writable<c- p>,</c-> <c- p>{</c-> signal<c- o>:</c-> controller<c- p>.</c->signal <c- p>});</c-> <c- c1>// ... some time later ...</c-> controller<c- p>.</c->abort<c- p>();</c-> </pre> <p>(The above omits error handling for the promise returned by <code class="idl"><a data-link-type="idl" href="#rs-pipe-to" id="ref-for-rs-pipe-to⑤">pipeTo()</a></code>. Additionally, the impact of the <code class="idl"><a data-link-type="idl" href="#dom-streampipeoptions-preventabort" id="ref-for-dom-streampipeoptions-preventabort⑥">preventAbort</a></code> and <code class="idl"><a data-link-type="idl" href="#dom-streampipeoptions-preventcancel" id="ref-for-dom-streampipeoptions-preventcancel⑦">preventCancel</a></code> options what happens when piping is stopped are worth considering.)</p> </div> <div class="example" id="example-pipe-switch-dest"> <a class="self-link" href="#example-pipe-switch-dest"></a> The above technique can be used to switch the <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream①⑥">ReadableStream</a></code> being piped, while writing into the same <code class="idl"><a data-link-type="idl" href="#writablestream" id="ref-for-writablestream⑤">WritableStream</a></code>: <pre class="highlight"><c- a>const</c-> controller <c- o>=</c-> <c- ow>new</c-> AbortController<c- p>();</c-> <c- a>const</c-> pipePromise <c- o>=</c-> readable1<c- p>.</c->pipeTo<c- p>(</c->writable<c- p>,</c-> <c- p>{</c-> preventAbort<c- o>:</c-> <c- kc>true</c-><c- p>,</c-> signal<c- o>:</c-> controller<c- p>.</c->signal <c- p>});</c-> <c- c1>// ... some time later ...</c-> controller<c- p>.</c->abort<c- p>();</c-> <c- c1>// Wait for the pipe to complete before starting a new one:</c-> <c- k>try</c-> <c- p>{</c-> <c- k>await</c-> pipePromise<c- p>;</c-> <c- p>}</c-> <c- k>catch</c-> <c- p>(</c->e<c- p>)</c-> <c- p>{</c-> <c- c1>// Swallow "AbortError" DOMExceptions as expected, but rethrow any unexpected failures.</c-> <c- k>if</c-> <c- p>(</c->e<c- p>.</c->name <c- o>!==</c-> <c- u>"AbortError"</c-><c- p>)</c-> <c- p>{</c-> <c- k>throw</c-> e<c- p>;</c-> <c- p>}</c-> <c- p>}</c-> <c- c1>// Start the new pipe!</c-> readable2<c- p>.</c->pipeTo<c- p>(</c->writable<c- p>);</c-> </pre> </div> </div> <div class="algorithm" data-algorithm="tee()" data-algorithm-for="ReadableStream"> The <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableStream" data-dfn-type="method" data-export id="rs-tee"><code>tee()</code></dfn> method steps are: <ol> <li data-md> <p>Return ? <a data-link-type="abstract-op" href="#readable-stream-tee" id="ref-for-readable-stream-tee">ReadableStreamTee</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this①②">this</a>, false).</p> </ol> <div class="example" id="example-tee-and-pipe"> <a class="self-link" href="#example-tee-and-pipe"></a> Teeing a stream is most useful when you wish to let two independent consumers read from the stream in parallel, perhaps even at different speeds. For example, given a writable stream <code>cacheEntry</code> representing an on-disk file, and another writable stream <code>httpRequestBody</code> representing an upload to a remote server, you could pipe the same readable stream to both destinations at once: <pre class="highlight"><c- a>const</c-> <c- p>[</c->forLocal<c- p>,</c-> forRemote<c- p>]</c-> <c- o>=</c-> readableStream<c- p>.</c->tee<c- p>();</c-> Promise<c- p>.</c->all<c- p>([</c-> forLocal<c- p>.</c->pipeTo<c- p>(</c->cacheEntry<c- p>),</c-> forRemote<c- p>.</c->pipeTo<c- p>(</c->httpRequestBody<c- p>)</c-> <c- p>])</c-> <c- p>.</c->then<c- p>(()</c-> <c- p>=></c-> console<c- p>.</c->log<c- p>(</c-><c- u>"Saved the stream to the cache and also uploaded it!"</c-><c- p>))</c-> <c- p>.</c-><c- k>catch</c-><c- p>(</c->e <c- p>=></c-> console<c- p>.</c->error<c- p>(</c-><c- u>"Either caching or uploading failed: "</c-><c- p>,</c-> e<c- p>));</c-> </pre> </div> </div> <h4 class="heading settled" data-level="4.2.5" id="rs-asynciterator"><span class="secno">4.2.5. </span><span class="content">Asynchronous iteration</span><span id="rs-asynciterator-prototype"></span><span id="default-reader-asynciterator-prototype-internal-slots"></span><a class="self-link" href="#rs-asynciterator"></a></h4> <dl class="domintro"> <dt><code>for await (const <var>chunk</var> of <var>stream</var>) { ... }</code> <dt><code>for await (const <var>chunk</var> of <var>stream</var>.values({ <code class="idl"><a data-link-type="idl" href="#dom-readablestreamiteratoroptions-preventcancel" id="ref-for-dom-readablestreamiteratoroptions-preventcancel">preventCancel</a></code>: true })) { ... }</code> <dd> <p>Asynchronously iterates over the <a data-link-type="dfn" href="#chunk" id="ref-for-chunk①⑧">chunks</a> in the stream’s internal queue. </p> <p>Asynchronously iterating over the stream will <a data-link-type="dfn" href="#lock" id="ref-for-lock①⓪">lock</a> it, preventing any other consumer from acquiring a reader. The lock will be released if the async iterator’s <code>return()</code> method is called, e.g. by <code>break</code>ing out of the loop. </p> <p>By default, calling the async iterator’s <code>return()</code> method will also <a data-link-type="dfn" href="#cancel-a-readable-stream" id="ref-for-cancel-a-readable-stream⑧">cancel</a> the stream. To prevent this, use the stream’s <code>values()</code> method, passing true for the <code class="idl"><a data-link-type="idl" href="#dom-readablestreamiteratoroptions-preventcancel" id="ref-for-dom-readablestreamiteratoroptions-preventcancel①">preventCancel</a></code> option. </p> </dl> <div class="algorithm" data-algorithm="ReadableStream asynchronous iterator initialization steps" id="rs-get-iterator"> The <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#asynchronous-iterator-initialization-steps" id="ref-for-asynchronous-iterator-initialization-steps">asynchronous iterator initialization steps</a> for a <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream①⑦">ReadableStream</a></code>, given <var>stream</var>, <var>iterator</var>, and <var>args</var>, are: <ol> <li data-md> <p>Let <var>reader</var> be ? <a data-link-type="abstract-op" href="#acquire-readable-stream-reader" id="ref-for-acquire-readable-stream-reader①">AcquireReadableStreamDefaultReader</a>(<var>stream</var>).</p> <li data-md> <p>Set <var>iterator</var>’s <dfn class="dfn-paneled" data-dfn-for="ReadableStream async iterator" data-dfn-type="dfn" data-noexport id="readablestream-async-iterator-reader">reader</dfn> to <var>reader</var>.</p> <li data-md> <p>Let <var>preventCancel</var> be <var>args</var>[0]["<code class="idl"><a data-link-type="idl" href="#dom-readablestreamiteratoroptions-preventcancel" id="ref-for-dom-readablestreamiteratoroptions-preventcancel②">preventCancel</a></code>"].</p> <li data-md> <p>Set <var>iterator</var>’s <dfn class="dfn-paneled" data-dfn-for="ReadableStream async iterator" data-dfn-type="dfn" data-noexport id="readablestream-async-iterator-prevent-cancel">prevent cancel</dfn> to <var>preventCancel</var>.</p> </ol> </div> <div class="algorithm" data-algorithm="ReadableStream get the next iteration result" id="rs-asynciterator-prototype-next"> The <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-get-the-next-iteration-result" id="ref-for-dfn-get-the-next-iteration-result">get the next iteration result</a> steps for a <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream①⑧">ReadableStream</a></code>, given <var>stream</var> and <var>iterator</var>, are: <ol> <li data-md> <p>Let <var>reader</var> be <var>iterator</var>’s <a data-link-type="dfn" href="#readablestream-async-iterator-reader" id="ref-for-readablestream-async-iterator-reader">reader</a>.</p> <li data-md> <p class="assertion">Assert: <var>reader</var>.<a data-link-type="dfn" href="#readablestreamgenericreader-stream" id="ref-for-readablestreamgenericreader-stream">[[stream]]</a> is not undefined.</p> <li data-md> <p>Let <var>promise</var> be <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-new-promise" id="ref-for-a-new-promise">a new promise</a>.</p> <li data-md> <p>Let <var>readRequest</var> be a new <a data-link-type="dfn" href="#read-request" id="ref-for-read-request">read request</a> with the following <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#struct-item" id="ref-for-struct-item">items</a>:</p> <dl> <dt data-md><a data-link-type="dfn" href="#read-request-chunk-steps" id="ref-for-read-request-chunk-steps">chunk steps</a>, given <var>chunk</var> <dd data-md> <ol> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#resolve" id="ref-for-resolve">Resolve</a> <var>promise</var> with <var>chunk</var>.</p> </ol> <dt data-md><a data-link-type="dfn" href="#read-request-close-steps" id="ref-for-read-request-close-steps">close steps</a> <dd data-md> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#abstract-opdef-readablestreamdefaultreaderrelease" id="ref-for-abstract-opdef-readablestreamdefaultreaderrelease">ReadableStreamDefaultReaderRelease</a>(<var>reader</var>).</p> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#resolve" id="ref-for-resolve①">Resolve</a> <var>promise</var> with <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#end-of-iteration" id="ref-for-end-of-iteration">end of iteration</a>.</p> </ol> <dt data-md><a data-link-type="dfn" href="#read-request-error-steps" id="ref-for-read-request-error-steps">error steps</a>, given <var>e</var> <dd data-md> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#abstract-opdef-readablestreamdefaultreaderrelease" id="ref-for-abstract-opdef-readablestreamdefaultreaderrelease①">ReadableStreamDefaultReaderRelease</a>(<var>reader</var>).</p> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#reject" id="ref-for-reject">Reject</a> <var>promise</var> with <var>e</var>.</p> </ol> </dl> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-default-reader-read" id="ref-for-readable-stream-default-reader-read">ReadableStreamDefaultReaderRead</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this①③">this</a>, <var>readRequest</var>).</p> <li data-md> <p>Return <var>promise</var>.</p> </ol> </div> <div class="algorithm" data-algorithm="ReadableStream asynchronous iterator return" id="rs-asynciterator-prototype-return"> The <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#asynchronous-iterator-return" id="ref-for-asynchronous-iterator-return">asynchronous iterator return</a> steps for a <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream①⑨">ReadableStream</a></code>, given <var>stream</var>, <var>iterator</var>, and <var>arg</var>, are: <ol> <li data-md> <p>Let <var>reader</var> be <var>iterator</var>’s <a data-link-type="dfn" href="#readablestream-async-iterator-reader" id="ref-for-readablestream-async-iterator-reader①">reader</a>.</p> <li data-md> <p class="assertion">Assert: <var>reader</var>.<a data-link-type="dfn" href="#readablestreamgenericreader-stream" id="ref-for-readablestreamgenericreader-stream①">[[stream]]</a> is not undefined.</p> <li data-md> <p class="assertion">Assert: <var>reader</var>.<a data-link-type="dfn" href="#readablestreamdefaultreader-readrequests" id="ref-for-readablestreamdefaultreader-readrequests">[[readRequests]]</a> is <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-is-empty" id="ref-for-list-is-empty">empty</a>, as the async iterator machinery guarantees that any previous calls to <code>next()</code> have settled before this is called.</p> <li data-md> <p>If <var>iterator</var>’s <a data-link-type="dfn" href="#readablestream-async-iterator-prevent-cancel" id="ref-for-readablestream-async-iterator-prevent-cancel">prevent cancel</a> is false:</p> <ol> <li data-md> <p>Let <var>result</var> be ! <a data-link-type="abstract-op" href="#readable-stream-reader-generic-cancel" id="ref-for-readable-stream-reader-generic-cancel">ReadableStreamReaderGenericCancel</a>(<var>reader</var>, <var>arg</var>).</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#abstract-opdef-readablestreamdefaultreaderrelease" id="ref-for-abstract-opdef-readablestreamdefaultreaderrelease②">ReadableStreamDefaultReaderRelease</a>(<var>reader</var>).</p> <li data-md> <p>Return <var>result</var>.</p> </ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#abstract-opdef-readablestreamdefaultreaderrelease" id="ref-for-abstract-opdef-readablestreamdefaultreaderrelease③">ReadableStreamDefaultReaderRelease</a>(<var>reader</var>).</p> <li data-md> <p>Return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-resolved-with" id="ref-for-a-promise-resolved-with">a promise resolved with</a> undefined.</p> </ol> </div> <h4 class="heading settled" data-level="4.2.6" id="rs-transfer"><span class="secno">4.2.6. </span><span class="content">Transfer via <code>postMessage()</code></span><a class="self-link" href="#rs-transfer"></a></h4> <dl class="domintro"> <dt><code>destination.postMessage(rs, { transfer: [rs] });</code> <dd> <p>Sends a <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream②⓪">ReadableStream</a></code> to another frame, window, or worker. </p> <p>The transferred stream can be used exactly like the original. The original will become <a data-link-type="dfn" href="#lock" id="ref-for-lock①①">locked</a> and no longer directly usable. </p> </dl> <div class="algorithm" data-algorithm="ReadableStream transfer steps"> <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream②①">ReadableStream</a></code> objects are <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/structured-data.html#transferable-objects" id="ref-for-transferable-objects">transferable objects</a>. Their <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/structured-data.html#transfer-steps" id="ref-for-transfer-steps">transfer steps</a>, given <var>value</var> and <var>dataHolder</var>, are: <ol> <li data-md> <p>If ! <a data-link-type="abstract-op" href="#is-readable-stream-locked" id="ref-for-is-readable-stream-locked④">IsReadableStreamLocked</a>(<var>value</var>) is true, throw a "<code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#datacloneerror" id="ref-for-datacloneerror">DataCloneError</a></code>" <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#idl-DOMException" id="ref-for-idl-DOMException">DOMException</a></code>.</p> <li data-md> <p>Let <var>port1</var> be a <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#new" id="ref-for-new">new</a> <code class="idl"><a data-link-type="idl" href="https://html.spec.whatwg.org/multipage/web-messaging.html#messageport" id="ref-for-messageport">MessagePort</a></code> in <a data-link-type="dfn" href="https://tc39.es/ecma262/#current-realm" id="ref-for-current-realm">the current Realm</a>.</p> <li data-md> <p>Let <var>port2</var> be a <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#new" id="ref-for-new①">new</a> <code class="idl"><a data-link-type="idl" href="https://html.spec.whatwg.org/multipage/web-messaging.html#messageport" id="ref-for-messageport①">MessagePort</a></code> in <a data-link-type="dfn" href="https://tc39.es/ecma262/#current-realm" id="ref-for-current-realm①">the current Realm</a>.</p> <li data-md> <p><a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/web-messaging.html#entangle" id="ref-for-entangle">Entangle</a> <var>port1</var> and <var>port2</var>.</p> <li data-md> <p>Let <var>writable</var> be a <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#new" id="ref-for-new②">new</a> <code class="idl"><a data-link-type="idl" href="#writablestream" id="ref-for-writablestream⑥">WritableStream</a></code> in <a data-link-type="dfn" href="https://tc39.es/ecma262/#current-realm" id="ref-for-current-realm②">the current Realm</a>.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#abstract-opdef-setupcrossrealmtransformwritable" id="ref-for-abstract-opdef-setupcrossrealmtransformwritable">SetUpCrossRealmTransformWritable</a>(<var>writable</var>, <var>port1</var>).</p> <li data-md> <p>Let <var>promise</var> be ! <a data-link-type="abstract-op" href="#readable-stream-pipe-to" id="ref-for-readable-stream-pipe-to②">ReadableStreamPipeTo</a>(<var>value</var>, <var>writable</var>, false, false, false).</p> <li data-md> <p>Set <var>promise</var>.[[PromiseIsHandled]] to true.</p> <li data-md> <p>Set <var>dataHolder</var>.[[port]] to ! <a data-link-type="abstract-op" href="https://html.spec.whatwg.org/multipage/structured-data.html#structuredserializewithtransfer" id="ref-for-structuredserializewithtransfer">StructuredSerializeWithTransfer</a>(<var>port2</var>, « <var>port2</var> »).</p> </ol> </div> <div class="algorithm" data-algorithm="ReadableStream transfer-receiving steps"> Their <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/structured-data.html#transfer-receiving-steps" id="ref-for-transfer-receiving-steps">transfer-receiving steps</a>, given <var>dataHolder</var> and <var>value</var>, are: <ol> <li data-md> <p>Let <var>deserializedRecord</var> be ! <a data-link-type="abstract-op" href="https://html.spec.whatwg.org/multipage/structured-data.html#structureddeserializewithtransfer" id="ref-for-structureddeserializewithtransfer">StructuredDeserializeWithTransfer</a>(<var>dataHolder</var>.[[port]], <a data-link-type="dfn" href="https://tc39.es/ecma262/#current-realm" id="ref-for-current-realm③">the current Realm</a>).</p> <li data-md> <p>Let <var>port</var> be <var>deserializedRecord</var>.[[Deserialized]].</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#abstract-opdef-setupcrossrealmtransformreadable" id="ref-for-abstract-opdef-setupcrossrealmtransformreadable">SetUpCrossRealmTransformReadable</a>(<var>value</var>, <var>port</var>).</p> </ol> </div> <h3 class="heading settled" data-level="4.3" id="generic-reader-mixin"><span class="secno">4.3. </span><span class="content">The <code class="idl"><a data-link-type="idl" href="#readablestreamgenericreader" id="ref-for-readablestreamgenericreader">ReadableStreamGenericReader</a></code> mixin</span><a class="self-link" href="#generic-reader-mixin"></a></h3> <p>The <code class="idl"><a data-link-type="idl" href="#readablestreamgenericreader" id="ref-for-readablestreamgenericreader①">ReadableStreamGenericReader</a></code> mixin defines common internal slots, getters and methods that are shared between <code class="idl"><a data-link-type="idl" href="#readablestreamdefaultreader" id="ref-for-readablestreamdefaultreader④">ReadableStreamDefaultReader</a></code> and <code class="idl"><a data-link-type="idl" href="#readablestreambyobreader" id="ref-for-readablestreambyobreader④">ReadableStreamBYOBReader</a></code> objects.</p> <h4 class="heading settled" data-level="4.3.1" id="generic-reader-mixin-definition"><span class="secno">4.3.1. </span><span class="content">Mixin definition</span><a class="self-link" href="#generic-reader-mixin-definition"></a></h4> <p>The Web IDL definition for the <code class="idl"><a data-link-type="idl" href="#readablestreamgenericreader" id="ref-for-readablestreamgenericreader②">ReadableStreamGenericReader</a></code> mixin is given as follows:</p> <pre class="idl highlight def"><c- b>interface</c-> <c- b>mixin</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="interface" data-export id="readablestreamgenericreader"><code><c- g>ReadableStreamGenericReader</c-></code></dfn> { <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise" id="ref-for-idl-promise④"><c- b>Promise</c-></a><<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined" id="ref-for-idl-undefined④"><c- b>undefined</c-></a>> <a class="idl-code" data-link-type="attribute" data-readonly data-type="Promise<undefined>" href="#generic-reader-closed" id="ref-for-generic-reader-closed"><c- g>closed</c-></a>; <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise" id="ref-for-idl-promise⑤"><c- b>Promise</c-></a><<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined" id="ref-for-idl-undefined⑤"><c- b>undefined</c-></a>> <a class="idl-code" data-link-type="method" href="#generic-reader-cancel" id="ref-for-generic-reader-cancel①"><c- g>cancel</c-></a>(<c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any" id="ref-for-idl-any⑤"><c- b>any</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableStreamGenericReader/cancel(reason), ReadableStreamGenericReader/cancel()" data-dfn-type="argument" data-export id="dom-readablestreamgenericreader-cancel-reason-reason"><code><c- g>reason</c-></code></dfn>); }; </pre> <h4 class="heading settled" data-level="4.3.2" id="generic-reader-internal-slots"><span class="secno">4.3.2. </span><span class="content">Internal slots</span><a class="self-link" href="#generic-reader-internal-slots"></a></h4> <p>Instances of classes including the <code class="idl"><a data-link-type="idl" href="#readablestreamgenericreader" id="ref-for-readablestreamgenericreader③">ReadableStreamGenericReader</a></code> mixin are created with the internal slots described in the following table:</p> <table> <thead> <tr> <th>Internal Slot <th>Description (<em>non-normative</em>) <tbody> <tr> <td><dfn class="dfn-paneled" data-dfn-for="ReadableStreamGenericReader" data-dfn-type="dfn" data-noexport id="readablestreamgenericreader-closedpromise">[[closedPromise]]</dfn> <td class="non-normative">A promise returned by the reader’s <code class="idl"><a data-link-type="idl" href="#generic-reader-closed" id="ref-for-generic-reader-closed①">closed</a></code> getter <tr> <td><dfn class="dfn-paneled" data-dfn-for="ReadableStreamGenericReader" data-dfn-type="dfn" data-noexport id="readablestreamgenericreader-stream">[[stream]]</dfn> <td class="non-normative">A <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream②②">ReadableStream</a></code> instance that owns this reader </table> <h4 class="heading settled" data-level="4.3.3" id="generic-reader-prototype"><span class="secno">4.3.3. </span><span class="content">Methods and properties</span><a class="self-link" href="#generic-reader-prototype"></a></h4> <div class="algorithm" data-algorithm="closed" data-algorithm-for="ReadableStreamGenericReader"> The <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableStreamGenericReader" data-dfn-type="attribute" data-export id="generic-reader-closed"><code><code>closed</code><span id="default-reader-closed"></span><span id="byob-reader-closed"></span></code></dfn> getter steps are: <ol> <li data-md> <p>Return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this①④">this</a>.<a data-link-type="dfn" href="#readablestreamgenericreader-closedpromise" id="ref-for-readablestreamgenericreader-closedpromise">[[closedPromise]]</a>.</p> </ol> </div> <div class="algorithm" data-algorithm="cancel(reason)" data-algorithm-for="ReadableStreamGenericReader"> The <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableStreamGenericReader" data-dfn-type="method" data-export data-lt="cancel(reason)|cancel()" id="generic-reader-cancel"><code><code>cancel(<var>reason</var>)</code><span id="default-reader-cancel"></span><span id="byob-reader-cancel"></span></code></dfn> method steps are: <ol> <li data-md> <p>If <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this①⑤">this</a>.<a data-link-type="dfn" href="#readablestreamgenericreader-stream" id="ref-for-readablestreamgenericreader-stream②">[[stream]]</a> is undefined, return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-rejected-with" id="ref-for-a-promise-rejected-with③">a promise rejected with</a> a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror⑥">TypeError</a></code> exception.</p> <li data-md> <p>Return ! <a data-link-type="abstract-op" href="#readable-stream-reader-generic-cancel" id="ref-for-readable-stream-reader-generic-cancel①">ReadableStreamReaderGenericCancel</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this①⑥">this</a>, <var>reason</var>).</p> </ol> </div> <h3 class="heading settled" data-level="4.4" id="default-reader-class"><span class="secno">4.4. </span><span class="content">The <code class="idl"><a data-link-type="idl" href="#readablestreamdefaultreader" id="ref-for-readablestreamdefaultreader⑤">ReadableStreamDefaultReader</a></code> class</span><a class="self-link" href="#default-reader-class"></a></h3> <p>The <code class="idl"><a data-link-type="idl" href="#readablestreamdefaultreader" id="ref-for-readablestreamdefaultreader⑥">ReadableStreamDefaultReader</a></code> class represents a <a data-link-type="dfn" href="#default-reader" id="ref-for-default-reader②">default reader</a> designed to be vended by a <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream②③">ReadableStream</a></code> instance.</p> <h4 class="heading settled" data-level="4.4.1" id="default-reader-class-definition"><span class="secno">4.4.1. </span><span class="content">Interface definition</span><a class="self-link" href="#default-reader-class-definition"></a></h4> <p>The Web IDL definition for the <code class="idl"><a data-link-type="idl" href="#readablestreamdefaultreader" id="ref-for-readablestreamdefaultreader⑦">ReadableStreamDefaultReader</a></code> class is given as follows:</p> <pre class="idl highlight def">[Exposed=*] <c- b>interface</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="interface" data-export id="readablestreamdefaultreader"><code><c- g>ReadableStreamDefaultReader</c-></code></dfn> { <a class="idl-code" data-link-type="constructor" href="#default-reader-constructor" id="ref-for-default-reader-constructor"><c- g>constructor</c-></a>(<a data-link-type="idl-name" href="#readablestream" id="ref-for-readablestream②④"><c- n>ReadableStream</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableStreamDefaultReader/ReadableStreamDefaultReader(stream), ReadableStreamDefaultReader/constructor(stream)" data-dfn-type="argument" data-export id="dom-readablestreamdefaultreader-readablestreamdefaultreader-stream-stream"><code><c- g>stream</c-></code></dfn>); <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise" id="ref-for-idl-promise⑥"><c- b>Promise</c-></a><<a data-link-type="idl-name" href="#dictdef-readablestreamreadresult" id="ref-for-dictdef-readablestreamreadresult"><c- n>ReadableStreamReadResult</c-></a>> <a class="idl-code" data-link-type="method" href="#default-reader-read" id="ref-for-default-reader-read"><c- g>read</c-></a>(); <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined" id="ref-for-idl-undefined⑥"><c- b>undefined</c-></a> <a class="idl-code" data-link-type="method" href="#default-reader-release-lock" id="ref-for-default-reader-release-lock①"><c- g>releaseLock</c-></a>(); }; <a data-link-type="idl-name" href="#readablestreamdefaultreader" id="ref-for-readablestreamdefaultreader⑧"><c- n>ReadableStreamDefaultReader</c-></a> <c- b>includes</c-> <a data-link-type="idl-name" href="#readablestreamgenericreader" id="ref-for-readablestreamgenericreader④"><c- n>ReadableStreamGenericReader</c-></a>; <c- b>dictionary</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="dictionary" data-export id="dictdef-readablestreamreadresult"><code><c- g>ReadableStreamReadResult</c-></code></dfn> { <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any" id="ref-for-idl-any⑥"><c- b>any</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableStreamReadResult" data-dfn-type="dict-member" data-export data-type="any" id="dom-readablestreamreadresult-value"><code><c- g>value</c-></code></dfn>; <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-boolean" id="ref-for-idl-boolean⑤"><c- b>boolean</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableStreamReadResult" data-dfn-type="dict-member" data-export data-type="boolean" id="dom-readablestreamreadresult-done"><code><c- g>done</c-></code></dfn>; }; </pre> <h4 class="heading settled" data-level="4.4.2" id="default-reader-internal-slots"><span class="secno">4.4.2. </span><span class="content">Internal slots</span><a class="self-link" href="#default-reader-internal-slots"></a></h4> <p>Instances of <code class="idl"><a data-link-type="idl" href="#readablestreamdefaultreader" id="ref-for-readablestreamdefaultreader⑨">ReadableStreamDefaultReader</a></code> are created with the internal slots defined by <code class="idl"><a data-link-type="idl" href="#readablestreamgenericreader" id="ref-for-readablestreamgenericreader⑤">ReadableStreamGenericReader</a></code>, and those described in the following table:</p> <table> <thead> <tr> <th>Internal Slot <th>Description (<em>non-normative</em>) <tbody> <tr> <td><dfn class="dfn-paneled" data-dfn-for="ReadableStreamDefaultReader" data-dfn-type="dfn" data-noexport id="readablestreamdefaultreader-readrequests">[[readRequests]]</dfn> <td class="non-normative">A <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list" id="ref-for-list">list</a> of <a data-link-type="dfn" href="#read-request" id="ref-for-read-request①">read requests</a>, used when a <a data-link-type="dfn" href="#consumer" id="ref-for-consumer③">consumer</a> requests <a data-link-type="dfn" href="#chunk" id="ref-for-chunk①⑨">chunks</a> sooner than they are available </table> <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="read-request">read request</dfn> is a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#struct" id="ref-for-struct">struct</a> containing three algorithms to perform in reaction to filling the <a data-link-type="dfn" href="#readable-stream" id="ref-for-readable-stream①③">readable stream</a>'s <a data-link-type="dfn" href="#internal-queues" id="ref-for-internal-queues③">internal queue</a> or changing its state. It has the following <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#struct-item" id="ref-for-struct-item①">items</a>:</p> <dl> <dt data-md><dfn class="dfn-paneled" data-dfn-for="read request" data-dfn-type="dfn" data-export id="read-request-chunk-steps">chunk steps</dfn> <dd data-md> <p>An algorithm taking a <a data-link-type="dfn" href="#chunk" id="ref-for-chunk②⓪">chunk</a>, called when a chunk is available for reading</p> <dt data-md><dfn class="dfn-paneled" data-dfn-for="read request" data-dfn-type="dfn" data-export id="read-request-close-steps">close steps</dfn> <dd data-md> <p>An algorithm taking no arguments, called when no <a data-link-type="dfn" href="#chunk" id="ref-for-chunk②①">chunks</a> are available because the stream is closed</p> <dt data-md><dfn class="dfn-paneled" data-dfn-for="read request" data-dfn-type="dfn" data-export id="read-request-error-steps">error steps</dfn> <dd data-md> <p>An algorithm taking a JavaScript value, called when no <a data-link-type="dfn" href="#chunk" id="ref-for-chunk②②">chunks</a> are available because the stream is errored</p> </dl> <h4 class="heading settled" data-level="4.4.3" id="default-reader-prototype"><span class="secno">4.4.3. </span><span class="content">Constructor, methods, and properties</span><a class="self-link" href="#default-reader-prototype"></a></h4> <dl class="domintro non-normative"> <dt><code><var>reader</var> = new <code class="idl"><a data-link-type="idl" href="#default-reader-constructor" id="ref-for-default-reader-constructor①">ReadableStreamDefaultReader</a></code>(<var>stream</var>)</code> <dd> <p>This is equivalent to calling <code><var>stream</var>.<code class="idl"><a data-link-type="idl" href="#rs-get-reader" id="ref-for-rs-get-reader⑦">getReader()</a></code></code>. </p> <dt><code>await <var>reader</var>.<code class="idl"><a data-link-type="idl" href="#generic-reader-closed" id="ref-for-generic-reader-closed②">closed</a></code></code> <dd> <p>Returns a promise that will be fulfilled when the stream becomes closed, or rejected if the stream ever errors or the reader’s lock is <a data-link-type="dfn" href="#release-a-lock" id="ref-for-release-a-lock①">released</a> before the stream finishes closing. </p> <dt><code>await <var>reader</var>.<code class="idl"><a data-link-type="idl" href="#generic-reader-cancel" id="ref-for-generic-reader-cancel②">cancel</a></code>([ <var>reason</var> ])</code> <dd> <p>If the reader is <a data-link-type="dfn" href="#active" id="ref-for-active">active</a>, behaves the same as <code><var>stream</var>.<code class="idl"><a data-link-type="idl" href="#rs-cancel" id="ref-for-rs-cancel④">cancel</a></code>(<var>reason</var>)</code>. </p> <dt><code>{ <var>value</var>, <var>done</var> } = await <var>reader</var>.<code class="idl"><a data-link-type="idl" href="#default-reader-read" id="ref-for-default-reader-read①">read</a></code>()</code> <dd> <p>Returns a promise that allows access to the next <a data-link-type="dfn" href="#chunk" id="ref-for-chunk②③">chunk</a> from the stream’s internal queue, if available. </p> <ul> <li>If the chunk does become available, the promise will be fulfilled with an object of the form <code class="highlight"><c- p>{</c-> value<c- o>:</c-> theChunk<c- p>,</c-> done<c- o>:</c-> <c- kc>false</c-> <c- p>}</c-></code>. <li>If the stream becomes closed, the promise will be fulfilled with an object of the form <code class="highlight"><c- p>{</c-> value<c- o>:</c-> <c- kc>undefined</c-><c- p>,</c-> done<c- o>:</c-> <c- kc>true</c-> <c- p>}</c-></code>. <li>If the stream becomes errored, the promise will be rejected with the relevant error. </ul> <p>If reading a chunk causes the queue to become empty, more data will be pulled from the <a data-link-type="dfn" href="#underlying-source" id="ref-for-underlying-source①⓪">underlying source</a>. </p> <dt><code><var>reader</var>.<code class="idl"><a data-link-type="idl" href="#default-reader-release-lock" id="ref-for-default-reader-release-lock②">releaseLock</a></code>()</code> <dd> <p><a data-link-type="dfn" href="#release-a-lock" id="ref-for-release-a-lock②">Releases the reader’s lock</a> on the corresponding stream. After the lock is released, the reader is no longer <a data-link-type="dfn" href="#active" id="ref-for-active①">active</a>. If the associated stream is errored when the lock is released, the reader will appear errored in the same way from now on; otherwise, the reader will appear closed. </p> <p>If the reader’s lock is released while it still has pending read requests, then the promises returned by the reader’s <code class="idl"><a data-link-type="idl" href="#default-reader-read" id="ref-for-default-reader-read②">read()</a></code> method are immediately rejected with a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror⑦">TypeError</a></code>. Any unread chunks remain in the stream’s <a data-link-type="dfn" href="#internal-queues" id="ref-for-internal-queues④">internal queue</a> and can be read later by acquiring a new reader. </p> </dl> <div class="algorithm" data-algorithm="ReadableStreamDefaultReader(stream)" data-algorithm-for="ReadableStreamDefaultReader"> The <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableStreamDefaultReader" data-dfn-type="constructor" data-export data-lt="ReadableStreamDefaultReader(stream)|constructor(stream)" id="default-reader-constructor"><code>new ReadableStreamDefaultReader(<var>stream</var>)</code></dfn> constructor steps are: <ol> <li data-md> <p>Perform ? <a data-link-type="abstract-op" href="#set-up-readable-stream-default-reader" id="ref-for-set-up-readable-stream-default-reader">SetUpReadableStreamDefaultReader</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this①⑦">this</a>, <var>stream</var>).</p> </ol> </div> <div class="algorithm" data-algorithm="read()" data-algorithm-for="ReadableStreamDefaultReader"> The <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableStreamDefaultReader" data-dfn-type="method" data-export id="default-reader-read"><code>read()</code></dfn> method steps are: <ol> <li data-md> <p>If <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this①⑧">this</a>.<a data-link-type="dfn" href="#readablestreamgenericreader-stream" id="ref-for-readablestreamgenericreader-stream③">[[stream]]</a> is undefined, return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-rejected-with" id="ref-for-a-promise-rejected-with④">a promise rejected with</a> a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror⑧">TypeError</a></code> exception.</p> <li data-md> <p>Let <var>promise</var> be <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-new-promise" id="ref-for-a-new-promise①">a new promise</a>.</p> <li data-md> <p>Let <var>readRequest</var> be a new <a data-link-type="dfn" href="#read-request" id="ref-for-read-request②">read request</a> with the following <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#struct-item" id="ref-for-struct-item②">items</a>:</p> <dl> <dt data-md><a data-link-type="dfn" href="#read-request-chunk-steps" id="ref-for-read-request-chunk-steps①">chunk steps</a>, given <var>chunk</var> <dd data-md> <ol> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#resolve" id="ref-for-resolve②">Resolve</a> <var>promise</var> with «[ "<code class="idl"><a data-link-type="idl" href="#dom-readablestreamreadresult-value" id="ref-for-dom-readablestreamreadresult-value">value</a></code>" → <var>chunk</var>, "<code class="idl"><a data-link-type="idl" href="#dom-readablestreamreadresult-done" id="ref-for-dom-readablestreamreadresult-done">done</a></code>" → false ]».</p> </ol> <dt data-md><a data-link-type="dfn" href="#read-request-close-steps" id="ref-for-read-request-close-steps①">close steps</a> <dd data-md> <ol> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#resolve" id="ref-for-resolve③">Resolve</a> <var>promise</var> with «[ "<code class="idl"><a data-link-type="idl" href="#dom-readablestreamreadresult-value" id="ref-for-dom-readablestreamreadresult-value①">value</a></code>" → undefined, "<code class="idl"><a data-link-type="idl" href="#dom-readablestreamreadresult-done" id="ref-for-dom-readablestreamreadresult-done①">done</a></code>" → true ]».</p> </ol> <dt data-md><a data-link-type="dfn" href="#read-request-error-steps" id="ref-for-read-request-error-steps①">error steps</a>, given <var>e</var> <dd data-md> <ol> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#reject" id="ref-for-reject①">Reject</a> <var>promise</var> with <var>e</var>.</p> </ol> </dl> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-default-reader-read" id="ref-for-readable-stream-default-reader-read①">ReadableStreamDefaultReaderRead</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this①⑨">this</a>, <var>readRequest</var>).</p> <li data-md> <p>Return <var>promise</var>.</p> </ol> </div> <div class="algorithm" data-algorithm="releaseLock()" data-algorithm-for="ReadableStreamDefaultReader"> The <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableStreamDefaultReader" data-dfn-type="method" data-export id="default-reader-release-lock"><code>releaseLock()</code></dfn> method steps are: <ol> <li data-md> <p>If <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this②⓪">this</a>.<a data-link-type="dfn" href="#readablestreamgenericreader-stream" id="ref-for-readablestreamgenericreader-stream④">[[stream]]</a> is undefined, return.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#abstract-opdef-readablestreamdefaultreaderrelease" id="ref-for-abstract-opdef-readablestreamdefaultreaderrelease④">ReadableStreamDefaultReaderRelease</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this②①">this</a>).</p> </ol> </div> <h3 class="heading settled" data-level="4.5" id="byob-reader-class"><span class="secno">4.5. </span><span class="content">The <code class="idl"><a data-link-type="idl" href="#readablestreambyobreader" id="ref-for-readablestreambyobreader⑤">ReadableStreamBYOBReader</a></code> class</span><a class="self-link" href="#byob-reader-class"></a></h3> <p>The <code class="idl"><a data-link-type="idl" href="#readablestreambyobreader" id="ref-for-readablestreambyobreader⑥">ReadableStreamBYOBReader</a></code> class represents a <a data-link-type="dfn" href="#byob-reader" id="ref-for-byob-reader⑤">BYOB reader</a> designed to be vended by a <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream②⑤">ReadableStream</a></code> instance.</p> <h4 class="heading settled" data-level="4.5.1" id="byob-reader-class-definition"><span class="secno">4.5.1. </span><span class="content">Interface definition</span><a class="self-link" href="#byob-reader-class-definition"></a></h4> <p>The Web IDL definition for the <code class="idl"><a data-link-type="idl" href="#readablestreambyobreader" id="ref-for-readablestreambyobreader⑦">ReadableStreamBYOBReader</a></code> class is given as follows:</p> <pre class="idl highlight def">[Exposed=*] <c- b>interface</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="interface" data-export id="readablestreambyobreader"><code><c- g>ReadableStreamBYOBReader</c-></code></dfn> { <a class="idl-code" data-link-type="constructor" href="#byob-reader-constructor" id="ref-for-byob-reader-constructor"><c- g>constructor</c-></a>(<a data-link-type="idl-name" href="#readablestream" id="ref-for-readablestream②⑥"><c- n>ReadableStream</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableStreamBYOBReader/ReadableStreamBYOBReader(stream), ReadableStreamBYOBReader/constructor(stream)" data-dfn-type="argument" data-export id="dom-readablestreambyobreader-readablestreambyobreader-stream-stream"><code><c- g>stream</c-></code></dfn>); <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise" id="ref-for-idl-promise⑦"><c- b>Promise</c-></a><<a data-link-type="idl-name" href="#dictdef-readablestreamreadresult" id="ref-for-dictdef-readablestreamreadresult①"><c- n>ReadableStreamReadResult</c-></a>> <a class="idl-code" data-link-type="method" href="#byob-reader-read" id="ref-for-byob-reader-read②"><c- g>read</c-></a>(<a data-link-type="idl-name" href="https://webidl.spec.whatwg.org/#ArrayBufferView" id="ref-for-ArrayBufferView"><c- n>ArrayBufferView</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableStreamBYOBReader/read(view, options), ReadableStreamBYOBReader/read(view)" data-dfn-type="argument" data-export id="dom-readablestreambyobreader-read-view-options-view"><code><c- g>view</c-></code></dfn>, <c- b>optional</c-> <a data-link-type="idl-name" href="#dictdef-readablestreambyobreaderreadoptions" id="ref-for-dictdef-readablestreambyobreaderreadoptions"><c- n>ReadableStreamBYOBReaderReadOptions</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableStreamBYOBReader/read(view, options), ReadableStreamBYOBReader/read(view)" data-dfn-type="argument" data-export id="dom-readablestreambyobreader-read-view-options-options"><code><c- g>options</c-></code></dfn> = {}); <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined" id="ref-for-idl-undefined⑦"><c- b>undefined</c-></a> <a class="idl-code" data-link-type="method" href="#byob-reader-release-lock" id="ref-for-byob-reader-release-lock①"><c- g>releaseLock</c-></a>(); }; <a data-link-type="idl-name" href="#readablestreambyobreader" id="ref-for-readablestreambyobreader⑧"><c- n>ReadableStreamBYOBReader</c-></a> <c- b>includes</c-> <a data-link-type="idl-name" href="#readablestreamgenericreader" id="ref-for-readablestreamgenericreader⑥"><c- n>ReadableStreamGenericReader</c-></a>; <c- b>dictionary</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="dictionary" data-export id="dictdef-readablestreambyobreaderreadoptions"><code><c- g>ReadableStreamBYOBReaderReadOptions</c-></code></dfn> { [<a class="idl-code" data-link-type="extended-attribute" href="https://webidl.spec.whatwg.org/#EnforceRange" id="ref-for-EnforceRange①"><c- g>EnforceRange</c-></a>] <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-unsigned-long-long" id="ref-for-idl-unsigned-long-long②"><c- b>unsigned</c-> <c- b>long</c-> <c- b>long</c-></a> <dfn class="dfn-paneled idl-code" data-default="1" data-dfn-for="ReadableStreamBYOBReaderReadOptions" data-dfn-type="dict-member" data-export data-type="unsigned long long" id="dom-readablestreambyobreaderreadoptions-min"><code><c- g>min</c-></code></dfn> = 1; }; </pre> <h4 class="heading settled" data-level="4.5.2" id="byob-reader-internal-slots"><span class="secno">4.5.2. </span><span class="content">Internal slots</span><a class="self-link" href="#byob-reader-internal-slots"></a></h4> <p>Instances of <code class="idl"><a data-link-type="idl" href="#readablestreambyobreader" id="ref-for-readablestreambyobreader⑨">ReadableStreamBYOBReader</a></code> are created with the internal slots defined by <code class="idl"><a data-link-type="idl" href="#readablestreamgenericreader" id="ref-for-readablestreamgenericreader⑦">ReadableStreamGenericReader</a></code>, and those described in the following table:</p> <table> <thead> <tr> <th>Internal Slot <th>Description (<em>non-normative</em>) <tbody> <tr> <td><dfn class="dfn-paneled" data-dfn-for="ReadableStreamBYOBReader" data-dfn-type="dfn" data-noexport id="readablestreambyobreader-readintorequests">[[readIntoRequests]]</dfn> <td class="non-normative">A <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list" id="ref-for-list①">list</a> of <a data-link-type="dfn" href="#read-into-request" id="ref-for-read-into-request">read-into requests</a>, used when a <a data-link-type="dfn" href="#consumer" id="ref-for-consumer④">consumer</a> requests <a data-link-type="dfn" href="#chunk" id="ref-for-chunk②④">chunks</a> sooner than they are available </table> <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="read-into-request">read-into request</dfn> is a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#struct" id="ref-for-struct①">struct</a> containing three algorithms to perform in reaction to filling the <a data-link-type="dfn" href="#readable-byte-stream" id="ref-for-readable-byte-stream⑤">readable byte stream</a>'s <a data-link-type="dfn" href="#internal-queues" id="ref-for-internal-queues⑤">internal queue</a> or changing its state. It has the following <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#struct-item" id="ref-for-struct-item③">items</a>:</p> <dl> <dt data-md><dfn class="dfn-paneled" data-dfn-for="read-into request" data-dfn-type="dfn" data-export id="read-into-request-chunk-steps">chunk steps</dfn> <dd data-md> <p>An algorithm taking a <a data-link-type="dfn" href="#chunk" id="ref-for-chunk②⑤">chunk</a>, called when a chunk is available for reading</p> <dt data-md><dfn class="dfn-paneled" data-dfn-for="read-into request" data-dfn-type="dfn" data-export id="read-into-request-close-steps">close steps</dfn> <dd data-md> <p>An algorithm taking a <a data-link-type="dfn" href="#chunk" id="ref-for-chunk②⑥">chunk</a> or undefined, called when no chunks are available because the stream is closed</p> <dt data-md><dfn class="dfn-paneled" data-dfn-for="read-into request" data-dfn-type="dfn" data-export id="read-into-request-error-steps">error steps</dfn> <dd data-md> <p>An algorithm taking a JavaScript value, called when no <a data-link-type="dfn" href="#chunk" id="ref-for-chunk②⑦">chunks</a> are available because the stream is errored</p> </dl> <p class="note" role="note">The <a data-link-type="dfn" href="#read-into-request-close-steps" id="ref-for-read-into-request-close-steps">close steps</a> take a <a data-link-type="dfn" href="#chunk" id="ref-for-chunk②⑧">chunk</a> so that it can return the backing memory to the caller if possible. For example, <code class="idl"><a data-link-type="idl" href="#byob-reader-read" id="ref-for-byob-reader-read③">byobReader.read(chunk)</a></code> will fulfill with <code class="highlight"><c- p>{</c-> value<c- o>:</c-> newViewOnSameMemory<c- p>,</c-> done<c- o>:</c-> <c- kc>true</c-> <c- p>}</c-></code> for closed streams. If the stream is <a data-link-type="dfn" href="#cancel-a-readable-stream" id="ref-for-cancel-a-readable-stream⑨">canceled</a>, the backing memory is discarded and <code class="idl"><a data-link-type="idl" href="#byob-reader-read" id="ref-for-byob-reader-read④">byobReader.read(chunk)</a></code> fulfills with the more traditional <code class="highlight"><c- p>{</c-> value<c- o>:</c-> <c- kc>undefined</c-><c- p>,</c-> done<c- o>:</c-> <c- kc>true</c-> <c- p>}</c-></code> instead. </p> <h4 class="heading settled" data-level="4.5.3" id="byob-reader-prototype"><span class="secno">4.5.3. </span><span class="content">Constructor, methods, and properties</span><a class="self-link" href="#byob-reader-prototype"></a></h4> <dl class="domintro non-normative"> <dt><code><var>reader</var> = new <code class="idl"><a data-link-type="idl" href="#byob-reader-constructor" id="ref-for-byob-reader-constructor①">ReadableStreamBYOBReader</a></code>(<var>stream</var>)</code> <dd> <p>This is equivalent to calling <code><var>stream</var>.<code class="idl"><a data-link-type="idl" href="#rs-get-reader" id="ref-for-rs-get-reader⑧">getReader</a></code>({ <code class="idl"><a data-link-type="idl" href="#dom-readablestreamgetreaderoptions-mode" id="ref-for-dom-readablestreamgetreaderoptions-mode③">mode</a></code>: "<code class="idl"><a data-link-type="idl" href="#dom-readablestreamreadermode-byob" id="ref-for-dom-readablestreamreadermode-byob②">byob</a></code>" })</code>. </p> <dt><code>await <var>reader</var>.<code class="idl"><a data-link-type="idl" href="#generic-reader-closed" id="ref-for-generic-reader-closed③">closed</a></code></code> <dd> <p>Returns a promise that will be fulfilled when the stream becomes closed, or rejected if the stream ever errors or the reader’s lock is <a data-link-type="dfn" href="#release-a-lock" id="ref-for-release-a-lock③">released</a> before the stream finishes closing. </p> <dt><code>await <var>reader</var>.<code class="idl"><a data-link-type="idl" href="#generic-reader-cancel" id="ref-for-generic-reader-cancel③">cancel</a></code>([ <var>reason</var> ])</code> <dd> <p>If the reader is <a data-link-type="dfn" href="#active" id="ref-for-active②">active</a>, behaves the same <code><var>stream</var>.<code class="idl"><a data-link-type="idl" href="#rs-cancel" id="ref-for-rs-cancel⑤">cancel</a></code>(<var>reason</var>)</code>. </p> <dt><code>{ <var>value</var>, <var>done</var> } = await <var>reader</var>.<code class="idl"><a data-link-type="idl" href="#byob-reader-read" id="ref-for-byob-reader-read⑤">read</a></code>(<var>view</var>[, { <code class="idl"><a data-link-type="idl" href="#dom-readablestreambyobreaderreadoptions-min" id="ref-for-dom-readablestreambyobreaderreadoptions-min①">min</a></code> }])</code> <dd> <p>Attempts to read bytes into <var>view</var>, and returns a promise resolved with the result: </p> <ul> <li>If the chunk does become available, the promise will be fulfilled with an object of the form <code class="highlight"><c- p>{</c-> value<c- o>:</c-> newView<c- p>,</c-> done<c- o>:</c-> <c- kc>false</c-> <c- p>}</c-></code>. In this case, <var>view</var> will be <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-detach" id="ref-for-dfn-detach">detached</a> and no longer usable, but <code>newView</code> will be a new view (of the same type) onto the same backing memory region, with the chunk’s data written into it. <li>If the stream becomes closed, the promise will be fulfilled with an object of the form <code class="highlight"><c- p>{</c-> value<c- o>:</c-> newView<c- p>,</c-> done<c- o>:</c-> <c- kc>true</c-> <c- p>}</c-></code>. In this case, <var>view</var> will be <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-detach" id="ref-for-dfn-detach①">detached</a> and no longer usable, but <code>newView</code> will be a new view (of the same type) onto the same backing memory region, with no modifications, to ensure the memory is returned to the caller. <li>If the reader is <a data-link-type="dfn" href="#cancel-a-readable-stream" id="ref-for-cancel-a-readable-stream①⓪">canceled</a>, the promise will be fulfilled with an object of the form <code class="highlight"><c- p>{</c-> value<c- o>:</c-> <c- kc>undefined</c-><c- p>,</c-> done<c- o>:</c-> <c- kc>true</c-> <c- p>}</c-></code>. In this case, the backing memory region of <var>view</var> is discarded and not returned to the caller. <li>If the stream becomes errored, the promise will be rejected with the relevant error. </ul> <p>If reading a chunk causes the queue to become empty, more data will be pulled from the <a data-link-type="dfn" href="#underlying-source" id="ref-for-underlying-source①①">underlying source</a>. </p> <p>If <code class="idl"><a data-link-type="idl" href="#dom-readablestreambyobreaderreadoptions-min" id="ref-for-dom-readablestreambyobreaderreadoptions-min②">min</a></code> is given, then the promise will only be fulfilled as soon as the given minimum number of elements are available. Here, the "number of elements" is given by <code>newView</code>’s <code>length</code> (for typed arrays) or <code>newView</code>’s <code>byteLength</code> (for <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-dataview-objects" id="ref-for-sec-dataview-objects">DataView</a></code>s). If the stream becomes closed, then the promise is fulfilled with the remaining elements in the stream, which might be fewer than the initially requested amount. If not given, then the promise resolves when at least one element is available. </p> <dt><code><var>reader</var>.<code class="idl"><a data-link-type="idl" href="#byob-reader-release-lock" id="ref-for-byob-reader-release-lock②">releaseLock</a></code>()</code> <dd> <p><a data-link-type="dfn" href="#release-a-lock" id="ref-for-release-a-lock④">Releases the reader’s lock</a> on the corresponding stream. After the lock is released, the reader is no longer <a data-link-type="dfn" href="#active" id="ref-for-active③">active</a>. If the associated stream is errored when the lock is released, the reader will appear errored in the same way from now on; otherwise, the reader will appear closed. </p> <p>If the reader’s lock is released while it still has pending read requests, then the promises returned by the reader’s <code class="idl"><a data-link-type="idl" href="#byob-reader-read" id="ref-for-byob-reader-read⑥">read()</a></code> method are immediately rejected with a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror⑨">TypeError</a></code>. Any unread chunks remain in the stream’s <a data-link-type="dfn" href="#internal-queues" id="ref-for-internal-queues⑥">internal queue</a> and can be read later by acquiring a new reader. </p> </dl> <div class="algorithm" data-algorithm="ReadableStreamBYOBReader(stream)" data-algorithm-for="ReadableStreamBYOBReader"> The <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableStreamBYOBReader" data-dfn-type="constructor" data-export data-lt="ReadableStreamBYOBReader(stream)|constructor(stream)" id="byob-reader-constructor"><code>new ReadableStreamBYOBReader(<var>stream</var>)</code></dfn> constructor steps are: <ol> <li data-md> <p>Perform ? <a data-link-type="abstract-op" href="#set-up-readable-stream-byob-reader" id="ref-for-set-up-readable-stream-byob-reader">SetUpReadableStreamBYOBReader</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this②②">this</a>, <var>stream</var>).</p> </ol> </div> <div class="algorithm" data-algorithm="read(view, options)" data-algorithm-for="ReadableStreamBYOBReader"> The <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableStreamBYOBReader" data-dfn-type="method" data-export data-lt="read(view, options)|read(view)" id="byob-reader-read"><code>read(<var>view</var>, <var>options</var>)</code></dfn> method steps are: <ol> <li data-md> <p>If <var>view</var>.[[ByteLength]] is 0, return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-rejected-with" id="ref-for-a-promise-rejected-with⑤">a promise rejected with</a> a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror①⓪">TypeError</a></code> exception.</p> <li data-md> <p>If <var>view</var>.[[ViewedArrayBuffer]].[[ArrayBufferByteLength]] is 0, return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-rejected-with" id="ref-for-a-promise-rejected-with⑥">a promise rejected with</a> a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror①①">TypeError</a></code> exception.</p> <li data-md> <p>If ! <a data-link-type="abstract-op" href="https://tc39.es/ecma262/multipage/structured-data.html#sec-isdetachedbuffer" id="ref-for-sec-isdetachedbuffer">IsDetachedBuffer</a>(<var>view</var>.[[ViewedArrayBuffer]]) is true, return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-rejected-with" id="ref-for-a-promise-rejected-with⑦">a promise rejected with</a> a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror①②">TypeError</a></code> exception.</p> <li data-md> <p>If <var>options</var>["<code class="idl"><a data-link-type="idl" href="#dom-readablestreambyobreaderreadoptions-min" id="ref-for-dom-readablestreambyobreaderreadoptions-min③">min</a></code>"] is 0, return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-rejected-with" id="ref-for-a-promise-rejected-with⑧">a promise rejected with</a> a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror①③">TypeError</a></code> exception.</p> <li data-md> <p>If <var>view</var> has a [[TypedArrayName]] internal slot,</p> <ol> <li data-md> <p>If <var>options</var>["<code class="idl"><a data-link-type="idl" href="#dom-readablestreambyobreaderreadoptions-min" id="ref-for-dom-readablestreambyobreaderreadoptions-min④">min</a></code>"] > <var>view</var>.[[ArrayLength]], return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-rejected-with" id="ref-for-a-promise-rejected-with⑨">a promise rejected with</a> a <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#exceptiondef-rangeerror" id="ref-for-exceptiondef-rangeerror①">RangeError</a></code> exception.</p> </ol> <li data-md> <p>Otherwise (i.e., it is a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-dataview-objects" id="ref-for-sec-dataview-objects①">DataView</a></code>),</p> <ol> <li data-md> <p>If <var>options</var>["<code class="idl"><a data-link-type="idl" href="#dom-readablestreambyobreaderreadoptions-min" id="ref-for-dom-readablestreambyobreaderreadoptions-min⑤">min</a></code>"] > <var>view</var>.[[ByteLength]], return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-rejected-with" id="ref-for-a-promise-rejected-with①⓪">a promise rejected with</a> a <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#exceptiondef-rangeerror" id="ref-for-exceptiondef-rangeerror②">RangeError</a></code> exception.</p> </ol> <li data-md> <p>If <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this②③">this</a>.<a data-link-type="dfn" href="#readablestreamgenericreader-stream" id="ref-for-readablestreamgenericreader-stream⑤">[[stream]]</a> is undefined, return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-rejected-with" id="ref-for-a-promise-rejected-with①①">a promise rejected with</a> a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror①④">TypeError</a></code> exception.</p> <li data-md> <p>Let <var>promise</var> be <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-new-promise" id="ref-for-a-new-promise②">a new promise</a>.</p> <li data-md> <p>Let <var>readIntoRequest</var> be a new <a data-link-type="dfn" href="#read-into-request" id="ref-for-read-into-request①">read-into request</a> with the following <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#struct-item" id="ref-for-struct-item④">items</a>:</p> <dl> <dt data-md><a data-link-type="dfn" href="#read-into-request-chunk-steps" id="ref-for-read-into-request-chunk-steps">chunk steps</a>, given <var>chunk</var> <dd data-md> <ol> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#resolve" id="ref-for-resolve④">Resolve</a> <var>promise</var> with «[ "<code class="idl"><a data-link-type="idl" href="#dom-readablestreamreadresult-value" id="ref-for-dom-readablestreamreadresult-value②">value</a></code>" → <var>chunk</var>, "<code class="idl"><a data-link-type="idl" href="#dom-readablestreamreadresult-done" id="ref-for-dom-readablestreamreadresult-done②">done</a></code>" → false ]».</p> </ol> <dt data-md><a data-link-type="dfn" href="#read-into-request-close-steps" id="ref-for-read-into-request-close-steps①">close steps</a>, given <var>chunk</var> <dd data-md> <ol> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#resolve" id="ref-for-resolve⑤">Resolve</a> <var>promise</var> with «[ "<code class="idl"><a data-link-type="idl" href="#dom-readablestreamreadresult-value" id="ref-for-dom-readablestreamreadresult-value③">value</a></code>" → <var>chunk</var>, "<code class="idl"><a data-link-type="idl" href="#dom-readablestreamreadresult-done" id="ref-for-dom-readablestreamreadresult-done③">done</a></code>" → true ]».</p> </ol> <dt data-md><a data-link-type="dfn" href="#read-into-request-error-steps" id="ref-for-read-into-request-error-steps">error steps</a>, given <var>e</var> <dd data-md> <ol> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#reject" id="ref-for-reject②">Reject</a> <var>promise</var> with <var>e</var>.</p> </ol> </dl> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-byob-reader-read" id="ref-for-readable-stream-byob-reader-read">ReadableStreamBYOBReaderRead</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this②④">this</a>, <var>view</var>, <var>options</var>["<code class="idl"><a data-link-type="idl" href="#dom-readablestreambyobreaderreadoptions-min" id="ref-for-dom-readablestreambyobreaderreadoptions-min⑥">min</a></code>"], <var>readIntoRequest</var>).</p> <li data-md> <p>Return <var>promise</var>.</p> </ol> </div> <div class="algorithm" data-algorithm="releaseLock()" data-algorithm-for="ReadableStreamBYOBReader"> The <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableStreamBYOBReader" data-dfn-type="method" data-export id="byob-reader-release-lock"><code>releaseLock()</code></dfn> method steps are: <ol> <li data-md> <p>If <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this②⑤">this</a>.<a data-link-type="dfn" href="#readablestreamgenericreader-stream" id="ref-for-readablestreamgenericreader-stream⑥">[[stream]]</a> is undefined, return.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#abstract-opdef-readablestreambyobreaderrelease" id="ref-for-abstract-opdef-readablestreambyobreaderrelease">ReadableStreamBYOBReaderRelease</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this②⑥">this</a>).</p> </ol> </div> <h3 class="heading settled" data-level="4.6" id="rs-default-controller-class"><span class="secno">4.6. </span><span class="content">The <code class="idl"><a data-link-type="idl" href="#readablestreamdefaultcontroller" id="ref-for-readablestreamdefaultcontroller③">ReadableStreamDefaultController</a></code> class</span><a class="self-link" href="#rs-default-controller-class"></a></h3> <p>The <code class="idl"><a data-link-type="idl" href="#readablestreamdefaultcontroller" id="ref-for-readablestreamdefaultcontroller④">ReadableStreamDefaultController</a></code> class has methods that allow control of a <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream②⑦">ReadableStream</a></code>'s state and <a data-link-type="dfn" href="#internal-queues" id="ref-for-internal-queues⑦">internal queue</a>. When constructing a <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream②⑧">ReadableStream</a></code> that is not a <a data-link-type="dfn" href="#readable-byte-stream" id="ref-for-readable-byte-stream⑥">readable byte stream</a>, the <a data-link-type="dfn" href="#underlying-source" id="ref-for-underlying-source①②">underlying source</a> is given a corresponding <code class="idl"><a data-link-type="idl" href="#readablestreamdefaultcontroller" id="ref-for-readablestreamdefaultcontroller⑤">ReadableStreamDefaultController</a></code> instance to manipulate.</p> <h4 class="heading settled" data-level="4.6.1" id="rs-default-controller-class-definition"><span class="secno">4.6.1. </span><span class="content">Interface definition</span><a class="self-link" href="#rs-default-controller-class-definition"></a></h4> <p>The Web IDL definition for the <code class="idl"><a data-link-type="idl" href="#readablestreamdefaultcontroller" id="ref-for-readablestreamdefaultcontroller⑥">ReadableStreamDefaultController</a></code> class is given as follows:</p> <pre class="idl highlight def">[Exposed=*] <c- b>interface</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="interface" data-export id="readablestreamdefaultcontroller"><code><c- g>ReadableStreamDefaultController</c-></code></dfn> { <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-unrestricted-double" id="ref-for-idl-unrestricted-double①"><c- b>unrestricted</c-> <c- b>double</c-></a>? <a class="idl-code" data-link-type="attribute" data-readonly data-type="unrestricted double?" href="#rs-default-controller-desired-size" id="ref-for-rs-default-controller-desired-size①"><c- g>desiredSize</c-></a>; <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined" id="ref-for-idl-undefined⑧"><c- b>undefined</c-></a> <a class="idl-code" data-link-type="method" href="#rs-default-controller-close" id="ref-for-rs-default-controller-close"><c- g>close</c-></a>(); <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined" id="ref-for-idl-undefined⑨"><c- b>undefined</c-></a> <a class="idl-code" data-link-type="method" href="#rs-default-controller-enqueue" id="ref-for-rs-default-controller-enqueue"><c- g>enqueue</c-></a>(<c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any" id="ref-for-idl-any⑦"><c- b>any</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableStreamDefaultController/enqueue(chunk), ReadableStreamDefaultController/enqueue()" data-dfn-type="argument" data-export id="dom-readablestreamdefaultcontroller-enqueue-chunk-chunk"><code><c- g>chunk</c-></code></dfn>); <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined" id="ref-for-idl-undefined①⓪"><c- b>undefined</c-></a> <a class="idl-code" data-link-type="method" href="#rs-default-controller-error" id="ref-for-rs-default-controller-error"><c- g>error</c-></a>(<c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any" id="ref-for-idl-any⑧"><c- b>any</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableStreamDefaultController/error(e), ReadableStreamDefaultController/error()" data-dfn-type="argument" data-export id="dom-readablestreamdefaultcontroller-error-e-e"><code><c- g>e</c-></code></dfn>); }; </pre> <h4 class="heading settled" data-level="4.6.2" id="rs-default-controller-internal-slots"><span class="secno">4.6.2. </span><span class="content">Internal slots</span><a class="self-link" href="#rs-default-controller-internal-slots"></a></h4> <p>Instances of <code class="idl"><a data-link-type="idl" href="#readablestreamdefaultcontroller" id="ref-for-readablestreamdefaultcontroller⑦">ReadableStreamDefaultController</a></code> are created with the internal slots described in the following table:</p> <table> <thead> <tr> <th>Internal Slot <th>Description (<em>non-normative</em>) <tbody> <tr> <td><dfn class="dfn-paneled" data-dfn-for="ReadableStreamDefaultController" data-dfn-type="dfn" data-noexport id="readablestreamdefaultcontroller-cancelalgorithm">[[cancelAlgorithm]]</dfn> <td class="non-normative">A promise-returning algorithm, taking one argument (the cancel reason), which communicates a requested cancelation to the <a data-link-type="dfn" href="#underlying-source" id="ref-for-underlying-source①③">underlying source</a> <tr> <td><dfn class="dfn-paneled" data-dfn-for="ReadableStreamDefaultController" data-dfn-type="dfn" data-noexport id="readablestreamdefaultcontroller-closerequested">[[closeRequested]]</dfn> <td class="non-normative">A boolean flag indicating whether the stream has been closed by its <a data-link-type="dfn" href="#underlying-source" id="ref-for-underlying-source①④">underlying source</a>, but still has <a data-link-type="dfn" href="#chunk" id="ref-for-chunk②⑨">chunks</a> in its internal queue that have not yet been read <tr> <td><dfn class="dfn-paneled" data-dfn-for="ReadableStreamDefaultController" data-dfn-type="dfn" data-noexport id="readablestreamdefaultcontroller-pullagain">[[pullAgain]]</dfn> <td class="non-normative">A boolean flag set to true if the stream’s mechanisms requested a call to the <a data-link-type="dfn" href="#underlying-source" id="ref-for-underlying-source①⑤">underlying source</a>'s pull algorithm to pull more data, but the pull could not yet be done since a previous call is still executing <tr> <td><dfn class="dfn-paneled" data-dfn-for="ReadableStreamDefaultController" data-dfn-type="dfn" data-noexport id="readablestreamdefaultcontroller-pullalgorithm">[[pullAlgorithm]]</dfn> <td class="non-normative">A promise-returning algorithm that pulls data from the <a data-link-type="dfn" href="#underlying-source" id="ref-for-underlying-source①⑥">underlying source</a> <tr> <td><dfn class="dfn-paneled" data-dfn-for="ReadableStreamDefaultController" data-dfn-type="dfn" data-noexport id="readablestreamdefaultcontroller-pulling">[[pulling]]</dfn> <td class="non-normative">A boolean flag set to true while the <a data-link-type="dfn" href="#underlying-source" id="ref-for-underlying-source①⑦">underlying source</a>'s pull algorithm is executing and the returned promise has not yet fulfilled, used to prevent reentrant calls <tr> <td><dfn class="dfn-paneled" data-dfn-for="ReadableStreamDefaultController" data-dfn-type="dfn" data-noexport id="readablestreamdefaultcontroller-queue">[[queue]]</dfn> <td class="non-normative">A <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list" id="ref-for-list②">list</a> representing the stream’s internal queue of <a data-link-type="dfn" href="#chunk" id="ref-for-chunk③⓪">chunks</a> <tr> <td><dfn class="dfn-paneled" data-dfn-for="ReadableStreamDefaultController" data-dfn-type="dfn" data-noexport id="readablestreamdefaultcontroller-queuetotalsize">[[queueTotalSize]]</dfn> <td class="non-normative">The total size of all the chunks stored in <a data-link-type="dfn" href="#readablestreamdefaultcontroller-queue" id="ref-for-readablestreamdefaultcontroller-queue">[[queue]]</a> (see <a href="#queue-with-sizes">§ 8.1 Queue-with-sizes</a>) <tr> <td><dfn class="dfn-paneled" data-dfn-for="ReadableStreamDefaultController" data-dfn-type="dfn" data-noexport id="readablestreamdefaultcontroller-started">[[started]]</dfn> <td class="non-normative">A boolean flag indicating whether the <a data-link-type="dfn" href="#underlying-source" id="ref-for-underlying-source①⑧">underlying source</a> has finished starting <tr> <td><dfn class="dfn-paneled" data-dfn-for="ReadableStreamDefaultController" data-dfn-type="dfn" data-noexport id="readablestreamdefaultcontroller-strategyhwm">[[strategyHWM]]</dfn> <td class="non-normative">A number supplied to the constructor as part of the stream’s <a data-link-type="dfn" href="#queuing-strategy" id="ref-for-queuing-strategy①">queuing strategy</a>, indicating the point at which the stream will apply <a data-link-type="dfn" href="#backpressure" id="ref-for-backpressure⑤">backpressure</a> to its <a data-link-type="dfn" href="#underlying-source" id="ref-for-underlying-source①⑨">underlying source</a> <tr> <td><dfn class="dfn-paneled" data-dfn-for="ReadableStreamDefaultController" data-dfn-type="dfn" data-noexport id="readablestreamdefaultcontroller-strategysizealgorithm">[[strategySizeAlgorithm]]</dfn> <td class="non-normative">An algorithm to calculate the size of enqueued <a data-link-type="dfn" href="#chunk" id="ref-for-chunk③①">chunks</a>, as part of the stream’s <a data-link-type="dfn" href="#queuing-strategy" id="ref-for-queuing-strategy②">queuing strategy</a> <tr> <td><dfn class="dfn-paneled" data-dfn-for="ReadableStreamDefaultController" data-dfn-type="dfn" data-noexport id="readablestreamdefaultcontroller-stream">[[stream]]</dfn> <td class="non-normative">The <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream②⑨">ReadableStream</a></code> instance controlled </table> <h4 class="heading settled" data-level="4.6.3" id="rs-default-controller-prototype"><span class="secno">4.6.3. </span><span class="content">Methods and properties</span><a class="self-link" href="#rs-default-controller-prototype"></a></h4> <dl class="domintro non-normative"> <dt><code><var>desiredSize</var> = <var>controller</var>.<code class="idl"><a data-link-type="idl" href="#rs-default-controller-desired-size" id="ref-for-rs-default-controller-desired-size②">desiredSize</a></code></code> <dd> <p>Returns the <a data-link-type="dfn" href="#desired-size-to-fill-a-streams-internal-queue" id="ref-for-desired-size-to-fill-a-streams-internal-queue②">desired size to fill the controlled stream’s internal queue</a>. It can be negative, if the queue is over-full. An <a data-link-type="dfn" href="#underlying-source" id="ref-for-underlying-source②⓪">underlying source</a> ought to use this information to determine when and how to apply <a data-link-type="dfn" href="#backpressure" id="ref-for-backpressure⑥">backpressure</a>. </p> <dt><code><var>controller</var>.<code class="idl"><a data-link-type="idl" href="#rs-default-controller-close" id="ref-for-rs-default-controller-close①">close</a></code>()</code> <dd> <p>Closes the controlled readable stream. <a data-link-type="dfn" href="#consumer" id="ref-for-consumer⑤">Consumers</a> will still be able to read any previously-enqueued <a data-link-type="dfn" href="#chunk" id="ref-for-chunk③②">chunks</a> from the stream, but once those are read, the stream will become closed. </p> <dt><code><var>controller</var>.<code class="idl"><a data-link-type="idl" href="#rs-default-controller-enqueue" id="ref-for-rs-default-controller-enqueue①">enqueue</a></code>(<var>chunk</var>)</code> <dd> <p>Enqueues the given <a data-link-type="dfn" href="#chunk" id="ref-for-chunk③③">chunk</a> <var>chunk</var> in the controlled readable stream. </p> <dt><code><var>controller</var>.<code class="idl"><a data-link-type="idl" href="#rs-default-controller-error" id="ref-for-rs-default-controller-error①">error</a></code>(<var>e</var>)</code> <dd> <p>Errors the controlled readable stream, making all future interactions with it fail with the given error <var>e</var>. </p> </dl> <div class="algorithm" data-algorithm="desiredSize" data-algorithm-for="ReadableStreamDefaultController"> The <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableStreamDefaultController" data-dfn-type="attribute" data-export id="rs-default-controller-desired-size"><code>desiredSize</code></dfn> getter steps are: <ol> <li data-md> <p>Return ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-get-desired-size" id="ref-for-readable-stream-default-controller-get-desired-size">ReadableStreamDefaultControllerGetDesiredSize</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this②⑦">this</a>).</p> </ol> </div> <div class="algorithm" data-algorithm="close()" data-algorithm-for="ReadableStreamDefaultController"> The <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableStreamDefaultController" data-dfn-type="method" data-export id="rs-default-controller-close"><code>close()</code></dfn> method steps are: <ol> <li data-md> <p>If ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-can-close-or-enqueue" id="ref-for-readable-stream-default-controller-can-close-or-enqueue">ReadableStreamDefaultControllerCanCloseOrEnqueue</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this②⑧">this</a>) is false, throw a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror①⑤">TypeError</a></code> exception.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-close" id="ref-for-readable-stream-default-controller-close">ReadableStreamDefaultControllerClose</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this②⑨">this</a>).</p> </ol> </div> <div class="algorithm" data-algorithm="enqueue(chunk)" data-algorithm-for="ReadableStreamDefaultController"> The <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableStreamDefaultController" data-dfn-type="method" data-export data-lt="enqueue(chunk)|enqueue()" id="rs-default-controller-enqueue"><code>enqueue(<var>chunk</var>)</code></dfn> method steps are: <ol> <li data-md> <p>If ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-can-close-or-enqueue" id="ref-for-readable-stream-default-controller-can-close-or-enqueue①">ReadableStreamDefaultControllerCanCloseOrEnqueue</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this③⓪">this</a>) is false, throw a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror①⑥">TypeError</a></code> exception.</p> <li data-md> <p>Perform ? <a data-link-type="abstract-op" href="#readable-stream-default-controller-enqueue" id="ref-for-readable-stream-default-controller-enqueue">ReadableStreamDefaultControllerEnqueue</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this③①">this</a>, <var>chunk</var>).</p> </ol> </div> <div class="algorithm" data-algorithm="error(e)" data-algorithm-for="ReadableStreamDefaultController"> The <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableStreamDefaultController" data-dfn-type="method" data-export data-lt="error(e)|error()" id="rs-default-controller-error"><code>error(<var>e</var>)</code></dfn> method steps are: <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-error" id="ref-for-readable-stream-default-controller-error">ReadableStreamDefaultControllerError</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this③②">this</a>, <var>e</var>).</p> </ol> </div> <h4 class="heading settled" data-level="4.6.4" id="rs-default-controller-internal-methods"><span class="secno">4.6.4. </span><span class="content">Internal methods</span><a class="self-link" href="#rs-default-controller-internal-methods"></a></h4> <p>The following are internal methods implemented by each <code class="idl"><a data-link-type="idl" href="#readablestreamdefaultcontroller" id="ref-for-readablestreamdefaultcontroller⑧">ReadableStreamDefaultController</a></code> instance. The readable stream implementation will polymorphically call to either these, or to their counterparts for BYOB controllers, as discussed in <a href="#rs-abstract-ops-used-by-controllers">§ 4.9.2 Interfacing with controllers</a>.</p> <div class="algorithm" data-algorithm="[[CancelSteps]]" data-algorithm-for="ReadableStreamDefaultController"> <dfn class="dfn-paneled" data-dfn-for="ReadableStreamDefaultController" data-dfn-type="abstract-op" data-export data-lt="[[CancelSteps]]" id="rs-default-controller-private-cancel">[[CancelSteps]](<var>reason</var>)</dfn> implements the <a data-link-type="abstract-op" href="#abstract-opdef-readablestreamcontroller-cancelsteps" id="ref-for-abstract-opdef-readablestreamcontroller-cancelsteps">[[CancelSteps]]</a> contract. It performs the following steps: <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#reset-queue" id="ref-for-reset-queue">ResetQueue</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this③③">this</a>).</p> <li data-md> <p>Let <var>result</var> be the result of performing <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this③④">this</a>.<a data-link-type="dfn" href="#readablestreamdefaultcontroller-cancelalgorithm" id="ref-for-readablestreamdefaultcontroller-cancelalgorithm">[[cancelAlgorithm]]</a>, passing <var>reason</var>.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-clear-algorithms" id="ref-for-readable-stream-default-controller-clear-algorithms">ReadableStreamDefaultControllerClearAlgorithms</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this③⑤">this</a>).</p> <li data-md> <p>Return <var>result</var>.</p> </ol> </div> <div class="algorithm" data-algorithm="[[PullSteps]]" data-algorithm-for="ReadableStreamDefaultController"> <dfn class="dfn-paneled" data-dfn-for="ReadableStreamDefaultController" data-dfn-type="abstract-op" data-export data-lt="[[PullSteps]]" id="rs-default-controller-private-pull">[[PullSteps]](<var>readRequest</var>)</dfn> implements the <a data-link-type="abstract-op" href="#abstract-opdef-readablestreamcontroller-pullsteps" id="ref-for-abstract-opdef-readablestreamcontroller-pullsteps">[[PullSteps]]</a> contract. It performs the following steps: <ol> <li data-md> <p>Let <var>stream</var> be <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this③⑥">this</a>.<a data-link-type="dfn" href="#readablestreamdefaultcontroller-stream" id="ref-for-readablestreamdefaultcontroller-stream">[[stream]]</a>.</p> <li data-md> <p>If <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this③⑦">this</a>.<a data-link-type="dfn" href="#readablestreamdefaultcontroller-queue" id="ref-for-readablestreamdefaultcontroller-queue①">[[queue]]</a> is not <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-is-empty" id="ref-for-list-is-empty①">empty</a>,</p> <ol> <li data-md> <p>Let <var>chunk</var> be ! <a data-link-type="abstract-op" href="#dequeue-value" id="ref-for-dequeue-value">DequeueValue</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this③⑧">this</a>).</p> <li data-md> <p>If <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this③⑨">this</a>.<a data-link-type="dfn" href="#readablestreamdefaultcontroller-closerequested" id="ref-for-readablestreamdefaultcontroller-closerequested">[[closeRequested]]</a> is true and <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this④⓪">this</a>.<a data-link-type="dfn" href="#readablestreamdefaultcontroller-queue" id="ref-for-readablestreamdefaultcontroller-queue②">[[queue]]</a> <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-is-empty" id="ref-for-list-is-empty②">is empty</a>,</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-clear-algorithms" id="ref-for-readable-stream-default-controller-clear-algorithms①">ReadableStreamDefaultControllerClearAlgorithms</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this④①">this</a>).</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-close" id="ref-for-readable-stream-close">ReadableStreamClose</a>(<var>stream</var>).</p> </ol> <li data-md> <p>Otherwise, perform ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-call-pull-if-needed" id="ref-for-readable-stream-default-controller-call-pull-if-needed">ReadableStreamDefaultControllerCallPullIfNeeded</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this④②">this</a>).</p> <li data-md> <p>Perform <var>readRequest</var>’s <a data-link-type="dfn" href="#read-request-chunk-steps" id="ref-for-read-request-chunk-steps②">chunk steps</a>, given <var>chunk</var>.</p> </ol> <li data-md> <p>Otherwise,</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-add-read-request" id="ref-for-readable-stream-add-read-request">ReadableStreamAddReadRequest</a>(<var>stream</var>, <var>readRequest</var>).</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-call-pull-if-needed" id="ref-for-readable-stream-default-controller-call-pull-if-needed①">ReadableStreamDefaultControllerCallPullIfNeeded</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this④③">this</a>).</p> </ol> </ol> </div> <div class="algorithm" data-algorithm="[[ReleaseSteps]]" data-algorithm-for="ReadableStreamDefaultController"> <dfn class="dfn-paneled" data-dfn-for="ReadableStreamDefaultController" data-dfn-type="abstract-op" data-export data-lt="[[ReleaseSteps]]" id="abstract-opdef-readablestreamdefaultcontroller-releasesteps">[[ReleaseSteps]]()</dfn> implements the <a data-link-type="abstract-op" href="#abstract-opdef-readablestreamcontroller-releasesteps" id="ref-for-abstract-opdef-readablestreamcontroller-releasesteps">[[ReleaseSteps]]</a> contract. It performs the following steps: <ol> <li data-md> <p>Return.</p> </ol> </div> <h3 class="heading settled" data-level="4.7" id="rbs-controller-class"><span class="secno">4.7. </span><span class="content">The <code class="idl"><a data-link-type="idl" href="#readablebytestreamcontroller" id="ref-for-readablebytestreamcontroller③">ReadableByteStreamController</a></code> class</span><a class="self-link" href="#rbs-controller-class"></a></h3> <p>The <code class="idl"><a data-link-type="idl" href="#readablebytestreamcontroller" id="ref-for-readablebytestreamcontroller④">ReadableByteStreamController</a></code> class has methods that allow control of a <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream③⓪">ReadableStream</a></code>'s state and <a data-link-type="dfn" href="#internal-queues" id="ref-for-internal-queues⑧">internal queue</a>. When constructing a <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream③①">ReadableStream</a></code> that is a <a data-link-type="dfn" href="#readable-byte-stream" id="ref-for-readable-byte-stream⑦">readable byte stream</a>, the <a data-link-type="dfn" href="#underlying-source" id="ref-for-underlying-source②①">underlying source</a> is given a corresponding <code class="idl"><a data-link-type="idl" href="#readablebytestreamcontroller" id="ref-for-readablebytestreamcontroller⑤">ReadableByteStreamController</a></code> instance to manipulate.</p> <h4 class="heading settled" data-level="4.7.1" id="rbs-controller-class-definition"><span class="secno">4.7.1. </span><span class="content">Interface definition</span><a class="self-link" href="#rbs-controller-class-definition"></a></h4> <p>The Web IDL definition for the <code class="idl"><a data-link-type="idl" href="#readablebytestreamcontroller" id="ref-for-readablebytestreamcontroller⑥">ReadableByteStreamController</a></code> class is given as follows:</p> <pre class="idl highlight def">[Exposed=*] <c- b>interface</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="interface" data-export id="readablebytestreamcontroller"><code><c- g>ReadableByteStreamController</c-></code></dfn> { <c- b>readonly</c-> <c- b>attribute</c-> <a data-link-type="idl-name" href="#readablestreambyobrequest" id="ref-for-readablestreambyobrequest"><c- n>ReadableStreamBYOBRequest</c-></a>? <a class="idl-code" data-link-type="attribute" data-readonly data-type="ReadableStreamBYOBRequest?" href="#rbs-controller-byob-request" id="ref-for-rbs-controller-byob-request①"><c- g>byobRequest</c-></a>; <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-unrestricted-double" id="ref-for-idl-unrestricted-double②"><c- b>unrestricted</c-> <c- b>double</c-></a>? <a class="idl-code" data-link-type="attribute" data-readonly data-type="unrestricted double?" href="#rbs-controller-desired-size" id="ref-for-rbs-controller-desired-size①"><c- g>desiredSize</c-></a>; <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined" id="ref-for-idl-undefined①①"><c- b>undefined</c-></a> <a class="idl-code" data-link-type="method" href="#rbs-controller-close" id="ref-for-rbs-controller-close"><c- g>close</c-></a>(); <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined" id="ref-for-idl-undefined①②"><c- b>undefined</c-></a> <a class="idl-code" data-link-type="method" href="#rbs-controller-enqueue" id="ref-for-rbs-controller-enqueue"><c- g>enqueue</c-></a>(<a data-link-type="idl-name" href="https://webidl.spec.whatwg.org/#ArrayBufferView" id="ref-for-ArrayBufferView①"><c- n>ArrayBufferView</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableByteStreamController/enqueue(chunk)" data-dfn-type="argument" data-export id="dom-readablebytestreamcontroller-enqueue-chunk-chunk"><code><c- g>chunk</c-></code></dfn>); <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined" id="ref-for-idl-undefined①③"><c- b>undefined</c-></a> <a class="idl-code" data-link-type="method" href="#rbs-controller-error" id="ref-for-rbs-controller-error"><c- g>error</c-></a>(<c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any" id="ref-for-idl-any⑨"><c- b>any</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableByteStreamController/error(e), ReadableByteStreamController/error()" data-dfn-type="argument" data-export id="dom-readablebytestreamcontroller-error-e-e"><code><c- g>e</c-></code></dfn>); }; </pre> <h4 class="heading settled" data-level="4.7.2" id="rbs-controller-internal-slots"><span class="secno">4.7.2. </span><span class="content">Internal slots</span><a class="self-link" href="#rbs-controller-internal-slots"></a></h4> <p>Instances of <code class="idl"><a data-link-type="idl" href="#readablebytestreamcontroller" id="ref-for-readablebytestreamcontroller⑦">ReadableByteStreamController</a></code> are created with the internal slots described in the following table:</p> <table> <thead> <tr> <th>Internal Slot <th>Description (<em>non-normative</em>) <tbody> <tr> <td><dfn class="dfn-paneled" data-dfn-for="ReadableByteStreamController" data-dfn-type="dfn" data-noexport id="readablebytestreamcontroller-autoallocatechunksize">[[autoAllocateChunkSize]]</dfn> <td class="non-normative">A positive integer, when the automatic buffer allocation feature is enabled. In that case, this value specifies the size of buffer to allocate. It is undefined otherwise. <tr> <td><dfn class="dfn-paneled" data-dfn-for="ReadableByteStreamController" data-dfn-type="dfn" data-noexport id="readablebytestreamcontroller-byobrequest">[[byobRequest]]</dfn> <td class="non-normative">A <code class="idl"><a data-link-type="idl" href="#readablestreambyobrequest" id="ref-for-readablestreambyobrequest①">ReadableStreamBYOBRequest</a></code> instance representing the current BYOB pull request, or null if there are no pending requests <tr> <td><dfn class="dfn-paneled" data-dfn-for="ReadableByteStreamController" data-dfn-type="dfn" data-noexport id="readablebytestreamcontroller-cancelalgorithm">[[cancelAlgorithm]]</dfn> <td class="non-normative">A promise-returning algorithm, taking one argument (the cancel reason), which communicates a requested cancelation to the <a data-link-type="dfn" href="#underlying-byte-source" id="ref-for-underlying-byte-source">underlying byte source</a> <tr> <td><dfn class="dfn-paneled" data-dfn-for="ReadableByteStreamController" data-dfn-type="dfn" data-noexport id="readablebytestreamcontroller-closerequested">[[closeRequested]]</dfn> <td class="non-normative">A boolean flag indicating whether the stream has been closed by its <a data-link-type="dfn" href="#underlying-byte-source" id="ref-for-underlying-byte-source①">underlying byte source</a>, but still has <a data-link-type="dfn" href="#chunk" id="ref-for-chunk③④">chunks</a> in its internal queue that have not yet been read <tr> <td><dfn class="dfn-paneled" data-dfn-for="ReadableByteStreamController" data-dfn-type="dfn" data-noexport id="readablebytestreamcontroller-pullagain">[[pullAgain]]</dfn> <td class="non-normative">A boolean flag set to true if the stream’s mechanisms requested a call to the <a data-link-type="dfn" href="#underlying-byte-source" id="ref-for-underlying-byte-source②">underlying byte source</a>'s pull algorithm to pull more data, but the pull could not yet be done since a previous call is still executing <tr> <td><dfn class="dfn-paneled" data-dfn-for="ReadableByteStreamController" data-dfn-type="dfn" data-noexport id="readablebytestreamcontroller-pullalgorithm">[[pullAlgorithm]]</dfn> <td class="non-normative">A promise-returning algorithm that pulls data from the <a data-link-type="dfn" href="#underlying-byte-source" id="ref-for-underlying-byte-source③">underlying byte source</a> <tr> <td><dfn class="dfn-paneled" data-dfn-for="ReadableByteStreamController" data-dfn-type="dfn" data-noexport id="readablebytestreamcontroller-pulling">[[pulling]]</dfn> <td class="non-normative">A boolean flag set to true while the <a data-link-type="dfn" href="#underlying-byte-source" id="ref-for-underlying-byte-source④">underlying byte source</a>'s pull algorithm is executing and the returned promise has not yet fulfilled, used to prevent reentrant calls <tr> <td><dfn class="dfn-paneled" data-dfn-for="ReadableByteStreamController" data-dfn-type="dfn" data-noexport id="readablebytestreamcontroller-pendingpullintos">[[pendingPullIntos]]</dfn> <td class="non-normative">A <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list" id="ref-for-list③">list</a> of <a data-link-type="dfn" href="#pull-into-descriptor" id="ref-for-pull-into-descriptor">pull-into descriptors</a> <tr> <td><dfn class="dfn-paneled" data-dfn-for="ReadableByteStreamController" data-dfn-type="dfn" data-noexport id="readablebytestreamcontroller-queue">[[queue]]</dfn> <td class="non-normative">A <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list" id="ref-for-list④">list</a> of <a data-link-type="dfn" href="#readable-byte-stream-queue-entry" id="ref-for-readable-byte-stream-queue-entry">readable byte stream queue entries</a> representing the stream’s internal queue of <a data-link-type="dfn" href="#chunk" id="ref-for-chunk③⑤">chunks</a> <tr> <td><dfn class="dfn-paneled" data-dfn-for="ReadableByteStreamController" data-dfn-type="dfn" data-noexport id="readablebytestreamcontroller-queuetotalsize">[[queueTotalSize]]</dfn> <td class="non-normative">The total size, in bytes, of all the chunks stored in <a data-link-type="dfn" href="#readablebytestreamcontroller-queue" id="ref-for-readablebytestreamcontroller-queue">[[queue]]</a> (see <a href="#queue-with-sizes">§ 8.1 Queue-with-sizes</a>) <tr> <td><dfn class="dfn-paneled" data-dfn-for="ReadableByteStreamController" data-dfn-type="dfn" data-noexport id="readablebytestreamcontroller-started">[[started]]</dfn> <td class="non-normative">A boolean flag indicating whether the <a data-link-type="dfn" href="#underlying-byte-source" id="ref-for-underlying-byte-source⑤">underlying byte source</a> has finished starting <tr> <td><dfn class="dfn-paneled" data-dfn-for="ReadableByteStreamController" data-dfn-type="dfn" data-noexport id="readablebytestreamcontroller-strategyhwm">[[strategyHWM]]</dfn> <td class="non-normative">A number supplied to the constructor as part of the stream’s <a data-link-type="dfn" href="#queuing-strategy" id="ref-for-queuing-strategy③">queuing strategy</a>, indicating the point at which the stream will apply <a data-link-type="dfn" href="#backpressure" id="ref-for-backpressure⑦">backpressure</a> to its <a data-link-type="dfn" href="#underlying-byte-source" id="ref-for-underlying-byte-source⑥">underlying byte source</a> <tr> <td><dfn class="dfn-paneled" data-dfn-for="ReadableByteStreamController" data-dfn-type="dfn" data-noexport id="readablebytestreamcontroller-stream">[[stream]]</dfn> <td class="non-normative">The <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream③②">ReadableStream</a></code> instance controlled </table> <div class="note" role="note"> <p>Although <code class="idl"><a data-link-type="idl" href="#readablebytestreamcontroller" id="ref-for-readablebytestreamcontroller⑧">ReadableByteStreamController</a></code> instances have <a data-link-type="dfn" href="#readablebytestreamcontroller-queue" id="ref-for-readablebytestreamcontroller-queue①">[[queue]]</a> and <a data-link-type="dfn" href="#readablebytestreamcontroller-queuetotalsize" id="ref-for-readablebytestreamcontroller-queuetotalsize">[[queueTotalSize]]</a> slots, we do not use most of the abstract operations in <a href="#queue-with-sizes">§ 8.1 Queue-with-sizes</a> on them, as the way in which we manipulate this queue is rather different than the others in the spec. Instead, we update the two slots together manually. </p> <p>This might be cleaned up in a future spec refactoring. </p> </div> <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="readable-byte-stream-queue-entry">readable byte stream queue entry</dfn> is a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#struct" id="ref-for-struct②">struct</a> encapsulating the important aspects of a <a data-link-type="dfn" href="#chunk" id="ref-for-chunk③⑥">chunk</a> for the specific case of <a data-link-type="dfn" href="#readable-byte-stream" id="ref-for-readable-byte-stream⑧">readable byte streams</a>. It has the following <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#struct-item" id="ref-for-struct-item⑤">items</a>:</p> <dl> <dt data-md><dfn class="dfn-paneled" data-dfn-for="readable byte stream queue entry" data-dfn-type="dfn" data-noexport id="readable-byte-stream-queue-entry-buffer">buffer</dfn> <dd data-md> <p>An <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-arraybuffer-objects" id="ref-for-sec-arraybuffer-objects③">ArrayBuffer</a></code>, which will be a <a href="#transfer-array-buffer" id="ref-for-transfer-array-buffer⑥">transferred</a> version of the one originally supplied by the <a data-link-type="dfn" href="#underlying-byte-source" id="ref-for-underlying-byte-source⑦">underlying byte source</a></p> <dt data-md><dfn class="dfn-paneled" data-dfn-for="readable byte stream queue entry" data-dfn-type="dfn" data-noexport id="readable-byte-stream-queue-entry-byte-offset">byte offset</dfn> <dd data-md> <p>A nonnegative integer number giving the byte offset derived from the view originally supplied by the <a data-link-type="dfn" href="#underlying-byte-source" id="ref-for-underlying-byte-source⑧">underlying byte source</a></p> <dt data-md><dfn class="dfn-paneled" data-dfn-for="readable byte stream queue entry" data-dfn-type="dfn" data-noexport id="readable-byte-stream-queue-entry-byte-length">byte length</dfn> <dd data-md> <p>A nonnegative integer number giving the byte length derived from the view originally supplied by the <a data-link-type="dfn" href="#underlying-byte-source" id="ref-for-underlying-byte-source⑨">underlying byte source</a></p> </dl> <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="pull-into-descriptor">pull-into descriptor</dfn> is a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#struct" id="ref-for-struct③">struct</a> used to represent pending BYOB pull requests. It has the following <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#struct-item" id="ref-for-struct-item⑥">items</a>:</p> <dl> <dt data-md><dfn class="dfn-paneled" data-dfn-for="pull-into descriptor" data-dfn-type="dfn" data-noexport id="pull-into-descriptor-buffer">buffer</dfn> <dd data-md> <p>An <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-arraybuffer-objects" id="ref-for-sec-arraybuffer-objects④">ArrayBuffer</a></code></p> <dt data-md><dfn class="dfn-paneled" data-dfn-for="pull-into descriptor" data-dfn-type="dfn" data-noexport id="pull-into-descriptor-buffer-byte-length">buffer byte length</dfn> <dd data-md> <p>A positive integer representing the initial byte length of <a data-link-type="dfn" href="#pull-into-descriptor-buffer" id="ref-for-pull-into-descriptor-buffer">buffer</a></p> <dt data-md><dfn class="dfn-paneled" data-dfn-for="pull-into descriptor" data-dfn-type="dfn" data-noexport id="pull-into-descriptor-byte-offset">byte offset</dfn> <dd data-md> <p>A nonnegative integer byte offset into the <a data-link-type="dfn" href="#pull-into-descriptor-buffer" id="ref-for-pull-into-descriptor-buffer①">buffer</a> where the <a data-link-type="dfn" href="#underlying-byte-source" id="ref-for-underlying-byte-source①⓪">underlying byte source</a> will start writing</p> <dt data-md><dfn class="dfn-paneled" data-dfn-for="pull-into descriptor" data-dfn-type="dfn" data-noexport id="pull-into-descriptor-byte-length">byte length</dfn> <dd data-md> <p>A positive integer number of bytes which can be written into the <a data-link-type="dfn" href="#pull-into-descriptor-buffer" id="ref-for-pull-into-descriptor-buffer②">buffer</a></p> <dt data-md><dfn class="dfn-paneled" data-dfn-for="pull-into descriptor" data-dfn-type="dfn" data-noexport id="pull-into-descriptor-bytes-filled">bytes filled</dfn> <dd data-md> <p>A nonnegative integer number of bytes that have been written into the <a data-link-type="dfn" href="#pull-into-descriptor-buffer" id="ref-for-pull-into-descriptor-buffer③">buffer</a> so far</p> <dt data-md><dfn class="dfn-paneled" data-dfn-for="pull-into descriptor" data-dfn-type="dfn" data-noexport id="pull-into-descriptor-minimum-fill">minimum fill</dfn> <dd data-md> <p>A positive integer representing the minimum number of bytes that must be written into the <a data-link-type="dfn" href="#pull-into-descriptor-buffer" id="ref-for-pull-into-descriptor-buffer④">buffer</a> before the associated <code class="idl"><a data-link-type="idl" href="#byob-reader-read" id="ref-for-byob-reader-read⑦">read()</a></code> request may be fulfilled. By default, this equals the <a data-link-type="dfn" href="#pull-into-descriptor-element-size" id="ref-for-pull-into-descriptor-element-size">element size</a>.</p> <dt data-md><dfn class="dfn-paneled" data-dfn-for="pull-into descriptor" data-dfn-type="dfn" data-noexport id="pull-into-descriptor-element-size">element size</dfn> <dd data-md> <p>A positive integer representing the number of bytes that can be written into the <a data-link-type="dfn" href="#pull-into-descriptor-buffer" id="ref-for-pull-into-descriptor-buffer⑤">buffer</a> at a time, using views of the type described by the <a data-link-type="dfn" href="#pull-into-descriptor-view-constructor" id="ref-for-pull-into-descriptor-view-constructor">view constructor</a></p> <dt data-md><dfn class="dfn-paneled" data-dfn-for="pull-into descriptor" data-dfn-type="dfn" data-noexport id="pull-into-descriptor-view-constructor">view constructor</dfn> <dd data-md> <p>A <a data-link-type="dfn" href="https://tc39.es/ecma262/#table-49" id="ref-for-table-49">typed array constructor</a> or <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/multipage/structured-data.html#sec-dataview-constructor" id="ref-for-sec-dataview-constructor">%DataView%</a></code>, which will be used for constructing a view with which to write into the <a data-link-type="dfn" href="#pull-into-descriptor-buffer" id="ref-for-pull-into-descriptor-buffer⑥">buffer</a></p> <dt data-md><dfn class="dfn-paneled" data-dfn-for="pull-into descriptor" data-dfn-type="dfn" data-noexport id="pull-into-descriptor-reader-type">reader type</dfn> <dd data-md> <p>Either "<code>default</code>" or "<code>byob</code>", indicating what type of <a data-link-type="dfn" href="#reader" id="ref-for-reader③">readable stream reader</a> initiated this request, or "<code>none</code>" if the initiating <a data-link-type="dfn" href="#reader" id="ref-for-reader④">reader</a> was <a data-link-type="dfn" href="#release-a-lock" id="ref-for-release-a-lock⑤">released</a></p> </dl> <h4 class="heading settled" data-level="4.7.3" id="rbs-controller-prototype"><span class="secno">4.7.3. </span><span class="content">Methods and properties</span><a class="self-link" href="#rbs-controller-prototype"></a></h4> <dl class="domintro non-normative"> <dt><code><var>byobRequest</var> = <var>controller</var>.<code class="idl"><a data-link-type="idl" href="#rbs-controller-byob-request" id="ref-for-rbs-controller-byob-request②">byobRequest</a></code></code> <dd> <p>Returns the current BYOB pull request, or null if there isn’t one. </p> <dt><code><var>desiredSize</var> = <var>controller</var>.<code class="idl"><a data-link-type="idl" href="#rbs-controller-desired-size" id="ref-for-rbs-controller-desired-size②">desiredSize</a></code></code> <dd> <p>Returns the <a data-link-type="dfn" href="#desired-size-to-fill-a-streams-internal-queue" id="ref-for-desired-size-to-fill-a-streams-internal-queue③">desired size to fill the controlled stream’s internal queue</a>. It can be negative, if the queue is over-full. An <a data-link-type="dfn" href="#underlying-byte-source" id="ref-for-underlying-byte-source①①">underlying byte source</a> ought to use this information to determine when and how to apply <a data-link-type="dfn" href="#backpressure" id="ref-for-backpressure⑧">backpressure</a>. </p> <dt><code><var>controller</var>.<code class="idl"><a data-link-type="idl" href="#rbs-controller-close" id="ref-for-rbs-controller-close①">close</a></code>()</code> <dd> <p>Closes the controlled readable stream. <a data-link-type="dfn" href="#consumer" id="ref-for-consumer⑥">Consumers</a> will still be able to read any previously-enqueued <a data-link-type="dfn" href="#chunk" id="ref-for-chunk③⑦">chunks</a> from the stream, but once those are read, the stream will become closed. </p> <dt><code><var>controller</var>.<code class="idl"><a data-link-type="idl" href="#rbs-controller-enqueue" id="ref-for-rbs-controller-enqueue①">enqueue</a></code>(<var>chunk</var>)</code> <dd> <p>Enqueues the given <a data-link-type="dfn" href="#chunk" id="ref-for-chunk③⑧">chunk</a> <var>chunk</var> in the controlled readable stream. The chunk has to be an <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#ArrayBufferView" id="ref-for-ArrayBufferView②">ArrayBufferView</a></code> instance, or else a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror①⑦">TypeError</a></code> will be thrown. </p> <dt><code><var>controller</var>.<code class="idl"><a data-link-type="idl" href="#rbs-controller-error" id="ref-for-rbs-controller-error①">error</a></code>(<var>e</var>)</code> <dd> <p>Errors the controlled readable stream, making all future interactions with it fail with the given error <var>e</var>. </p> </dl> <div class="algorithm" data-algorithm="byobRequest" data-algorithm-for="ReadableByteStreamController"> The <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableByteStreamController" data-dfn-type="attribute" data-export id="rbs-controller-byob-request"><code>byobRequest</code></dfn> getter steps are: <ol> <li data-md> <p>Return ! <a data-link-type="abstract-op" href="#abstract-opdef-readablebytestreamcontrollergetbyobrequest" id="ref-for-abstract-opdef-readablebytestreamcontrollergetbyobrequest">ReadableByteStreamControllerGetBYOBRequest</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this④④">this</a>).</p> </ol> </div> <div class="algorithm" data-algorithm="desiredSize" data-algorithm-for="ReadableByteStreamController"> The <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableByteStreamController" data-dfn-type="attribute" data-export id="rbs-controller-desired-size"><code>desiredSize</code></dfn> getter steps are: <ol> <li data-md> <p>Return ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-get-desired-size" id="ref-for-readable-byte-stream-controller-get-desired-size">ReadableByteStreamControllerGetDesiredSize</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this④⑤">this</a>).</p> </ol> </div> <div class="algorithm" data-algorithm="close()" data-algorithm-for="ReadableByteStreamController"> The <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableByteStreamController" data-dfn-type="method" data-export id="rbs-controller-close"><code>close()</code></dfn> method steps are: <ol> <li data-md> <p>If <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this④⑥">this</a>.<a data-link-type="dfn" href="#readablebytestreamcontroller-closerequested" id="ref-for-readablebytestreamcontroller-closerequested">[[closeRequested]]</a> is true, throw a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror①⑧">TypeError</a></code> exception.</p> <li data-md> <p>If <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this④⑦">this</a>.<a data-link-type="dfn" href="#readablebytestreamcontroller-stream" id="ref-for-readablebytestreamcontroller-stream">[[stream]]</a>.<a data-link-type="dfn" href="#readablestream-state" id="ref-for-readablestream-state">[[state]]</a> is not "<code>readable</code>", throw a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror①⑨">TypeError</a></code> exception.</p> <li data-md> <p>Perform ? <a data-link-type="abstract-op" href="#readable-byte-stream-controller-close" id="ref-for-readable-byte-stream-controller-close">ReadableByteStreamControllerClose</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this④⑧">this</a>).</p> </ol> </div> <div class="algorithm" data-algorithm="enqueue(chunk)" data-algorithm-for="ReadableByteStreamController"> The <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableByteStreamController" data-dfn-type="method" data-export id="rbs-controller-enqueue"><code>enqueue(<var>chunk</var>)</code></dfn> method steps are: <ol> <li data-md> <p>If <var>chunk</var>.[[ByteLength]] is 0, throw a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror②⓪">TypeError</a></code> exception.</p> <li data-md> <p>If <var>chunk</var>.[[ViewedArrayBuffer]].[[ArrayBufferByteLength]] is 0, throw a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror②①">TypeError</a></code> exception.</p> <li data-md> <p>If <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this④⑨">this</a>.<a data-link-type="dfn" href="#readablebytestreamcontroller-closerequested" id="ref-for-readablebytestreamcontroller-closerequested①">[[closeRequested]]</a> is true, throw a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror②②">TypeError</a></code> exception.</p> <li data-md> <p>If <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑤⓪">this</a>.<a data-link-type="dfn" href="#readablebytestreamcontroller-stream" id="ref-for-readablebytestreamcontroller-stream①">[[stream]]</a>.<a data-link-type="dfn" href="#readablestream-state" id="ref-for-readablestream-state①">[[state]]</a> is not "<code>readable</code>", throw a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror②③">TypeError</a></code> exception.</p> <li data-md> <p>Return ? <a data-link-type="abstract-op" href="#readable-byte-stream-controller-enqueue" id="ref-for-readable-byte-stream-controller-enqueue">ReadableByteStreamControllerEnqueue</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑤①">this</a>, <var>chunk</var>).</p> </ol> </div> <div class="algorithm" data-algorithm="error(e)" data-algorithm-for="ReadableByteStreamController"> The <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableByteStreamController" data-dfn-type="method" data-export data-lt="error(e)|error()" id="rbs-controller-error"><code>error(<var>e</var>)</code></dfn> method steps are: <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-error" id="ref-for-readable-byte-stream-controller-error">ReadableByteStreamControllerError</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑤②">this</a>, <var>e</var>).</p> </ol> </div> <h4 class="heading settled" data-level="4.7.4" id="rbs-controller-internal-methods"><span class="secno">4.7.4. </span><span class="content">Internal methods</span><a class="self-link" href="#rbs-controller-internal-methods"></a></h4> <p>The following are internal methods implemented by each <code class="idl"><a data-link-type="idl" href="#readablebytestreamcontroller" id="ref-for-readablebytestreamcontroller⑨">ReadableByteStreamController</a></code> instance. The readable stream implementation will polymorphically call to either these, or to their counterparts for default controllers, as discussed in <a href="#rs-abstract-ops-used-by-controllers">§ 4.9.2 Interfacing with controllers</a>.</p> <div class="algorithm" data-algorithm="[[CancelSteps]]" data-algorithm-for="ReadableByteStreamController"> <dfn class="dfn-paneled" data-dfn-for="ReadableByteStreamController" data-dfn-type="abstract-op" data-export data-lt="[[CancelSteps]]" id="rbs-controller-private-cancel">[[CancelSteps]](<var>reason</var>)</dfn> implements the <a data-link-type="abstract-op" href="#abstract-opdef-readablestreamcontroller-cancelsteps" id="ref-for-abstract-opdef-readablestreamcontroller-cancelsteps①">[[CancelSteps]]</a> contract. It performs the following steps: <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-clear-pending-pull-intos" id="ref-for-readable-byte-stream-controller-clear-pending-pull-intos">ReadableByteStreamControllerClearPendingPullIntos</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑤③">this</a>).</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#reset-queue" id="ref-for-reset-queue①">ResetQueue</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑤④">this</a>).</p> <li data-md> <p>Let <var>result</var> be the result of performing <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑤⑤">this</a>.<a data-link-type="dfn" href="#readablebytestreamcontroller-cancelalgorithm" id="ref-for-readablebytestreamcontroller-cancelalgorithm">[[cancelAlgorithm]]</a>, passing in <var>reason</var>.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-clear-algorithms" id="ref-for-readable-byte-stream-controller-clear-algorithms">ReadableByteStreamControllerClearAlgorithms</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑤⑥">this</a>).</p> <li data-md> <p>Return <var>result</var>.</p> </ol> </div> <div class="algorithm" data-algorithm="[[PullSteps]]" data-algorithm-for="ReadableByteStreamController"> <dfn class="dfn-paneled" data-dfn-for="ReadableByteStreamController" data-dfn-type="abstract-op" data-export data-lt="[[PullSteps]]" id="rbs-controller-private-pull">[[PullSteps]](<var>readRequest</var>)</dfn> implements the <a data-link-type="abstract-op" href="#abstract-opdef-readablestreamcontroller-pullsteps" id="ref-for-abstract-opdef-readablestreamcontroller-pullsteps①">[[PullSteps]]</a> contract. It performs the following steps: <ol> <li data-md> <p>Let <var>stream</var> be <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑤⑦">this</a>.<a data-link-type="dfn" href="#readablebytestreamcontroller-stream" id="ref-for-readablebytestreamcontroller-stream②">[[stream]]</a>.</p> <li data-md> <p class="assertion">Assert: ! <a data-link-type="abstract-op" href="#readable-stream-has-default-reader" id="ref-for-readable-stream-has-default-reader">ReadableStreamHasDefaultReader</a>(<var>stream</var>) is true.</p> <li data-md> <p>If <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑤⑧">this</a>.<a data-link-type="dfn" href="#readablebytestreamcontroller-queuetotalsize" id="ref-for-readablebytestreamcontroller-queuetotalsize①">[[queueTotalSize]]</a> > 0,</p> <ol> <li data-md> <p class="assertion">Assert: ! <a data-link-type="abstract-op" href="#readable-stream-get-num-read-requests" id="ref-for-readable-stream-get-num-read-requests">ReadableStreamGetNumReadRequests</a>(<var>stream</var>) is 0.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#abstract-opdef-readablebytestreamcontrollerfillreadrequestfromqueue" id="ref-for-abstract-opdef-readablebytestreamcontrollerfillreadrequestfromqueue">ReadableByteStreamControllerFillReadRequestFromQueue</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑤⑨">this</a>, <var>readRequest</var>).</p> <li data-md> <p>Return.</p> </ol> <li data-md> <p>Let <var>autoAllocateChunkSize</var> be <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑥⓪">this</a>.<a data-link-type="dfn" href="#readablebytestreamcontroller-autoallocatechunksize" id="ref-for-readablebytestreamcontroller-autoallocatechunksize">[[autoAllocateChunkSize]]</a>.</p> <li data-md> <p>If <var>autoAllocateChunkSize</var> is not undefined,</p> <ol> <li data-md> <p>Let <var>buffer</var> be <a data-link-type="abstract-op" href="https://tc39.es/ecma262/multipage/abstract-operations.html#sec-construct" id="ref-for-sec-construct">Construct</a>(<code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/multipage/structured-data.html#sec-arraybuffer-constructor" id="ref-for-sec-arraybuffer-constructor">%ArrayBuffer%</a></code>, « <var>autoAllocateChunkSize</var> »).</p> <li data-md> <p>If <var>buffer</var> is an abrupt completion,</p> <ol> <li data-md> <p>Perform <var>readRequest</var>’s <a data-link-type="dfn" href="#read-request-error-steps" id="ref-for-read-request-error-steps②">error steps</a>, given <var>buffer</var>.[[Value]].</p> <li data-md> <p>Return.</p> </ol> <li data-md> <p>Let <var>pullIntoDescriptor</var> be a new <a data-link-type="dfn" href="#pull-into-descriptor" id="ref-for-pull-into-descriptor①">pull-into descriptor</a> with</p> <dl class="props"> <dt><a data-link-type="dfn" href="#pull-into-descriptor-buffer" id="ref-for-pull-into-descriptor-buffer⑦">buffer</a> <dd><var>buffer</var>.[[Value]] <dt><a data-link-type="dfn" href="#pull-into-descriptor-buffer-byte-length" id="ref-for-pull-into-descriptor-buffer-byte-length">buffer byte length</a> <dd><var>autoAllocateChunkSize</var> <dt><a data-link-type="dfn" href="#pull-into-descriptor-byte-offset" id="ref-for-pull-into-descriptor-byte-offset">byte offset</a> <dd>0 <dt><a data-link-type="dfn" href="#pull-into-descriptor-byte-length" id="ref-for-pull-into-descriptor-byte-length">byte length</a> <dd><var>autoAllocateChunkSize</var> <dt><a data-link-type="dfn" href="#pull-into-descriptor-bytes-filled" id="ref-for-pull-into-descriptor-bytes-filled">bytes filled</a> <dd>0 <dt><a data-link-type="dfn" href="#pull-into-descriptor-minimum-fill" id="ref-for-pull-into-descriptor-minimum-fill">minimum fill</a> <dd>1 <dt><a data-link-type="dfn" href="#pull-into-descriptor-element-size" id="ref-for-pull-into-descriptor-element-size①">element size</a> <dd>1 <dt><a data-link-type="dfn" href="#pull-into-descriptor-view-constructor" id="ref-for-pull-into-descriptor-view-constructor①">view constructor</a> <dd><code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/multipage/indexed-collections.html#sec-typedarray-objects" id="ref-for-sec-typedarray-objects②">%Uint8Array%</a></code> <dt><a data-link-type="dfn" href="#pull-into-descriptor-reader-type" id="ref-for-pull-into-descriptor-reader-type">reader type</a> <dd>"<code>default</code>" </dl> <li data-md> <p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-append" id="ref-for-list-append">Append</a> <var>pullIntoDescriptor</var> to <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑥①">this</a>.<a data-link-type="dfn" href="#readablebytestreamcontroller-pendingpullintos" id="ref-for-readablebytestreamcontroller-pendingpullintos">[[pendingPullIntos]]</a>.</p> </ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-add-read-request" id="ref-for-readable-stream-add-read-request①">ReadableStreamAddReadRequest</a>(<var>stream</var>, <var>readRequest</var>).</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-call-pull-if-needed" id="ref-for-readable-byte-stream-controller-call-pull-if-needed">ReadableByteStreamControllerCallPullIfNeeded</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑥②">this</a>).</p> </ol> </div> <div class="algorithm" data-algorithm="[[ReleaseSteps]]" data-algorithm-for="ReadableByteStreamController"> <dfn class="dfn-paneled" data-dfn-for="ReadableByteStreamController" data-dfn-type="abstract-op" data-export data-lt="[[ReleaseSteps]]" id="abstract-opdef-readablebytestreamcontroller-releasesteps">[[ReleaseSteps]]()</dfn> implements the <a data-link-type="abstract-op" href="#abstract-opdef-readablestreamcontroller-releasesteps" id="ref-for-abstract-opdef-readablestreamcontroller-releasesteps①">[[ReleaseSteps]]</a> contract. It performs the following steps: <ol> <li data-md> <p>If <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑥③">this</a>.<a data-link-type="dfn" href="#readablebytestreamcontroller-pendingpullintos" id="ref-for-readablebytestreamcontroller-pendingpullintos①">[[pendingPullIntos]]</a> is not <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-is-empty" id="ref-for-list-is-empty③">empty</a>,</p> <ol> <li data-md> <p>Let <var>firstPendingPullInto</var> be <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑥④">this</a>.<a data-link-type="dfn" href="#readablebytestreamcontroller-pendingpullintos" id="ref-for-readablebytestreamcontroller-pendingpullintos②">[[pendingPullIntos]]</a>[0].</p> <li data-md> <p>Set <var>firstPendingPullInto</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-reader-type" id="ref-for-pull-into-descriptor-reader-type①">reader type</a> to "<code>none</code>".</p> <li data-md> <p>Set <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑥⑤">this</a>.<a data-link-type="dfn" href="#readablebytestreamcontroller-pendingpullintos" id="ref-for-readablebytestreamcontroller-pendingpullintos③">[[pendingPullIntos]]</a> to the <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list" id="ref-for-list⑤">list</a> « <var>firstPendingPullInto</var> ».</p> </ol> </ol> </div> <h3 class="heading settled" data-level="4.8" id="rs-byob-request-class"><span class="secno">4.8. </span><span class="content">The <code class="idl"><a data-link-type="idl" href="#readablestreambyobrequest" id="ref-for-readablestreambyobrequest②">ReadableStreamBYOBRequest</a></code> class</span><a class="self-link" href="#rs-byob-request-class"></a></h3> <p>The <code class="idl"><a data-link-type="idl" href="#readablestreambyobrequest" id="ref-for-readablestreambyobrequest③">ReadableStreamBYOBRequest</a></code> class represents a pull-into request in a <code class="idl"><a data-link-type="idl" href="#readablebytestreamcontroller" id="ref-for-readablebytestreamcontroller①⓪">ReadableByteStreamController</a></code>.</p> <h4 class="heading settled" data-level="4.8.1" id="rs-byob-request-class-definition"><span class="secno">4.8.1. </span><span class="content">Interface definition</span><a class="self-link" href="#rs-byob-request-class-definition"></a></h4> <p>The Web IDL definition for the <code class="idl"><a data-link-type="idl" href="#readablestreambyobrequest" id="ref-for-readablestreambyobrequest④">ReadableStreamBYOBRequest</a></code> class is given as follows:</p> <pre class="idl highlight def">[Exposed=*] <c- b>interface</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="interface" data-export id="readablestreambyobrequest"><code><c- g>ReadableStreamBYOBRequest</c-></code></dfn> { <c- b>readonly</c-> <c- b>attribute</c-> <a data-link-type="idl-name" href="https://webidl.spec.whatwg.org/#ArrayBufferView" id="ref-for-ArrayBufferView③"><c- n>ArrayBufferView</c-></a>? <a class="idl-code" data-link-type="attribute" data-readonly data-type="ArrayBufferView?" href="#rs-byob-request-view" id="ref-for-rs-byob-request-view"><c- g>view</c-></a>; <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined" id="ref-for-idl-undefined①④"><c- b>undefined</c-></a> <a class="idl-code" data-link-type="method" href="#rs-byob-request-respond" id="ref-for-rs-byob-request-respond"><c- g>respond</c-></a>([<a class="idl-code" data-link-type="extended-attribute" href="https://webidl.spec.whatwg.org/#EnforceRange" id="ref-for-EnforceRange②"><c- g>EnforceRange</c-></a>] <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-unsigned-long-long" id="ref-for-idl-unsigned-long-long③"><c- b>unsigned</c-> <c- b>long</c-> <c- b>long</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableStreamBYOBRequest/respond(bytesWritten)" data-dfn-type="argument" data-export id="dom-readablestreambyobrequest-respond-byteswritten-byteswritten"><code><c- g>bytesWritten</c-></code></dfn>); <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined" id="ref-for-idl-undefined①⑤"><c- b>undefined</c-></a> <a class="idl-code" data-link-type="method" href="#rs-byob-request-respond-with-new-view" id="ref-for-rs-byob-request-respond-with-new-view"><c- g>respondWithNewView</c-></a>(<a data-link-type="idl-name" href="https://webidl.spec.whatwg.org/#ArrayBufferView" id="ref-for-ArrayBufferView④"><c- n>ArrayBufferView</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableStreamBYOBRequest/respondWithNewView(view)" data-dfn-type="argument" data-export id="dom-readablestreambyobrequest-respondwithnewview-view-view"><code><c- g>view</c-></code></dfn>); }; </pre> <h4 class="heading settled" data-level="4.8.2" id="rs-byob-request-internal-slots"><span class="secno">4.8.2. </span><span class="content">Internal slots</span><a class="self-link" href="#rs-byob-request-internal-slots"></a></h4> <p>Instances of <code class="idl"><a data-link-type="idl" href="#readablestreambyobrequest" id="ref-for-readablestreambyobrequest⑤">ReadableStreamBYOBRequest</a></code> are created with the internal slots described in the following table:</p> <table> <thead> <tr> <th>Internal Slot <th>Description (<em>non-normative</em>) <tbody> <tr> <td><dfn class="dfn-paneled" data-dfn-for="ReadableStreamBYOBRequest" data-dfn-type="dfn" data-noexport id="readablestreambyobrequest-controller">[[controller]]</dfn> <td class="non-normative">The parent <code class="idl"><a data-link-type="idl" href="#readablebytestreamcontroller" id="ref-for-readablebytestreamcontroller①①">ReadableByteStreamController</a></code> instance <tr> <td><dfn class="dfn-paneled" data-dfn-for="ReadableStreamBYOBRequest" data-dfn-type="dfn" data-noexport id="readablestreambyobrequest-view">[[view]]</dfn> <td class="non-normative">A <a data-link-type="dfn" href="https://tc39.es/ecma262/#sec-typedarray-objects" id="ref-for-sec-typedarray-objects③">typed array</a> representing the destination region to which the controller can write generated data, or null after the BYOB request has been invalidated. </table> <h4 class="heading settled" data-level="4.8.3" id="rs-byob-request-prototype"><span class="secno">4.8.3. </span><span class="content">Methods and properties</span><a class="self-link" href="#rs-byob-request-prototype"></a></h4> <dl class="domintro non-normative"> <dt><code><var>view</var> = <var>byobRequest</var>.<code class="idl"><a data-link-type="idl" href="#rs-byob-request-view" id="ref-for-rs-byob-request-view①">view</a></code></code> <dd> <p>Returns the view for writing in to, or null if the BYOB request has already been responded to. </p> <dt><code><var>byobRequest</var>.<code class="idl"><a data-link-type="idl" href="#rs-byob-request-respond" id="ref-for-rs-byob-request-respond①">respond</a></code>(<var>bytesWritten</var>)</code> <dd> <p>Indicates to the associated <a data-link-type="dfn" href="#readable-byte-stream" id="ref-for-readable-byte-stream⑨">readable byte stream</a> that <var>bytesWritten</var> bytes were written into <code class="idl"><a data-link-type="idl" href="#rs-byob-request-view" id="ref-for-rs-byob-request-view②">view</a></code>, causing the result be surfaced to the <a data-link-type="dfn" href="#consumer" id="ref-for-consumer⑦">consumer</a>. </p> <p>After this method is called, <code class="idl"><a data-link-type="idl" href="#rs-byob-request-view" id="ref-for-rs-byob-request-view③">view</a></code> will be <a href="#transfer-array-buffer" id="ref-for-transfer-array-buffer⑦">transferred</a> and no longer modifiable. </p> <dt><code><var>byobRequest</var>.<code class="idl"><a data-link-type="idl" href="#rs-byob-request-respond-with-new-view" id="ref-for-rs-byob-request-respond-with-new-view①">respondWithNewView</a></code>(<var>view</var>)</code> <dd> <p>Indicates to the associated <a data-link-type="dfn" href="#readable-byte-stream" id="ref-for-readable-byte-stream①⓪">readable byte stream</a> that instead of writing into <code class="idl"><a data-link-type="idl" href="#rs-byob-request-view" id="ref-for-rs-byob-request-view④">view</a></code>, the <a data-link-type="dfn" href="#underlying-byte-source" id="ref-for-underlying-byte-source①②">underlying byte source</a> is providing a new <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#ArrayBufferView" id="ref-for-ArrayBufferView⑤">ArrayBufferView</a></code>, which will be given to the <a data-link-type="dfn" href="#consumer" id="ref-for-consumer⑧">consumer</a> of the <a data-link-type="dfn" href="#readable-byte-stream" id="ref-for-readable-byte-stream①①">readable byte stream</a>. </p> <p>The new <var>view</var> has to be a view onto the same backing memory region as <code class="idl"><a data-link-type="idl" href="#rs-byob-request-view" id="ref-for-rs-byob-request-view⑤">view</a></code>, i.e. its buffer has to equal (or be a <a href="#transfer-array-buffer" id="ref-for-transfer-array-buffer⑧">transferred</a> version of) <code class="idl"><a data-link-type="idl" href="#rs-byob-request-view" id="ref-for-rs-byob-request-view⑥">view</a></code>'s buffer. Its <code>byteOffset</code> has to equal <code class="idl"><a data-link-type="idl" href="#rs-byob-request-view" id="ref-for-rs-byob-request-view⑦">view</a></code>'s <code>byteOffset</code>, and its <code>byteLength</code> (representing the number of bytes written) has to be less than or equal to that of <code class="idl"><a data-link-type="idl" href="#rs-byob-request-view" id="ref-for-rs-byob-request-view⑧">view</a></code>. </p> <p>After this method is called, <var>view</var> will be <a href="#transfer-array-buffer" id="ref-for-transfer-array-buffer⑨">transferred</a> and no longer modifiable. </p> </dl> <div class="algorithm" data-algorithm="view" data-algorithm-for="ReadableStreamBYOBRequest"> The <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableStreamBYOBRequest" data-dfn-type="attribute" data-export id="rs-byob-request-view"><code>view</code></dfn> getter steps are: <ol> <li data-md> <p>Return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑥⑥">this</a>.<a data-link-type="dfn" href="#readablestreambyobrequest-view" id="ref-for-readablestreambyobrequest-view">[[view]]</a>.</p> </ol> </div> <div class="algorithm" data-algorithm="respond(bytesWritten)" data-algorithm-for="ReadableStreamBYOBRequest"> The <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableStreamBYOBRequest" data-dfn-type="method" data-export id="rs-byob-request-respond"><code>respond(<var>bytesWritten</var>)</code></dfn> method steps are: <ol> <li data-md> <p>If <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑥⑦">this</a>.<a data-link-type="dfn" href="#readablestreambyobrequest-controller" id="ref-for-readablestreambyobrequest-controller">[[controller]]</a> is undefined, throw a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror②④">TypeError</a></code> exception.</p> <li data-md> <p>If ! <a data-link-type="abstract-op" href="https://tc39.es/ecma262/multipage/structured-data.html#sec-isdetachedbuffer" id="ref-for-sec-isdetachedbuffer①">IsDetachedBuffer</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑥⑧">this</a>.<a data-link-type="dfn" href="#readablestreambyobrequest-view" id="ref-for-readablestreambyobrequest-view①">[[view]]</a>.[[ArrayBuffer]]) is true, throw a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror②⑤">TypeError</a></code> exception.</p> <li data-md> <p class="assertion">Assert: <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑥⑨">this</a>.<a data-link-type="dfn" href="#readablestreambyobrequest-view" id="ref-for-readablestreambyobrequest-view②">[[view]]</a>.[[ByteLength]] > 0.</p> <li data-md> <p class="assertion">Assert: <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑦⓪">this</a>.<a data-link-type="dfn" href="#readablestreambyobrequest-view" id="ref-for-readablestreambyobrequest-view③">[[view]]</a>.[[ViewedArrayBuffer]].[[ByteLength]] > 0.</p> <li data-md> <p>Perform ? <a data-link-type="abstract-op" href="#readable-byte-stream-controller-respond" id="ref-for-readable-byte-stream-controller-respond">ReadableByteStreamControllerRespond</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑦①">this</a>.<a data-link-type="dfn" href="#readablestreambyobrequest-controller" id="ref-for-readablestreambyobrequest-controller①">[[controller]]</a>, <var>bytesWritten</var>).</p> </ol> </div> <div class="algorithm" data-algorithm="respondWithNewView(view)" data-algorithm-for="ReadableStreamBYOBRequest"> The <dfn class="dfn-paneled idl-code" data-dfn-for="ReadableStreamBYOBRequest" data-dfn-type="method" data-export id="rs-byob-request-respond-with-new-view"><code>respondWithNewView(<var>view</var>)</code></dfn> method steps are: <ol> <li data-md> <p>If <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑦②">this</a>.<a data-link-type="dfn" href="#readablestreambyobrequest-controller" id="ref-for-readablestreambyobrequest-controller②">[[controller]]</a> is undefined, throw a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror②⑥">TypeError</a></code> exception.</p> <li data-md> <p>If ! <a data-link-type="abstract-op" href="https://tc39.es/ecma262/multipage/structured-data.html#sec-isdetachedbuffer" id="ref-for-sec-isdetachedbuffer②">IsDetachedBuffer</a>(<var>view</var>.[[ViewedArrayBuffer]]) is true, throw a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror②⑦">TypeError</a></code> exception.</p> <li data-md> <p>Return ? <a data-link-type="abstract-op" href="#readable-byte-stream-controller-respond-with-new-view" id="ref-for-readable-byte-stream-controller-respond-with-new-view">ReadableByteStreamControllerRespondWithNewView</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑦③">this</a>.<a data-link-type="dfn" href="#readablestreambyobrequest-controller" id="ref-for-readablestreambyobrequest-controller③">[[controller]]</a>, <var>view</var>).</p> </ol> </div> <h3 class="heading settled" data-level="4.9" id="rs-all-abstract-ops"><span class="secno">4.9. </span><span class="content">Abstract operations</span><a class="self-link" href="#rs-all-abstract-ops"></a></h3> <h4 class="heading settled" data-level="4.9.1" id="rs-abstract-ops"><span class="secno">4.9.1. </span><span class="content">Working with readable streams</span><a class="self-link" href="#rs-abstract-ops"></a></h4> <p>The following abstract operations operate on <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream③③">ReadableStream</a></code> instances at a higher level.</p> <div class="algorithm" data-algorithm="AcquireReadableStreamBYOBReader"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="AcquireReadableStreamBYOBReader" id="acquire-readable-stream-byob-reader">AcquireReadableStreamBYOBReader(<var>stream</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>reader</var> be a <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#new" id="ref-for-new③">new</a> <code class="idl"><a data-link-type="idl" href="#readablestreambyobreader" id="ref-for-readablestreambyobreader①⓪">ReadableStreamBYOBReader</a></code>.</p> <li data-md> <p>Perform ? <a data-link-type="abstract-op" href="#set-up-readable-stream-byob-reader" id="ref-for-set-up-readable-stream-byob-reader①">SetUpReadableStreamBYOBReader</a>(<var>reader</var>, <var>stream</var>).</p> <li data-md> <p>Return <var>reader</var>.</p> </ol> </div> <div class="algorithm" data-algorithm="AcquireReadableStreamDefaultReader"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="AcquireReadableStreamDefaultReader" id="acquire-readable-stream-reader">AcquireReadableStreamDefaultReader(<var>stream</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>reader</var> be a <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#new" id="ref-for-new④">new</a> <code class="idl"><a data-link-type="idl" href="#readablestreamdefaultreader" id="ref-for-readablestreamdefaultreader①⓪">ReadableStreamDefaultReader</a></code>.</p> <li data-md> <p>Perform ? <a data-link-type="abstract-op" href="#set-up-readable-stream-default-reader" id="ref-for-set-up-readable-stream-default-reader①">SetUpReadableStreamDefaultReader</a>(<var>reader</var>, <var>stream</var>).</p> <li data-md> <p>Return <var>reader</var>.</p> </ol> </div> <div class="algorithm" data-algorithm="CreateReadableStream"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="CreateReadableStream" id="create-readable-stream">CreateReadableStream(<var>startAlgorithm</var>, <var>pullAlgorithm</var>, <var>cancelAlgorithm</var>[, <var>highWaterMark</var>, [, <var>sizeAlgorithm</var>]])</dfn> performs the following steps: <ol> <li data-md> <p>If <var>highWaterMark</var> was not passed, set it to 1.</p> <li data-md> <p>If <var>sizeAlgorithm</var> was not passed, set it to an algorithm that returns 1.</p> <li data-md> <p class="assertion">Assert: ! <a data-link-type="abstract-op" href="#is-non-negative-number" id="ref-for-is-non-negative-number">IsNonNegativeNumber</a>(<var>highWaterMark</var>) is true.</p> <li data-md> <p>Let <var>stream</var> be a <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#new" id="ref-for-new⑤">new</a> <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream③④">ReadableStream</a></code>.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#initialize-readable-stream" id="ref-for-initialize-readable-stream①">InitializeReadableStream</a>(<var>stream</var>).</p> <li data-md> <p>Let <var>controller</var> be a <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#new" id="ref-for-new⑥">new</a> <code class="idl"><a data-link-type="idl" href="#readablestreamdefaultcontroller" id="ref-for-readablestreamdefaultcontroller⑨">ReadableStreamDefaultController</a></code>.</p> <li data-md> <p>Perform ? <a data-link-type="abstract-op" href="#set-up-readable-stream-default-controller" id="ref-for-set-up-readable-stream-default-controller">SetUpReadableStreamDefaultController</a>(<var>stream</var>, <var>controller</var>, <var>startAlgorithm</var>, <var>pullAlgorithm</var>, <var>cancelAlgorithm</var>, <var>highWaterMark</var>, <var>sizeAlgorithm</var>).</p> <li data-md> <p>Return <var>stream</var>.</p> </ol> <p class="note" role="note">This abstract operation will throw an exception if and only if the supplied <var>startAlgorithm</var> throws. </p> </div> <div class="algorithm" data-algorithm="CreateReadableByteStream"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="CreateReadableByteStream" id="abstract-opdef-createreadablebytestream">CreateReadableByteStream(<var>startAlgorithm</var>, <var>pullAlgorithm</var>, <var>cancelAlgorithm</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>stream</var> be a <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#new" id="ref-for-new⑦">new</a> <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream③⑤">ReadableStream</a></code>.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#initialize-readable-stream" id="ref-for-initialize-readable-stream②">InitializeReadableStream</a>(<var>stream</var>).</p> <li data-md> <p>Let <var>controller</var> be a <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#new" id="ref-for-new⑧">new</a> <code class="idl"><a data-link-type="idl" href="#readablebytestreamcontroller" id="ref-for-readablebytestreamcontroller①②">ReadableByteStreamController</a></code>.</p> <li data-md> <p>Perform ? <a data-link-type="abstract-op" href="#set-up-readable-byte-stream-controller" id="ref-for-set-up-readable-byte-stream-controller">SetUpReadableByteStreamController</a>(<var>stream</var>, <var>controller</var>, <var>startAlgorithm</var>, <var>pullAlgorithm</var>, <var>cancelAlgorithm</var>, 0, undefined).</p> <li data-md> <p>Return <var>stream</var>.</p> </ol> <p class="note" role="note">This abstract operation will throw an exception if and only if the supplied <var>startAlgorithm</var> throws. </p> </div> <div class="algorithm" data-algorithm="InitializeReadableStream"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="InitializeReadableStream" id="initialize-readable-stream">InitializeReadableStream(<var>stream</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Set <var>stream</var>.<a data-link-type="dfn" href="#readablestream-state" id="ref-for-readablestream-state②">[[state]]</a> to "<code>readable</code>".</p> <li data-md> <p>Set <var>stream</var>.<a data-link-type="dfn" href="#readablestream-reader" id="ref-for-readablestream-reader">[[reader]]</a> and <var>stream</var>.<a data-link-type="dfn" href="#readablestream-storederror" id="ref-for-readablestream-storederror">[[storedError]]</a> to undefined.</p> <li data-md> <p>Set <var>stream</var>.<a data-link-type="dfn" href="#readablestream-disturbed" id="ref-for-readablestream-disturbed">[[disturbed]]</a> to false.</p> </ol> </div> <div class="algorithm" data-algorithm="IsReadableStreamLocked"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="IsReadableStreamLocked" id="is-readable-stream-locked">IsReadableStreamLocked(<var>stream</var>)</dfn> performs the following steps: <ol> <li data-md> <p>If <var>stream</var>.<a data-link-type="dfn" href="#readablestream-reader" id="ref-for-readablestream-reader①">[[reader]]</a> is undefined, return false.</p> <li data-md> <p>Return true.</p> </ol> </div> <div class="algorithm" data-algorithm="ReadableStreamFromIterable"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableStreamFromIterable" id="readable-stream-from-iterable"> ReadableStreamFromIterable(<var>asyncIterable</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>stream</var> be undefined.</p> <li data-md> <p>Let <var>iteratorRecord</var> be ? <a data-link-type="abstract-op" href="https://tc39.es/ecma262/multipage/abstract-operations.html#sec-getiterator" id="ref-for-sec-getiterator">GetIterator</a>(<var>asyncIterable</var>, async).</p> <li data-md> <p>Let <var>startAlgorithm</var> be an algorithm that returns undefined.</p> <li data-md> <p>Let <var>pullAlgorithm</var> be the following steps:</p> <ol> <li data-md> <p>Let <var>nextResult</var> be <a data-link-type="abstract-op" href="https://tc39.es/ecma262/multipage/abstract-operations.html#sec-iteratornext" id="ref-for-sec-iteratornext">IteratorNext</a>(<var>iteratorRecord</var>).</p> <li data-md> <p>If <var>nextResult</var> is an abrupt completion, return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-rejected-with" id="ref-for-a-promise-rejected-with①②">a promise rejected with</a> <var>nextResult</var>.[[Value]].</p> <li data-md> <p>Let <var>nextPromise</var> be <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-resolved-with" id="ref-for-a-promise-resolved-with①">a promise resolved with</a> <var>nextResult</var>.[[Value]].</p> <li data-md> <p>Return the result of <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-perform-steps-once-promise-is-settled" id="ref-for-dfn-perform-steps-once-promise-is-settled">reacting</a> to <var>nextPromise</var> with the following fulfillment steps, given <var>iterResult</var>:</p> <ol> <li data-md> <p>If <var>iterResult</var> <a data-link-type="dfn" href="https://tc39.es/ecma262/#sec-object-type" id="ref-for-sec-object-type">is not an Object</a>, throw a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror②⑧">TypeError</a></code>.</p> <li data-md> <p>Let <var>done</var> be ? <a data-link-type="abstract-op" href="https://tc39.es/ecma262/multipage/abstract-operations.html#sec-iteratorcomplete" id="ref-for-sec-iteratorcomplete">IteratorComplete</a>(<var>iterResult</var>).</p> <li data-md> <p>If <var>done</var> is true:</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-close" id="ref-for-readable-stream-default-controller-close①">ReadableStreamDefaultControllerClose</a>(<var>stream</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller">[[controller]]</a>).</p> </ol> <li data-md> <p>Otherwise:</p> <ol> <li data-md> <p>Let <var>value</var> be ? <a data-link-type="abstract-op" href="https://tc39.es/ecma262/multipage/abstract-operations.html#sec-iteratorvalue" id="ref-for-sec-iteratorvalue">IteratorValue</a>(<var>iterResult</var>).</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-enqueue" id="ref-for-readable-stream-default-controller-enqueue①">ReadableStreamDefaultControllerEnqueue</a>(<var>stream</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller①">[[controller]]</a>, <var>value</var>).</p> </ol> </ol> </ol> <li data-md> <p>Let <var>cancelAlgorithm</var> be the following steps, given <var>reason</var>:</p> <ol> <li data-md> <p>Let <var>iterator</var> be <var>iteratorRecord</var>.[[Iterator]].</p> <li data-md> <p>Let <var>returnMethod</var> be <a data-link-type="abstract-op" href="https://tc39.es/ecma262/multipage/abstract-operations.html#sec-getmethod" id="ref-for-sec-getmethod">GetMethod</a>(<var>iterator</var>, "<code>return</code>").</p> <li data-md> <p>If <var>returnMethod</var> is an abrupt completion, return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-rejected-with" id="ref-for-a-promise-rejected-with①③">a promise rejected with</a> <var>returnMethod</var>.[[Value]].</p> <li data-md> <p>If <var>returnMethod</var>.[[Value]] is undefined, return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-resolved-with" id="ref-for-a-promise-resolved-with②">a promise resolved with</a> undefined.</p> <li data-md> <p>Let <var>returnResult</var> be <a data-link-type="abstract-op" href="https://tc39.es/ecma262/multipage/abstract-operations.html#sec-call" id="ref-for-sec-call">Call</a>(<var>returnMethod</var>.[[Value]], <var>iterator</var>, « <var>reason</var> »).</p> <li data-md> <p>If <var>returnResult</var> is an abrupt completion, return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-rejected-with" id="ref-for-a-promise-rejected-with①④">a promise rejected with</a> <var>returnResult</var>.[[Value]].</p> <li data-md> <p>Let <var>returnPromise</var> be <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-resolved-with" id="ref-for-a-promise-resolved-with③">a promise resolved with</a> <var>returnResult</var>.[[Value]].</p> <li data-md> <p>Return the result of <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-perform-steps-once-promise-is-settled" id="ref-for-dfn-perform-steps-once-promise-is-settled①">reacting</a> to <var>returnPromise</var> with the following fulfillment steps, given <var>iterResult</var>:</p> <ol> <li data-md> <p>If <var>iterResult</var> <a data-link-type="dfn" href="https://tc39.es/ecma262/#sec-object-type" id="ref-for-sec-object-type①">is not an Object</a>, throw a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror②⑨">TypeError</a></code>.</p> <li data-md> <p>Return undefined.</p> </ol> </ol> <li data-md> <p>Set <var>stream</var> to ! <a data-link-type="abstract-op" href="#create-readable-stream" id="ref-for-create-readable-stream">CreateReadableStream</a>(<var>startAlgorithm</var>, <var>pullAlgorithm</var>, <var>cancelAlgorithm</var>, 0).</p> <li data-md> <p>Return <var>stream</var>.</p> </ol> </div> <div class="algorithm" data-algorithm="ReadableStreamPipeTo"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableStreamPipeTo" id="readable-stream-pipe-to">ReadableStreamPipeTo(<var>source</var>, <var>dest</var>, <var>preventClose</var>, <var>preventAbort</var>, <var>preventCancel</var>[, <var>signal</var>])</dfn> performs the following steps: <ol> <li data-md> <p class="assertion">Assert: <var>source</var> <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#implements" id="ref-for-implements">implements</a> <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream③⑥">ReadableStream</a></code>.</p> <li data-md> <p class="assertion">Assert: <var>dest</var> <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#implements" id="ref-for-implements①">implements</a> <code class="idl"><a data-link-type="idl" href="#writablestream" id="ref-for-writablestream⑦">WritableStream</a></code>.</p> <li data-md> <p class="assertion">Assert: <var>preventClose</var>, <var>preventAbort</var>, and <var>preventCancel</var> are all booleans.</p> <li data-md> <p>If <var>signal</var> was not given, let <var>signal</var> be undefined.</p> <li data-md> <p class="assertion">Assert: either <var>signal</var> is undefined, or <var>signal</var> <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#implements" id="ref-for-implements②">implements</a> <code class="idl"><a data-link-type="idl" href="https://dom.spec.whatwg.org/#abortsignal" id="ref-for-abortsignal③">AbortSignal</a></code>.</p> <li data-md> <p class="assertion">Assert: ! <a data-link-type="abstract-op" href="#is-readable-stream-locked" id="ref-for-is-readable-stream-locked⑤">IsReadableStreamLocked</a>(<var>source</var>) is false.</p> <li data-md> <p class="assertion">Assert: ! <a data-link-type="abstract-op" href="#is-writable-stream-locked" id="ref-for-is-writable-stream-locked②">IsWritableStreamLocked</a>(<var>dest</var>) is false.</p> <li data-md> <p>If <var>source</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller②">[[controller]]</a> <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#implements" id="ref-for-implements③">implements</a> <code class="idl"><a data-link-type="idl" href="#readablebytestreamcontroller" id="ref-for-readablebytestreamcontroller①③">ReadableByteStreamController</a></code>, let <var>reader</var> be either ! <a data-link-type="abstract-op" href="#acquire-readable-stream-byob-reader" id="ref-for-acquire-readable-stream-byob-reader①">AcquireReadableStreamBYOBReader</a>(<var>source</var>) or ! <a data-link-type="abstract-op" href="#acquire-readable-stream-reader" id="ref-for-acquire-readable-stream-reader②">AcquireReadableStreamDefaultReader</a>(<var>source</var>), at the user agent’s discretion.</p> <li data-md> <p>Otherwise, let <var>reader</var> be ! <a data-link-type="abstract-op" href="#acquire-readable-stream-reader" id="ref-for-acquire-readable-stream-reader③">AcquireReadableStreamDefaultReader</a>(<var>source</var>).</p> <li data-md> <p>Let <var>writer</var> be ! <a data-link-type="abstract-op" href="#acquire-writable-stream-default-writer" id="ref-for-acquire-writable-stream-default-writer">AcquireWritableStreamDefaultWriter</a>(<var>dest</var>).</p> <li data-md> <p>Set <var>source</var>.<a data-link-type="dfn" href="#readablestream-disturbed" id="ref-for-readablestream-disturbed①">[[disturbed]]</a> to true.</p> <li data-md> <p>Let <var>shuttingDown</var> be false.</p> <li data-md> <p>Let <var>promise</var> be <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-new-promise" id="ref-for-a-new-promise③">a new promise</a>.</p> <li data-md> <p>If <var>signal</var> is not undefined,</p> <ol> <li data-md> <p>Let <var>abortAlgorithm</var> be the following steps:</p> <ol> <li data-md> <p>Let <var>error</var> be <var>signal</var>’s <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#abortsignal-abort-reason" id="ref-for-abortsignal-abort-reason">abort reason</a>.</p> <li data-md> <p>Let <var>actions</var> be an empty <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ordered-set" id="ref-for-ordered-set">ordered set</a>.</p> <li data-md> <p>If <var>preventAbort</var> is false, <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#set-append" id="ref-for-set-append">append</a> the following action to <var>actions</var>:</p> <ol> <li data-md> <p>If <var>dest</var>.<a data-link-type="dfn" href="#writablestream-state" id="ref-for-writablestream-state">[[state]]</a> is "<code>writable</code>", return ! <a data-link-type="abstract-op" href="#writable-stream-abort" id="ref-for-writable-stream-abort">WritableStreamAbort</a>(<var>dest</var>, <var>error</var>).</p> <li data-md> <p>Otherwise, return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-resolved-with" id="ref-for-a-promise-resolved-with④">a promise resolved with</a> undefined.</p> </ol> <li data-md> <p>If <var>preventCancel</var> is false, <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#set-append" id="ref-for-set-append①">append</a> the following action action to <var>actions</var>:</p> <ol> <li data-md> <p>If <var>source</var>.<a data-link-type="dfn" href="#readablestream-state" id="ref-for-readablestream-state③">[[state]]</a> is "<code>readable</code>", return ! <a data-link-type="abstract-op" href="#readable-stream-cancel" id="ref-for-readable-stream-cancel①">ReadableStreamCancel</a>(<var>source</var>, <var>error</var>).</p> <li data-md> <p>Otherwise, return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-resolved-with" id="ref-for-a-promise-resolved-with⑤">a promise resolved with</a> undefined.</p> </ol> <li data-md> <p><a data-link-type="dfn" href="#rs-pipeTo-shutdown-with-action" id="ref-for-rs-pipeTo-shutdown-with-action">Shutdown with an action</a> consisting of <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#waiting-for-all-promise" id="ref-for-waiting-for-all-promise">getting a promise to wait for all</a> of the actions in <var>actions</var>, and with <var>error</var>.</p> </ol> <li data-md> <p>If <var>signal</var> is <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#abortsignal-aborted" id="ref-for-abortsignal-aborted">aborted</a>, perform <var>abortAlgorithm</var> and return <var>promise</var>.</p> <li data-md> <p><a data-link-type="dfn" href="https://dom.spec.whatwg.org/#abortsignal-add" id="ref-for-abortsignal-add">Add</a> <var>abortAlgorithm</var> to <var>signal</var>.</p> </ol> <li data-md> <p><a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/infrastructure.html#in-parallel" id="ref-for-in-parallel">In parallel</a> <span class="XXX">but not really; see <a href="https://github.com/whatwg/streams/issues/905">#905</a></span>, using <var>reader</var> and <var>writer</var>, read all <a data-link-type="dfn" href="#chunk" id="ref-for-chunk③⑨">chunks</a> from <var>source</var> and write them to <var>dest</var>. Due to the locking provided by the reader and writer, the exact manner in which this happens is not observable to author code, and so there is flexibility in how this is done. The following constraints apply regardless of the exact algorithm used:</p> <ul> <li data-md> <p><strong>Public API must not be used:</strong> while reading or writing, or performing any of the operations below, the JavaScript-modifiable reader, writer, and stream APIs (i.e. methods on the appropriate prototypes) must not be used. Instead, the streams must be manipulated directly.</p> <li data-md> <p><strong>Backpressure must be enforced:</strong></p> <ul> <li data-md> <p>While <a data-link-type="abstract-op" href="#writable-stream-default-writer-get-desired-size" id="ref-for-writable-stream-default-writer-get-desired-size">WritableStreamDefaultWriterGetDesiredSize</a>(<var>writer</var>) is ≤ 0 or is null, the user agent must not read from <var>reader</var>.</p> <li data-md> <p>If <var>reader</var> is a <a data-link-type="dfn" href="#byob-reader" id="ref-for-byob-reader⑥">BYOB reader</a>, <a data-link-type="abstract-op" href="#writable-stream-default-writer-get-desired-size" id="ref-for-writable-stream-default-writer-get-desired-size①">WritableStreamDefaultWriterGetDesiredSize</a>(<var>writer</var>) should be used as a basis to determine the size of the chunks read from <var>reader</var>.</p> <p class="note" role="note">It’s frequently inefficient to read chunks that are too small or too large. Other information might be factored in to determine the optimal chunk size. </p> <li data-md> <p>Reads or writes should not be delayed for reasons other than these backpressure signals.</p> <p class="example" id="example-bad-backpressure"><a class="self-link" href="#example-bad-backpressure"></a>An implementation that waits for each write to successfully complete before proceeding to the next read/write operation violates this recommendation. In doing so, such an implementation makes the <a data-link-type="dfn" href="#internal-queues" id="ref-for-internal-queues⑨">internal queue</a> of <var>dest</var> useless, as it ensures <var>dest</var> always contains at most one queued <a data-link-type="dfn" href="#chunk" id="ref-for-chunk④⓪">chunk</a>. </p> </ul> <li data-md> <p><strong>Shutdown must stop activity:</strong> if <var>shuttingDown</var> becomes true, the user agent must not initiate further reads from <var>reader</var>, and must only perform writes of already-read <a data-link-type="dfn" href="#chunk" id="ref-for-chunk④①">chunks</a>, as described below. In particular, the user agent must check the below conditions before performing any reads or writes, since they might lead to immediate shutdown.</p> <li data-md> <p><strong>Error and close states must be propagated:</strong> the following conditions must be applied in order.</p> <ol> <li data-md> <p><strong>Errors must be propagated forward:</strong> if <var>source</var>.<a data-link-type="dfn" href="#readablestream-state" id="ref-for-readablestream-state④">[[state]]</a> is or becomes "<code>errored</code>", then</p> <ol> <li data-md> <p>If <var>preventAbort</var> is false, <a data-link-type="dfn" href="#rs-pipeTo-shutdown-with-action" id="ref-for-rs-pipeTo-shutdown-with-action①">shutdown with an action</a> of ! <a data-link-type="abstract-op" href="#writable-stream-abort" id="ref-for-writable-stream-abort①">WritableStreamAbort</a>(<var>dest</var>, <var>source</var>.<a data-link-type="dfn" href="#readablestream-storederror" id="ref-for-readablestream-storederror①">[[storedError]]</a>) and with <var>source</var>.<a data-link-type="dfn" href="#readablestream-storederror" id="ref-for-readablestream-storederror②">[[storedError]]</a>.</p> <li data-md> <p>Otherwise, <a data-link-type="dfn" href="#rs-pipeTo-shutdown" id="ref-for-rs-pipeTo-shutdown">shutdown</a> with <var>source</var>.<a data-link-type="dfn" href="#readablestream-storederror" id="ref-for-readablestream-storederror③">[[storedError]]</a>.</p> </ol> <li data-md> <p><strong>Errors must be propagated backward:</strong> if <var>dest</var>.<a data-link-type="dfn" href="#writablestream-state" id="ref-for-writablestream-state①">[[state]]</a> is or becomes "<code>errored</code>", then</p> <ol> <li data-md> <p>If <var>preventCancel</var> is false, <a data-link-type="dfn" href="#rs-pipeTo-shutdown-with-action" id="ref-for-rs-pipeTo-shutdown-with-action②">shutdown with an action</a> of ! <a data-link-type="abstract-op" href="#readable-stream-cancel" id="ref-for-readable-stream-cancel②">ReadableStreamCancel</a>(<var>source</var>, <var>dest</var>.<a data-link-type="dfn" href="#writablestream-storederror" id="ref-for-writablestream-storederror">[[storedError]]</a>) and with <var>dest</var>.<a data-link-type="dfn" href="#writablestream-storederror" id="ref-for-writablestream-storederror①">[[storedError]]</a>.</p> <li data-md> <p>Otherwise, <a data-link-type="dfn" href="#rs-pipeTo-shutdown" id="ref-for-rs-pipeTo-shutdown①">shutdown</a> with <var>dest</var>.<a data-link-type="dfn" href="#writablestream-storederror" id="ref-for-writablestream-storederror②">[[storedError]]</a>.</p> </ol> <li data-md> <p><strong>Closing must be propagated forward:</strong> if <var>source</var>.<a data-link-type="dfn" href="#readablestream-state" id="ref-for-readablestream-state⑤">[[state]]</a> is or becomes "<code>closed</code>", then</p> <ol> <li data-md> <p>If <var>preventClose</var> is false, <a data-link-type="dfn" href="#rs-pipeTo-shutdown-with-action" id="ref-for-rs-pipeTo-shutdown-with-action③">shutdown with an action</a> of ! <a data-link-type="abstract-op" href="#writable-stream-default-writer-close-with-error-propagation" id="ref-for-writable-stream-default-writer-close-with-error-propagation">WritableStreamDefaultWriterCloseWithErrorPropagation</a>(<var>writer</var>).</p> <li data-md> <p>Otherwise, <a data-link-type="dfn" href="#rs-pipeTo-shutdown" id="ref-for-rs-pipeTo-shutdown②">shutdown</a>.</p> </ol> <li data-md> <p><strong>Closing must be propagated backward:</strong> if ! <a data-link-type="abstract-op" href="#writable-stream-close-queued-or-in-flight" id="ref-for-writable-stream-close-queued-or-in-flight">WritableStreamCloseQueuedOrInFlight</a>(<var>dest</var>) is true or <var>dest</var>.<a data-link-type="dfn" href="#writablestream-state" id="ref-for-writablestream-state②">[[state]]</a> is "<code>closed</code>", then</p> <ol> <li data-md> <p class="assertion">Assert: no <a data-link-type="dfn" href="#chunk" id="ref-for-chunk④②">chunks</a> have been read or written.</p> <li data-md> <p>Let <var>destClosed</var> be a new <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror③⓪">TypeError</a></code>.</p> <li data-md> <p>If <var>preventCancel</var> is false, <a data-link-type="dfn" href="#rs-pipeTo-shutdown-with-action" id="ref-for-rs-pipeTo-shutdown-with-action④">shutdown with an action</a> of ! <a data-link-type="abstract-op" href="#readable-stream-cancel" id="ref-for-readable-stream-cancel③">ReadableStreamCancel</a>(<var>source</var>, <var>destClosed</var>) and with <var>destClosed</var>.</p> <li data-md> <p>Otherwise, <a data-link-type="dfn" href="#rs-pipeTo-shutdown" id="ref-for-rs-pipeTo-shutdown③">shutdown</a> with <var>destClosed</var>.</p> </ol> </ol> <li data-md> <p><dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="rs-pipeTo-shutdown-with-action"><i>Shutdown with an action</i></dfn>: if any of the above requirements ask to shutdown with an action <var>action</var>, optionally with an error <var>originalError</var>, then:</p> <ol> <li data-md> <p>If <var>shuttingDown</var> is true, abort these substeps.</p> <li data-md> <p>Set <var>shuttingDown</var> to true.</p> <li data-md> <p>If <var>dest</var>.<a data-link-type="dfn" href="#writablestream-state" id="ref-for-writablestream-state③">[[state]]</a> is "<code>writable</code>" and ! <a data-link-type="abstract-op" href="#writable-stream-close-queued-or-in-flight" id="ref-for-writable-stream-close-queued-or-in-flight①">WritableStreamCloseQueuedOrInFlight</a>(<var>dest</var>) is false,</p> <ol> <li data-md> <p>If any <a data-link-type="dfn" href="#chunk" id="ref-for-chunk④③">chunks</a> have been read but not yet written, write them to <var>dest</var>.</p> <li data-md> <p>Wait until every <a data-link-type="dfn" href="#chunk" id="ref-for-chunk④④">chunk</a> that has been read has been written (i.e. the corresponding promises have settled).</p> </ol> <li data-md> <p>Let <var>p</var> be the result of performing <var>action</var>.</p> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#upon-fulfillment" id="ref-for-upon-fulfillment">Upon fulfillment</a> of <var>p</var>, <a data-link-type="dfn" href="#rs-pipeTo-finalize" id="ref-for-rs-pipeTo-finalize">finalize</a>, passing along <var>originalError</var> if it was given.</p> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#upon-rejection" id="ref-for-upon-rejection">Upon rejection</a> of <var>p</var> with reason <var>newError</var>, <a data-link-type="dfn" href="#rs-pipeTo-finalize" id="ref-for-rs-pipeTo-finalize①">finalize</a> with <var>newError</var>.</p> </ol> <li data-md> <p><dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="rs-pipeTo-shutdown"><i>Shutdown</i></dfn>: if any of the above requirements or steps ask to shutdown, optionally with an error <var>error</var>, then:</p> <ol> <li data-md> <p>If <var>shuttingDown</var> is true, abort these substeps.</p> <li data-md> <p>Set <var>shuttingDown</var> to true.</p> <li data-md> <p>If <var>dest</var>.<a data-link-type="dfn" href="#writablestream-state" id="ref-for-writablestream-state④">[[state]]</a> is "<code>writable</code>" and ! <a data-link-type="abstract-op" href="#writable-stream-close-queued-or-in-flight" id="ref-for-writable-stream-close-queued-or-in-flight②">WritableStreamCloseQueuedOrInFlight</a>(<var>dest</var>) is false,</p> <ol> <li data-md> <p>If any <a data-link-type="dfn" href="#chunk" id="ref-for-chunk④⑤">chunks</a> have been read but not yet written, write them to <var>dest</var>.</p> <li data-md> <p>Wait until every <a data-link-type="dfn" href="#chunk" id="ref-for-chunk④⑥">chunk</a> that has been read has been written (i.e. the corresponding promises have settled).</p> </ol> <li data-md> <p><a data-link-type="dfn" href="#rs-pipeTo-finalize" id="ref-for-rs-pipeTo-finalize②">Finalize</a>, passing along <var>error</var> if it was given.</p> </ol> <li data-md> <p><dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="rs-pipeTo-finalize"><i>Finalize</i></dfn>: both forms of shutdown will eventually ask to finalize, optionally with an error <var>error</var>, which means to perform the following steps:</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#writable-stream-default-writer-release" id="ref-for-writable-stream-default-writer-release">WritableStreamDefaultWriterRelease</a>(<var>writer</var>).</p> <li data-md> <p>If <var>reader</var> <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#implements" id="ref-for-implements④">implements</a> <code class="idl"><a data-link-type="idl" href="#readablestreambyobreader" id="ref-for-readablestreambyobreader①①">ReadableStreamBYOBReader</a></code>, perform ! <a data-link-type="abstract-op" href="#abstract-opdef-readablestreambyobreaderrelease" id="ref-for-abstract-opdef-readablestreambyobreaderrelease①">ReadableStreamBYOBReaderRelease</a>(<var>reader</var>).</p> <li data-md> <p>Otherwise, perform ! <a data-link-type="abstract-op" href="#abstract-opdef-readablestreamdefaultreaderrelease" id="ref-for-abstract-opdef-readablestreamdefaultreaderrelease⑤">ReadableStreamDefaultReaderRelease</a>(<var>reader</var>).</p> <li data-md> <p>If <var>signal</var> is not undefined, <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#abortsignal-remove" id="ref-for-abortsignal-remove">remove</a> <var>abortAlgorithm</var> from <var>signal</var>.</p> <li data-md> <p>If <var>error</var> was given, <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#reject" id="ref-for-reject③">reject</a> <var>promise</var> with <var>error</var>.</p> <li data-md> <p>Otherwise, <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#resolve" id="ref-for-resolve⑥">resolve</a> <var>promise</var> with undefined.</p> </ol> </ul> <li data-md> <p>Return <var>promise</var>.</p> </ol> </div> <p class="note" role="note">Various abstract operations performed here include object creation (often of promises), which usually would require specifying a realm for the created object. However, because of the locking, none of these objects can be observed by author code. As such, the realm used to create them does not matter. </p> <div class="algorithm" data-algorithm="ReadableStreamTee"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableStreamTee" id="readable-stream-tee">ReadableStreamTee(<var>stream</var>, <var>cloneForBranch2</var>)</dfn> will <a data-link-type="dfn" href="#tee-a-readable-stream" id="ref-for-tee-a-readable-stream③">tee</a> a given readable stream. <p>The second argument, <var>cloneForBranch2</var>, governs whether or not the data from the original stream will be cloned (using HTML’s <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/structured-data.html#serializable-objects" id="ref-for-serializable-objects">serializable objects</a> framework) before appearing in the second of the returned branches. This is useful for scenarios where both branches are to be consumed in such a way that they might otherwise interfere with each other, such as by <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/structured-data.html#transferable-objects" id="ref-for-transferable-objects①">transferring</a> their <a data-link-type="dfn" href="#chunk" id="ref-for-chunk④⑦">chunks</a>. However, it does introduce a noticeable asymmetry between the two branches, and limits the possible <a data-link-type="dfn" href="#chunk" id="ref-for-chunk④⑧">chunks</a> to serializable ones. <a data-link-type="biblio" href="#biblio-html" title="HTML Standard">[HTML]</a></p> <p>If <var>stream</var> is a <a data-link-type="dfn" href="#readable-byte-stream" id="ref-for-readable-byte-stream①②">readable byte stream</a>, then <var>cloneForBranch2</var> is ignored and chunks are cloned unconditionally.</p> <p class="note" role="note">In this standard ReadableStreamTee is always called with <var>cloneForBranch2</var> set to false; other specifications pass true via the <a data-link-type="dfn" href="#readablestream-tee" id="ref-for-readablestream-tee">tee</a> wrapper algorithm. </p> <p>It performs the following steps:</p> <ol> <li data-md> <p class="assertion">Assert: <var>stream</var> <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#implements" id="ref-for-implements⑤">implements</a> <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream③⑦">ReadableStream</a></code>.</p> <li data-md> <p class="assertion">Assert: <var>cloneForBranch2</var> is a boolean.</p> <li data-md> <p>If <var>stream</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller③">[[controller]]</a> <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#implements" id="ref-for-implements⑥">implements</a> <code class="idl"><a data-link-type="idl" href="#readablebytestreamcontroller" id="ref-for-readablebytestreamcontroller①④">ReadableByteStreamController</a></code>, return ? <a data-link-type="abstract-op" href="#abstract-opdef-readablebytestreamtee" id="ref-for-abstract-opdef-readablebytestreamtee">ReadableByteStreamTee</a>(<var>stream</var>).</p> <li data-md> <p>Return ? <a data-link-type="abstract-op" href="#abstract-opdef-readablestreamdefaulttee" id="ref-for-abstract-opdef-readablestreamdefaulttee">ReadableStreamDefaultTee</a>(<var>stream</var>, <var>cloneForBranch2</var>).</p> </ol> </div> <div class="algorithm" data-algorithm="ReadableStreamDefaultTee"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableStreamDefaultTee" id="abstract-opdef-readablestreamdefaulttee">ReadableStreamDefaultTee(<var>stream</var>, <var>cloneForBranch2</var>)</dfn> performs the following steps: <ol> <li data-md> <p class="assertion">Assert: <var>stream</var> <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#implements" id="ref-for-implements⑦">implements</a> <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream③⑧">ReadableStream</a></code>.</p> <li data-md> <p class="assertion">Assert: <var>cloneForBranch2</var> is a boolean.</p> <li data-md> <p>Let <var>reader</var> be ? <a data-link-type="abstract-op" href="#acquire-readable-stream-reader" id="ref-for-acquire-readable-stream-reader④">AcquireReadableStreamDefaultReader</a>(<var>stream</var>).</p> <li data-md> <p>Let <var>reading</var> be false.</p> <li data-md> <p>Let <var>readAgain</var> be false.</p> <li data-md> <p>Let <var>canceled1</var> be false.</p> <li data-md> <p>Let <var>canceled2</var> be false.</p> <li data-md> <p>Let <var>reason1</var> be undefined.</p> <li data-md> <p>Let <var>reason2</var> be undefined.</p> <li data-md> <p>Let <var>branch1</var> be undefined.</p> <li data-md> <p>Let <var>branch2</var> be undefined.</p> <li data-md> <p>Let <var>cancelPromise</var> be <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-new-promise" id="ref-for-a-new-promise④">a new promise</a>.</p> <li data-md> <p>Let <var>pullAlgorithm</var> be the following steps:</p> <ol> <li data-md> <p>If <var>reading</var> is true,</p> <ol> <li data-md> <p>Set <var>readAgain</var> to true.</p> <li data-md> <p>Return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-resolved-with" id="ref-for-a-promise-resolved-with⑥">a promise resolved with</a> undefined.</p> </ol> <li data-md> <p>Set <var>reading</var> to true.</p> <li data-md> <p>Let <var>readRequest</var> be a <a data-link-type="dfn" href="#read-request" id="ref-for-read-request③">read request</a> with the following <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#struct-item" id="ref-for-struct-item⑦">items</a>:</p> <dl> <dt data-md><a data-link-type="dfn" href="#read-request-chunk-steps" id="ref-for-read-request-chunk-steps③">chunk steps</a>, given <var>chunk</var> <dd data-md> <ol> <li data-md> <p><a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-microtask" id="ref-for-queue-a-microtask">Queue a microtask</a> to perform the following steps:</p> <ol> <li data-md> <p>Set <var>readAgain</var> to false.</p> <li data-md> <p>Let <var>chunk1</var> and <var>chunk2</var> be <var>chunk</var>.</p> <li data-md> <p>If <var>canceled2</var> is false and <var>cloneForBranch2</var> is true,</p> <ol> <li data-md> <p>Let <var>cloneResult</var> be <a data-link-type="abstract-op" href="#abstract-opdef-structuredclone" id="ref-for-abstract-opdef-structuredclone">StructuredClone</a>(<var>chunk2</var>).</p> <li data-md> <p>If <var>cloneResult</var> is an abrupt completion,</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-error" id="ref-for-readable-stream-default-controller-error①">ReadableStreamDefaultControllerError</a>(<var>branch1</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller④">[[controller]]</a>, <var>cloneResult</var>.[[Value]]).</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-error" id="ref-for-readable-stream-default-controller-error②">ReadableStreamDefaultControllerError</a>(<var>branch2</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller⑤">[[controller]]</a>, <var>cloneResult</var>.[[Value]]).</p> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#resolve" id="ref-for-resolve⑦">Resolve</a> <var>cancelPromise</var> with ! <a data-link-type="abstract-op" href="#readable-stream-cancel" id="ref-for-readable-stream-cancel④">ReadableStreamCancel</a>(<var>stream</var>, <var>cloneResult</var>.[[Value]]).</p> <li data-md> <p>Return.</p> </ol> <li data-md> <p>Otherwise, set <var>chunk2</var> to <var>cloneResult</var>.[[Value]].</p> </ol> <li data-md> <p>If <var>canceled1</var> is false, perform ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-enqueue" id="ref-for-readable-stream-default-controller-enqueue②">ReadableStreamDefaultControllerEnqueue</a>(<var>branch1</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller⑥">[[controller]]</a>, <var>chunk1</var>).</p> <li data-md> <p>If <var>canceled2</var> is false, perform ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-enqueue" id="ref-for-readable-stream-default-controller-enqueue③">ReadableStreamDefaultControllerEnqueue</a>(<var>branch2</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller⑦">[[controller]]</a>, <var>chunk2</var>).</p> <li data-md> <p>Set <var>reading</var> to false.</p> <li data-md> <p>If <var>readAgain</var> is true, perform <var>pullAlgorithm</var>.</p> </ol> </ol> <p class="note" role="note">The microtask delay here is necessary because it takes at least a microtask to detect errors, when we use <var>reader</var>.<a data-link-type="dfn" href="#readablestreamgenericreader-closedpromise" id="ref-for-readablestreamgenericreader-closedpromise①">[[closedPromise]]</a> below. We want errors in <var>stream</var> to error both branches immediately, so we cannot let successful synchronously-available reads happen ahead of asynchronously-available errors. </p> <dt data-md><a data-link-type="dfn" href="#read-request-close-steps" id="ref-for-read-request-close-steps②">close steps</a> <dd data-md> <ol> <li data-md> <p>Set <var>reading</var> to false.</p> <li data-md> <p>If <var>canceled1</var> is false, perform ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-close" id="ref-for-readable-stream-default-controller-close②">ReadableStreamDefaultControllerClose</a>(<var>branch1</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller⑧">[[controller]]</a>).</p> <li data-md> <p>If <var>canceled2</var> is false, perform ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-close" id="ref-for-readable-stream-default-controller-close③">ReadableStreamDefaultControllerClose</a>(<var>branch2</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller⑨">[[controller]]</a>).</p> <li data-md> <p>If <var>canceled1</var> is false or <var>canceled2</var> is false, <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#resolve" id="ref-for-resolve⑧">resolve</a> <var>cancelPromise</var> with undefined.</p> </ol> <dt data-md><a data-link-type="dfn" href="#read-request-error-steps" id="ref-for-read-request-error-steps③">error steps</a> <dd data-md> <ol> <li data-md> <p>Set <var>reading</var> to false.</p> </ol> </dl> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-default-reader-read" id="ref-for-readable-stream-default-reader-read②">ReadableStreamDefaultReaderRead</a>(<var>reader</var>, <var>readRequest</var>).</p> <li data-md> <p>Return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-resolved-with" id="ref-for-a-promise-resolved-with⑦">a promise resolved with</a> undefined.</p> </ol> <li data-md> <p>Let <var>cancel1Algorithm</var> be the following steps, taking a <var>reason</var> argument:</p> <ol> <li data-md> <p>Set <var>canceled1</var> to true.</p> <li data-md> <p>Set <var>reason1</var> to <var>reason</var>.</p> <li data-md> <p>If <var>canceled2</var> is true,</p> <ol> <li data-md> <p>Let <var>compositeReason</var> be ! <a data-link-type="abstract-op" href="https://tc39.es/ecma262/multipage/abstract-operations.html#sec-createarrayfromlist" id="ref-for-sec-createarrayfromlist">CreateArrayFromList</a>(« <var>reason1</var>, <var>reason2</var> »).</p> <li data-md> <p>Let <var>cancelResult</var> be ! <a data-link-type="abstract-op" href="#readable-stream-cancel" id="ref-for-readable-stream-cancel⑤">ReadableStreamCancel</a>(<var>stream</var>, <var>compositeReason</var>).</p> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#resolve" id="ref-for-resolve⑨">Resolve</a> <var>cancelPromise</var> with <var>cancelResult</var>.</p> </ol> <li data-md> <p>Return <var>cancelPromise</var>.</p> </ol> <li data-md> <p>Let <var>cancel2Algorithm</var> be the following steps, taking a <var>reason</var> argument:</p> <ol> <li data-md> <p>Set <var>canceled2</var> to true.</p> <li data-md> <p>Set <var>reason2</var> to <var>reason</var>.</p> <li data-md> <p>If <var>canceled1</var> is true,</p> <ol> <li data-md> <p>Let <var>compositeReason</var> be ! <a data-link-type="abstract-op" href="https://tc39.es/ecma262/multipage/abstract-operations.html#sec-createarrayfromlist" id="ref-for-sec-createarrayfromlist①">CreateArrayFromList</a>(« <var>reason1</var>, <var>reason2</var> »).</p> <li data-md> <p>Let <var>cancelResult</var> be ! <a data-link-type="abstract-op" href="#readable-stream-cancel" id="ref-for-readable-stream-cancel⑥">ReadableStreamCancel</a>(<var>stream</var>, <var>compositeReason</var>).</p> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#resolve" id="ref-for-resolve①⓪">Resolve</a> <var>cancelPromise</var> with <var>cancelResult</var>.</p> </ol> <li data-md> <p>Return <var>cancelPromise</var>.</p> </ol> <li data-md> <p>Let <var>startAlgorithm</var> be an algorithm that returns undefined.</p> <li data-md> <p>Set <var>branch1</var> to ! <a data-link-type="abstract-op" href="#create-readable-stream" id="ref-for-create-readable-stream①">CreateReadableStream</a>(<var>startAlgorithm</var>, <var>pullAlgorithm</var>, <var>cancel1Algorithm</var>).</p> <li data-md> <p>Set <var>branch2</var> to ! <a data-link-type="abstract-op" href="#create-readable-stream" id="ref-for-create-readable-stream②">CreateReadableStream</a>(<var>startAlgorithm</var>, <var>pullAlgorithm</var>, <var>cancel2Algorithm</var>).</p> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#upon-rejection" id="ref-for-upon-rejection①">Upon rejection</a> of <var>reader</var>.<a data-link-type="dfn" href="#readablestreamgenericreader-closedpromise" id="ref-for-readablestreamgenericreader-closedpromise②">[[closedPromise]]</a> with reason <var>r</var>,</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-error" id="ref-for-readable-stream-default-controller-error③">ReadableStreamDefaultControllerError</a>(<var>branch1</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller①⓪">[[controller]]</a>, <var>r</var>).</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-error" id="ref-for-readable-stream-default-controller-error④">ReadableStreamDefaultControllerError</a>(<var>branch2</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller①①">[[controller]]</a>, <var>r</var>).</p> <li data-md> <p>If <var>canceled1</var> is false or <var>canceled2</var> is false, <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#resolve" id="ref-for-resolve①①">resolve</a> <var>cancelPromise</var> with undefined.</p> </ol> <li data-md> <p>Return « <var>branch1</var>, <var>branch2</var> ».</p> </ol> </div> <div class="algorithm" data-algorithm="ReadableByteStreamTee"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableByteStreamTee" id="abstract-opdef-readablebytestreamtee">ReadableByteStreamTee(<var>stream</var>)</dfn> performs the following steps: <ol> <li data-md> <p class="assertion">Assert: <var>stream</var> <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#implements" id="ref-for-implements⑧">implements</a> <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream③⑨">ReadableStream</a></code>.</p> <li data-md> <p class="assertion">Assert: <var>stream</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller①②">[[controller]]</a> <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#implements" id="ref-for-implements⑨">implements</a> <code class="idl"><a data-link-type="idl" href="#readablebytestreamcontroller" id="ref-for-readablebytestreamcontroller①⑤">ReadableByteStreamController</a></code>.</p> <li data-md> <p>Let <var>reader</var> be ? <a data-link-type="abstract-op" href="#acquire-readable-stream-reader" id="ref-for-acquire-readable-stream-reader⑤">AcquireReadableStreamDefaultReader</a>(<var>stream</var>).</p> <li data-md> <p>Let <var>reading</var> be false.</p> <li data-md> <p>Let <var>readAgainForBranch1</var> be false.</p> <li data-md> <p>Let <var>readAgainForBranch2</var> be false.</p> <li data-md> <p>Let <var>canceled1</var> be false.</p> <li data-md> <p>Let <var>canceled2</var> be false.</p> <li data-md> <p>Let <var>reason1</var> be undefined.</p> <li data-md> <p>Let <var>reason2</var> be undefined.</p> <li data-md> <p>Let <var>branch1</var> be undefined.</p> <li data-md> <p>Let <var>branch2</var> be undefined.</p> <li data-md> <p>Let <var>cancelPromise</var> be <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-new-promise" id="ref-for-a-new-promise⑤">a new promise</a>.</p> <li data-md> <p>Let <var>forwardReaderError</var> be the following steps, taking a <var>thisReader</var> argument:</p> <ol> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#upon-rejection" id="ref-for-upon-rejection②">Upon rejection</a> of <var>thisReader</var>.<a data-link-type="dfn" href="#readablestreamgenericreader-closedpromise" id="ref-for-readablestreamgenericreader-closedpromise③">[[closedPromise]]</a> with reason <var>r</var>,</p> <ol> <li data-md> <p>If <var>thisReader</var> is not <var>reader</var>, return.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-error" id="ref-for-readable-byte-stream-controller-error①">ReadableByteStreamControllerError</a>(<var>branch1</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller①③">[[controller]]</a>, <var>r</var>).</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-error" id="ref-for-readable-byte-stream-controller-error②">ReadableByteStreamControllerError</a>(<var>branch2</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller①④">[[controller]]</a>, <var>r</var>).</p> <li data-md> <p>If <var>canceled1</var> is false or <var>canceled2</var> is false, <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#resolve" id="ref-for-resolve①②">resolve</a> <var>cancelPromise</var> with undefined.</p> </ol> </ol> <li data-md> <p>Let <var>pullWithDefaultReader</var> be the following steps:</p> <ol> <li data-md> <p>If <var>reader</var> <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#implements" id="ref-for-implements①⓪">implements</a> <code class="idl"><a data-link-type="idl" href="#readablestreambyobreader" id="ref-for-readablestreambyobreader①②">ReadableStreamBYOBReader</a></code>,</p> <ol> <li data-md> <p class="assertion">Assert: <var>reader</var>.<a data-link-type="dfn" href="#readablestreambyobreader-readintorequests" id="ref-for-readablestreambyobreader-readintorequests">[[readIntoRequests]]</a> is <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-is-empty" id="ref-for-list-is-empty④">empty</a>.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#abstract-opdef-readablestreambyobreaderrelease" id="ref-for-abstract-opdef-readablestreambyobreaderrelease②">ReadableStreamBYOBReaderRelease</a>(<var>reader</var>).</p> <li data-md> <p>Set <var>reader</var> to ! <a data-link-type="abstract-op" href="#acquire-readable-stream-reader" id="ref-for-acquire-readable-stream-reader⑥">AcquireReadableStreamDefaultReader</a>(<var>stream</var>).</p> <li data-md> <p>Perform <var>forwardReaderError</var>, given <var>reader</var>.</p> </ol> <li data-md> <p>Let <var>readRequest</var> be a <a data-link-type="dfn" href="#read-request" id="ref-for-read-request④">read request</a> with the following <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#struct-item" id="ref-for-struct-item⑧">items</a>:</p> <dl> <dt data-md><a data-link-type="dfn" href="#read-request-chunk-steps" id="ref-for-read-request-chunk-steps④">chunk steps</a>, given <var>chunk</var> <dd data-md> <ol> <li data-md> <p><a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-microtask" id="ref-for-queue-a-microtask①">Queue a microtask</a> to perform the following steps:</p> <ol> <li data-md> <p>Set <var>readAgainForBranch1</var> to false.</p> <li data-md> <p>Set <var>readAgainForBranch2</var> to false.</p> <li data-md> <p>Let <var>chunk1</var> and <var>chunk2</var> be <var>chunk</var>.</p> <li data-md> <p>If <var>canceled1</var> is false and <var>canceled2</var> is false,</p> <ol> <li data-md> <p>Let <var>cloneResult</var> be <a data-link-type="abstract-op" href="#abstract-opdef-cloneasuint8array" id="ref-for-abstract-opdef-cloneasuint8array">CloneAsUint8Array</a>(<var>chunk</var>).</p> <li data-md> <p>If <var>cloneResult</var> is an abrupt completion,</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-error" id="ref-for-readable-byte-stream-controller-error③">ReadableByteStreamControllerError</a>(<var>branch1</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller①⑤">[[controller]]</a>, <var>cloneResult</var>.[[Value]]).</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-error" id="ref-for-readable-byte-stream-controller-error④">ReadableByteStreamControllerError</a>(<var>branch2</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller①⑥">[[controller]]</a>, <var>cloneResult</var>.[[Value]]).</p> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#resolve" id="ref-for-resolve①③">Resolve</a> <var>cancelPromise</var> with ! <a data-link-type="abstract-op" href="#readable-stream-cancel" id="ref-for-readable-stream-cancel⑦">ReadableStreamCancel</a>(<var>stream</var>, <var>cloneResult</var>.[[Value]]).</p> <li data-md> <p>Return.</p> </ol> <li data-md> <p>Otherwise, set <var>chunk2</var> to <var>cloneResult</var>.[[Value]].</p> </ol> <li data-md> <p>If <var>canceled1</var> is false, perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-enqueue" id="ref-for-readable-byte-stream-controller-enqueue①">ReadableByteStreamControllerEnqueue</a>(<var>branch1</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller①⑦">[[controller]]</a>, <var>chunk1</var>).</p> <li data-md> <p>If <var>canceled2</var> is false, perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-enqueue" id="ref-for-readable-byte-stream-controller-enqueue②">ReadableByteStreamControllerEnqueue</a>(<var>branch2</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller①⑧">[[controller]]</a>, <var>chunk2</var>).</p> <li data-md> <p>Set <var>reading</var> to false.</p> <li data-md> <p>If <var>readAgainForBranch1</var> is true, perform <var>pull1Algorithm</var>.</p> <li data-md> <p>Otherwise, if <var>readAgainForBranch2</var> is true, perform <var>pull2Algorithm</var>.</p> </ol> </ol> <p class="note" role="note">The microtask delay here is necessary because it takes at least a microtask to detect errors, when we use <var>reader</var>.<a data-link-type="dfn" href="#readablestreamgenericreader-closedpromise" id="ref-for-readablestreamgenericreader-closedpromise④">[[closedPromise]]</a> below. We want errors in <var>stream</var> to error both branches immediately, so we cannot let successful synchronously-available reads happen ahead of asynchronously-available errors. </p> <dt data-md><a data-link-type="dfn" href="#read-request-close-steps" id="ref-for-read-request-close-steps③">close steps</a> <dd data-md> <ol> <li data-md> <p>Set <var>reading</var> to false.</p> <li data-md> <p>If <var>canceled1</var> is false, perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-close" id="ref-for-readable-byte-stream-controller-close①">ReadableByteStreamControllerClose</a>(<var>branch1</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller①⑨">[[controller]]</a>).</p> <li data-md> <p>If <var>canceled2</var> is false, perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-close" id="ref-for-readable-byte-stream-controller-close②">ReadableByteStreamControllerClose</a>(<var>branch2</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller②⓪">[[controller]]</a>).</p> <li data-md> <p>If <var>branch1</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller②①">[[controller]]</a>.<a data-link-type="dfn" href="#readablebytestreamcontroller-pendingpullintos" id="ref-for-readablebytestreamcontroller-pendingpullintos④">[[pendingPullIntos]]</a> is not <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-is-empty" id="ref-for-list-is-empty⑤">empty</a>, perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-respond" id="ref-for-readable-byte-stream-controller-respond①">ReadableByteStreamControllerRespond</a>(<var>branch1</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller②②">[[controller]]</a>, 0).</p> <li data-md> <p>If <var>branch2</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller②③">[[controller]]</a>.<a data-link-type="dfn" href="#readablebytestreamcontroller-pendingpullintos" id="ref-for-readablebytestreamcontroller-pendingpullintos⑤">[[pendingPullIntos]]</a> is not <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-is-empty" id="ref-for-list-is-empty⑥">empty</a>, perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-respond" id="ref-for-readable-byte-stream-controller-respond②">ReadableByteStreamControllerRespond</a>(<var>branch2</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller②④">[[controller]]</a>, 0).</p> <li data-md> <p>If <var>canceled1</var> is false or <var>canceled2</var> is false, <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#resolve" id="ref-for-resolve①④">resolve</a> <var>cancelPromise</var> with undefined.</p> </ol> <dt data-md><a data-link-type="dfn" href="#read-request-error-steps" id="ref-for-read-request-error-steps④">error steps</a> <dd data-md> <ol> <li data-md> <p>Set <var>reading</var> to false.</p> </ol> </dl> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-default-reader-read" id="ref-for-readable-stream-default-reader-read③">ReadableStreamDefaultReaderRead</a>(<var>reader</var>, <var>readRequest</var>).</p> </ol> <li data-md> <p>Let <var>pullWithBYOBReader</var> be the following steps, given <var>view</var> and <var>forBranch2</var>:</p> <ol> <li data-md> <p>If <var>reader</var> <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#implements" id="ref-for-implements①①">implements</a> <code class="idl"><a data-link-type="idl" href="#readablestreamdefaultreader" id="ref-for-readablestreamdefaultreader①①">ReadableStreamDefaultReader</a></code>,</p> <ol> <li data-md> <p class="assertion">Assert: <var>reader</var>.<a data-link-type="dfn" href="#readablestreamdefaultreader-readrequests" id="ref-for-readablestreamdefaultreader-readrequests①">[[readRequests]]</a> is <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-is-empty" id="ref-for-list-is-empty⑦">empty</a>.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#abstract-opdef-readablestreamdefaultreaderrelease" id="ref-for-abstract-opdef-readablestreamdefaultreaderrelease⑥">ReadableStreamDefaultReaderRelease</a>(<var>reader</var>).</p> <li data-md> <p>Set <var>reader</var> to ! <a data-link-type="abstract-op" href="#acquire-readable-stream-byob-reader" id="ref-for-acquire-readable-stream-byob-reader②">AcquireReadableStreamBYOBReader</a>(<var>stream</var>).</p> <li data-md> <p>Perform <var>forwardReaderError</var>, given <var>reader</var>.</p> </ol> <li data-md> <p>Let <var>byobBranch</var> be <var>branch2</var> if <var>forBranch2</var> is true, and <var>branch1</var> otherwise.</p> <li data-md> <p>Let <var>otherBranch</var> be <var>branch2</var> if <var>forBranch2</var> is false, and <var>branch1</var> otherwise.</p> <li data-md> <p>Let <var>readIntoRequest</var> be a <a data-link-type="dfn" href="#read-into-request" id="ref-for-read-into-request②">read-into request</a> with the following <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#struct-item" id="ref-for-struct-item⑨">items</a>:</p> <dl> <dt data-md><a data-link-type="dfn" href="#read-into-request-chunk-steps" id="ref-for-read-into-request-chunk-steps①">chunk steps</a>, given <var>chunk</var> <dd data-md> <ol> <li data-md> <p><a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-microtask" id="ref-for-queue-a-microtask②">Queue a microtask</a> to perform the following steps:</p> <ol> <li data-md> <p>Set <var>readAgainForBranch1</var> to false.</p> <li data-md> <p>Set <var>readAgainForBranch2</var> to false.</p> <li data-md> <p>Let <var>byobCanceled</var> be <var>canceled2</var> if <var>forBranch2</var> is true, and <var>canceled1</var> otherwise.</p> <li data-md> <p>Let <var>otherCanceled</var> be <var>canceled2</var> if <var>forBranch2</var> is false, and <var>canceled1</var> otherwise.</p> <li data-md> <p>If <var>otherCanceled</var> is false,</p> <ol> <li data-md> <p>Let <var>cloneResult</var> be <a data-link-type="abstract-op" href="#abstract-opdef-cloneasuint8array" id="ref-for-abstract-opdef-cloneasuint8array①">CloneAsUint8Array</a>(<var>chunk</var>).</p> <li data-md> <p>If <var>cloneResult</var> is an abrupt completion,</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-error" id="ref-for-readable-byte-stream-controller-error⑤">ReadableByteStreamControllerError</a>(<var>byobBranch</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller②⑤">[[controller]]</a>, <var>cloneResult</var>.[[Value]]).</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-error" id="ref-for-readable-byte-stream-controller-error⑥">ReadableByteStreamControllerError</a>(<var>otherBranch</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller②⑥">[[controller]]</a>, <var>cloneResult</var>.[[Value]]).</p> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#resolve" id="ref-for-resolve①⑤">Resolve</a> <var>cancelPromise</var> with ! <a data-link-type="abstract-op" href="#readable-stream-cancel" id="ref-for-readable-stream-cancel⑧">ReadableStreamCancel</a>(<var>stream</var>, <var>cloneResult</var>.[[Value]]).</p> <li data-md> <p>Return.</p> </ol> <li data-md> <p>Otherwise, let <var>clonedChunk</var> be <var>cloneResult</var>.[[Value]].</p> <li data-md> <p>If <var>byobCanceled</var> is false, perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-respond-with-new-view" id="ref-for-readable-byte-stream-controller-respond-with-new-view①">ReadableByteStreamControllerRespondWithNewView</a>(<var>byobBranch</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller②⑦">[[controller]]</a>, <var>chunk</var>).</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-enqueue" id="ref-for-readable-byte-stream-controller-enqueue③">ReadableByteStreamControllerEnqueue</a>(<var>otherBranch</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller②⑧">[[controller]]</a>, <var>clonedChunk</var>).</p> </ol> <li data-md> <p>Otherwise, if <var>byobCanceled</var> is false, perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-respond-with-new-view" id="ref-for-readable-byte-stream-controller-respond-with-new-view②">ReadableByteStreamControllerRespondWithNewView</a>(<var>byobBranch</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller②⑨">[[controller]]</a>, <var>chunk</var>).</p> <li data-md> <p>Set <var>reading</var> to false.</p> <li data-md> <p>If <var>readAgainForBranch1</var> is true, perform <var>pull1Algorithm</var>.</p> <li data-md> <p>Otherwise, if <var>readAgainForBranch2</var> is true, perform <var>pull2Algorithm</var>.</p> </ol> </ol> <p class="note" role="note">The microtask delay here is necessary because it takes at least a microtask to detect errors, when we use <var>reader</var>.<a data-link-type="dfn" href="#readablestreamgenericreader-closedpromise" id="ref-for-readablestreamgenericreader-closedpromise⑤">[[closedPromise]]</a> below. We want errors in <var>stream</var> to error both branches immediately, so we cannot let successful synchronously-available reads happen ahead of asynchronously-available errors. </p> <dt data-md><a data-link-type="dfn" href="#read-into-request-close-steps" id="ref-for-read-into-request-close-steps②">close steps</a>, given <var>chunk</var> <dd data-md> <ol> <li data-md> <p>Set <var>reading</var> to false.</p> <li data-md> <p>Let <var>byobCanceled</var> be <var>canceled2</var> if <var>forBranch2</var> is true, and <var>canceled1</var> otherwise.</p> <li data-md> <p>Let <var>otherCanceled</var> be <var>canceled2</var> if <var>forBranch2</var> is false, and <var>canceled1</var> otherwise.</p> <li data-md> <p>If <var>byobCanceled</var> is false, perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-close" id="ref-for-readable-byte-stream-controller-close③">ReadableByteStreamControllerClose</a>(<var>byobBranch</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller③⓪">[[controller]]</a>).</p> <li data-md> <p>If <var>otherCanceled</var> is false, perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-close" id="ref-for-readable-byte-stream-controller-close④">ReadableByteStreamControllerClose</a>(<var>otherBranch</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller③①">[[controller]]</a>).</p> <li data-md> <p>If <var>chunk</var> is not undefined,</p> <ol> <li data-md> <p class="assertion">Assert: <var>chunk</var>.[[ByteLength]] is 0.</p> <li data-md> <p>If <var>byobCanceled</var> is false, perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-respond-with-new-view" id="ref-for-readable-byte-stream-controller-respond-with-new-view③">ReadableByteStreamControllerRespondWithNewView</a>(<var>byobBranch</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller③②">[[controller]]</a>, <var>chunk</var>).</p> <li data-md> <p>If <var>otherCanceled</var> is false and <var>otherBranch</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller③③">[[controller]]</a>.<a data-link-type="dfn" href="#readablebytestreamcontroller-pendingpullintos" id="ref-for-readablebytestreamcontroller-pendingpullintos⑥">[[pendingPullIntos]]</a> is not <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-is-empty" id="ref-for-list-is-empty⑧">empty</a>, perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-respond" id="ref-for-readable-byte-stream-controller-respond③">ReadableByteStreamControllerRespond</a>(<var>otherBranch</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller③④">[[controller]]</a>, 0).</p> </ol> <li data-md> <p>If <var>byobCanceled</var> is false or <var>otherCanceled</var> is false, <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#resolve" id="ref-for-resolve①⑥">resolve</a> <var>cancelPromise</var> with undefined.</p> </ol> <dt data-md><a data-link-type="dfn" href="#read-into-request-error-steps" id="ref-for-read-into-request-error-steps①">error steps</a> <dd data-md> <ol> <li data-md> <p>Set <var>reading</var> to false.</p> </ol> </dl> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-byob-reader-read" id="ref-for-readable-stream-byob-reader-read①">ReadableStreamBYOBReaderRead</a>(<var>reader</var>, <var>view</var>, 1, <var>readIntoRequest</var>).</p> </ol> <li data-md> <p>Let <var>pull1Algorithm</var> be the following steps:</p> <ol> <li data-md> <p>If <var>reading</var> is true,</p> <ol> <li data-md> <p>Set <var>readAgainForBranch1</var> to true.</p> <li data-md> <p>Return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-resolved-with" id="ref-for-a-promise-resolved-with⑧">a promise resolved with</a> undefined.</p> </ol> <li data-md> <p>Set <var>reading</var> to true.</p> <li data-md> <p>Let <var>byobRequest</var> be ! <a data-link-type="abstract-op" href="#abstract-opdef-readablebytestreamcontrollergetbyobrequest" id="ref-for-abstract-opdef-readablebytestreamcontrollergetbyobrequest①">ReadableByteStreamControllerGetBYOBRequest</a>(<var>branch1</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller③⑤">[[controller]]</a>).</p> <li data-md> <p>If <var>byobRequest</var> is null, perform <var>pullWithDefaultReader</var>.</p> <li data-md> <p>Otherwise, perform <var>pullWithBYOBReader</var>, given <var>byobRequest</var>.<a data-link-type="dfn" href="#readablestreambyobrequest-view" id="ref-for-readablestreambyobrequest-view④">[[view]]</a> and false.</p> <li data-md> <p>Return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-resolved-with" id="ref-for-a-promise-resolved-with⑨">a promise resolved with</a> undefined.</p> </ol> <li data-md> <p>Let <var>pull2Algorithm</var> be the following steps:</p> <ol> <li data-md> <p>If <var>reading</var> is true,</p> <ol> <li data-md> <p>Set <var>readAgainForBranch2</var> to true.</p> <li data-md> <p>Return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-resolved-with" id="ref-for-a-promise-resolved-with①⓪">a promise resolved with</a> undefined.</p> </ol> <li data-md> <p>Set <var>reading</var> to true.</p> <li data-md> <p>Let <var>byobRequest</var> be ! <a data-link-type="abstract-op" href="#abstract-opdef-readablebytestreamcontrollergetbyobrequest" id="ref-for-abstract-opdef-readablebytestreamcontrollergetbyobrequest②">ReadableByteStreamControllerGetBYOBRequest</a>(<var>branch2</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller③⑥">[[controller]]</a>).</p> <li data-md> <p>If <var>byobRequest</var> is null, perform <var>pullWithDefaultReader</var>.</p> <li data-md> <p>Otherwise, perform <var>pullWithBYOBReader</var>, given <var>byobRequest</var>.<a data-link-type="dfn" href="#readablestreambyobrequest-view" id="ref-for-readablestreambyobrequest-view⑤">[[view]]</a> and true.</p> <li data-md> <p>Return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-resolved-with" id="ref-for-a-promise-resolved-with①①">a promise resolved with</a> undefined.</p> </ol> <li data-md> <p>Let <var>cancel1Algorithm</var> be the following steps, taking a <var>reason</var> argument:</p> <ol> <li data-md> <p>Set <var>canceled1</var> to true.</p> <li data-md> <p>Set <var>reason1</var> to <var>reason</var>.</p> <li data-md> <p>If <var>canceled2</var> is true,</p> <ol> <li data-md> <p>Let <var>compositeReason</var> be ! <a data-link-type="abstract-op" href="https://tc39.es/ecma262/multipage/abstract-operations.html#sec-createarrayfromlist" id="ref-for-sec-createarrayfromlist②">CreateArrayFromList</a>(« <var>reason1</var>, <var>reason2</var> »).</p> <li data-md> <p>Let <var>cancelResult</var> be ! <a data-link-type="abstract-op" href="#readable-stream-cancel" id="ref-for-readable-stream-cancel⑨">ReadableStreamCancel</a>(<var>stream</var>, <var>compositeReason</var>).</p> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#resolve" id="ref-for-resolve①⑦">Resolve</a> <var>cancelPromise</var> with <var>cancelResult</var>.</p> </ol> <li data-md> <p>Return <var>cancelPromise</var>.</p> </ol> <li data-md> <p>Let <var>cancel2Algorithm</var> be the following steps, taking a <var>reason</var> argument:</p> <ol> <li data-md> <p>Set <var>canceled2</var> to true.</p> <li data-md> <p>Set <var>reason2</var> to <var>reason</var>.</p> <li data-md> <p>If <var>canceled1</var> is true,</p> <ol> <li data-md> <p>Let <var>compositeReason</var> be ! <a data-link-type="abstract-op" href="https://tc39.es/ecma262/multipage/abstract-operations.html#sec-createarrayfromlist" id="ref-for-sec-createarrayfromlist③">CreateArrayFromList</a>(« <var>reason1</var>, <var>reason2</var> »).</p> <li data-md> <p>Let <var>cancelResult</var> be ! <a data-link-type="abstract-op" href="#readable-stream-cancel" id="ref-for-readable-stream-cancel①⓪">ReadableStreamCancel</a>(<var>stream</var>, <var>compositeReason</var>).</p> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#resolve" id="ref-for-resolve①⑧">Resolve</a> <var>cancelPromise</var> with <var>cancelResult</var>.</p> </ol> <li data-md> <p>Return <var>cancelPromise</var>.</p> </ol> <li data-md> <p>Let <var>startAlgorithm</var> be an algorithm that returns undefined.</p> <li data-md> <p>Set <var>branch1</var> to ! <a data-link-type="abstract-op" href="#abstract-opdef-createreadablebytestream" id="ref-for-abstract-opdef-createreadablebytestream">CreateReadableByteStream</a>(<var>startAlgorithm</var>, <var>pull1Algorithm</var>, <var>cancel1Algorithm</var>).</p> <li data-md> <p>Set <var>branch2</var> to ! <a data-link-type="abstract-op" href="#abstract-opdef-createreadablebytestream" id="ref-for-abstract-opdef-createreadablebytestream①">CreateReadableByteStream</a>(<var>startAlgorithm</var>, <var>pull2Algorithm</var>, <var>cancel2Algorithm</var>).</p> <li data-md> <p>Perform <var>forwardReaderError</var>, given <var>reader</var>.</p> <li data-md> <p>Return « <var>branch1</var>, <var>branch2</var> ».</p> </ol> </div> <h4 class="heading settled" data-level="4.9.2" id="rs-abstract-ops-used-by-controllers"><span class="secno">4.9.2. </span><span class="content">Interfacing with controllers</span><a class="self-link" href="#rs-abstract-ops-used-by-controllers"></a></h4> <p>In terms of specification factoring, the way that the <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream④⓪">ReadableStream</a></code> class encapsulates the behavior of both simple readable streams and <a data-link-type="dfn" href="#readable-byte-stream" id="ref-for-readable-byte-stream①③">readable byte streams</a> into a single class is by centralizing most of the potentially-varying logic inside the two controller classes, <code class="idl"><a data-link-type="idl" href="#readablestreamdefaultcontroller" id="ref-for-readablestreamdefaultcontroller①⓪">ReadableStreamDefaultController</a></code> and <code class="idl"><a data-link-type="idl" href="#readablebytestreamcontroller" id="ref-for-readablebytestreamcontroller①⑥">ReadableByteStreamController</a></code>. Those classes define most of the stateful internal slots and abstract operations for how a stream’s <a data-link-type="dfn" href="#internal-queues" id="ref-for-internal-queues①⓪">internal queue</a> is managed and how it interfaces with its <a data-link-type="dfn" href="#underlying-source" id="ref-for-underlying-source②②">underlying source</a> or <a data-link-type="dfn" href="#underlying-byte-source" id="ref-for-underlying-byte-source①③">underlying byte source</a>.</p> <p>Each controller class defines three internal methods, which are called by the <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream④①">ReadableStream</a></code> algorithms:</p> <dl> <dt><dfn class="dfn-paneled" data-dfn-for="ReadableStreamController" data-dfn-type="abstract-op" data-export data-lt="[[CancelSteps]]" id="abstract-opdef-readablestreamcontroller-cancelsteps">[[CancelSteps]](<var>reason</var>)</dfn> <dd>The controller’s steps that run in reaction to the stream being <a data-link-type="dfn" href="#cancel-a-readable-stream" id="ref-for-cancel-a-readable-stream①①">canceled</a>, used to clean up the state stored in the controller and inform the <a data-link-type="dfn" href="#underlying-source" id="ref-for-underlying-source②③">underlying source</a>. <dt><dfn class="dfn-paneled" data-dfn-for="ReadableStreamController" data-dfn-type="abstract-op" data-export data-lt="[[PullSteps]]" id="abstract-opdef-readablestreamcontroller-pullsteps">[[PullSteps]](<var>readRequest</var>)</dfn> <dd>The controller’s steps that run when a <a data-link-type="dfn" href="#default-reader" id="ref-for-default-reader③">default reader</a> is read from, used to pull from the controller any queued <a data-link-type="dfn" href="#chunk" id="ref-for-chunk④⑨">chunks</a>, or pull from the <a data-link-type="dfn" href="#underlying-source" id="ref-for-underlying-source②④">underlying source</a> to get more chunks. <dt><dfn class="dfn-paneled" data-dfn-for="ReadableStreamController" data-dfn-type="abstract-op" data-export data-lt="[[ReleaseSteps]]" id="abstract-opdef-readablestreamcontroller-releasesteps">[[ReleaseSteps]]()</dfn> <dd>The controller’s steps that run when a <a data-link-type="dfn" href="#reader" id="ref-for-reader⑤">reader</a> is <a data-link-type="dfn" href="#release-a-lock" id="ref-for-release-a-lock⑥">released</a>, used to clean up reader-specific resources stored in the controller. </dl> <p>(These are defined as internal methods, instead of as abstract operations, so that they can be called polymorphically by the <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream④②">ReadableStream</a></code> algorithms, without having to branch on which type of controller is present.)</p> <p>The rest of this section concerns abstract operations that go in the other direction: they are used by the controller implementations to affect their associated <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream④③">ReadableStream</a></code> object. This translates internal state changes of the controller into developer-facing results visible through the <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream④④">ReadableStream</a></code>'s public API.</p> <div class="algorithm" data-algorithm="ReadableStreamAddReadIntoRequest"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableStreamAddReadIntoRequest" id="readable-stream-add-read-into-request">ReadableStreamAddReadIntoRequest(<var>stream</var>, <var>readRequest</var>)</dfn> performs the following steps: <ol> <li data-md> <p class="assertion">Assert: <var>stream</var>.<a data-link-type="dfn" href="#readablestream-reader" id="ref-for-readablestream-reader②">[[reader]]</a> <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#implements" id="ref-for-implements①②">implements</a> <code class="idl"><a data-link-type="idl" href="#readablestreambyobreader" id="ref-for-readablestreambyobreader①③">ReadableStreamBYOBReader</a></code>.</p> <li data-md> <p class="assertion">Assert: <var>stream</var>.<a data-link-type="dfn" href="#readablestream-state" id="ref-for-readablestream-state⑥">[[state]]</a> is "<code>readable</code>" or "<code>closed</code>".</p> <li data-md> <p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-append" id="ref-for-list-append①">Append</a> <var>readRequest</var> to <var>stream</var>.<a data-link-type="dfn" href="#readablestream-reader" id="ref-for-readablestream-reader③">[[reader]]</a>.<a data-link-type="dfn" href="#readablestreambyobreader-readintorequests" id="ref-for-readablestreambyobreader-readintorequests①">[[readIntoRequests]]</a>.</p> </ol> </div> <div class="algorithm" data-algorithm="ReadableStreamAddReadRequest"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableStreamAddReadRequest" id="readable-stream-add-read-request">ReadableStreamAddReadRequest(<var>stream</var>, <var>readRequest</var>)</dfn> performs the following steps: <ol> <li data-md> <p class="assertion">Assert: <var>stream</var>.<a data-link-type="dfn" href="#readablestream-reader" id="ref-for-readablestream-reader④">[[reader]]</a> <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#implements" id="ref-for-implements①③">implements</a> <code class="idl"><a data-link-type="idl" href="#readablestreamdefaultreader" id="ref-for-readablestreamdefaultreader①②">ReadableStreamDefaultReader</a></code>.</p> <li data-md> <p class="assertion">Assert: <var>stream</var>.<a data-link-type="dfn" href="#readablestream-state" id="ref-for-readablestream-state⑦">[[state]]</a> is "<code>readable</code>".</p> <li data-md> <p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-append" id="ref-for-list-append②">Append</a> <var>readRequest</var> to <var>stream</var>.<a data-link-type="dfn" href="#readablestream-reader" id="ref-for-readablestream-reader⑤">[[reader]]</a>.<a data-link-type="dfn" href="#readablestreamdefaultreader-readrequests" id="ref-for-readablestreamdefaultreader-readrequests②">[[readRequests]]</a>.</p> </ol> </div> <div class="algorithm" data-algorithm="ReadableStreamCancel"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableStreamCancel" id="readable-stream-cancel">ReadableStreamCancel(<var>stream</var>, <var>reason</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Set <var>stream</var>.<a data-link-type="dfn" href="#readablestream-disturbed" id="ref-for-readablestream-disturbed②">[[disturbed]]</a> to true.</p> <li data-md> <p>If <var>stream</var>.<a data-link-type="dfn" href="#readablestream-state" id="ref-for-readablestream-state⑧">[[state]]</a> is "<code>closed</code>", return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-resolved-with" id="ref-for-a-promise-resolved-with①②">a promise resolved with</a> undefined.</p> <li data-md> <p>If <var>stream</var>.<a data-link-type="dfn" href="#readablestream-state" id="ref-for-readablestream-state⑨">[[state]]</a> is "<code>errored</code>", return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-rejected-with" id="ref-for-a-promise-rejected-with①⑤">a promise rejected with</a> <var>stream</var>.<a data-link-type="dfn" href="#readablestream-storederror" id="ref-for-readablestream-storederror④">[[storedError]]</a>.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-close" id="ref-for-readable-stream-close①">ReadableStreamClose</a>(<var>stream</var>).</p> <li data-md> <p>Let <var>reader</var> be <var>stream</var>.<a data-link-type="dfn" href="#readablestream-reader" id="ref-for-readablestream-reader⑥">[[reader]]</a>.</p> <li data-md> <p>If <var>reader</var> is not undefined and <var>reader</var> <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#implements" id="ref-for-implements①④">implements</a> <code class="idl"><a data-link-type="idl" href="#readablestreambyobreader" id="ref-for-readablestreambyobreader①④">ReadableStreamBYOBReader</a></code>,</p> <ol> <li data-md> <p>Let <var>readIntoRequests</var> be <var>reader</var>.<a data-link-type="dfn" href="#readablestreambyobreader-readintorequests" id="ref-for-readablestreambyobreader-readintorequests②">[[readIntoRequests]]</a>.</p> <li data-md> <p>Set <var>reader</var>.<a data-link-type="dfn" href="#readablestreambyobreader-readintorequests" id="ref-for-readablestreambyobreader-readintorequests③">[[readIntoRequests]]</a> to an empty <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list" id="ref-for-list⑥">list</a>.</p> <li data-md> <p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-iterate" id="ref-for-list-iterate">For each</a> <var>readIntoRequest</var> of <var>readIntoRequests</var>,</p> <ol> <li data-md> <p>Perform <var>readIntoRequest</var>’s <a data-link-type="dfn" href="#read-into-request-close-steps" id="ref-for-read-into-request-close-steps③">close steps</a>, given undefined.</p> </ol> </ol> <li data-md> <p>Let <var>sourceCancelPromise</var> be ! <var>stream</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller③⑦">[[controller]]</a>.<a data-link-type="abstract-op" href="#abstract-opdef-readablestreamcontroller-cancelsteps" id="ref-for-abstract-opdef-readablestreamcontroller-cancelsteps②">[[CancelSteps]]</a>(<var>reason</var>).</p> <li data-md> <p>Return the result of <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-perform-steps-once-promise-is-settled" id="ref-for-dfn-perform-steps-once-promise-is-settled②">reacting</a> to <var>sourceCancelPromise</var> with a fulfillment step that returns undefined.</p> </ol> </div> <div class="algorithm" data-algorithm="ReadableStreamClose"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableStreamClose" id="readable-stream-close">ReadableStreamClose(<var>stream</var>)</dfn> performs the following steps: <ol> <li data-md> <p class="assertion">Assert: <var>stream</var>.<a data-link-type="dfn" href="#readablestream-state" id="ref-for-readablestream-state①⓪">[[state]]</a> is "<code>readable</code>".</p> <li data-md> <p>Set <var>stream</var>.<a data-link-type="dfn" href="#readablestream-state" id="ref-for-readablestream-state①①">[[state]]</a> to "<code>closed</code>".</p> <li data-md> <p>Let <var>reader</var> be <var>stream</var>.<a data-link-type="dfn" href="#readablestream-reader" id="ref-for-readablestream-reader⑦">[[reader]]</a>.</p> <li data-md> <p>If <var>reader</var> is undefined, return.</p> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#resolve" id="ref-for-resolve①⑨">Resolve</a> <var>reader</var>.<a data-link-type="dfn" href="#readablestreamgenericreader-closedpromise" id="ref-for-readablestreamgenericreader-closedpromise⑥">[[closedPromise]]</a> with undefined.</p> <li data-md> <p>If <var>reader</var> <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#implements" id="ref-for-implements①⑤">implements</a> <code class="idl"><a data-link-type="idl" href="#readablestreamdefaultreader" id="ref-for-readablestreamdefaultreader①③">ReadableStreamDefaultReader</a></code>,</p> <ol> <li data-md> <p>Let <var>readRequests</var> be <var>reader</var>.<a data-link-type="dfn" href="#readablestreamdefaultreader-readrequests" id="ref-for-readablestreamdefaultreader-readrequests③">[[readRequests]]</a>.</p> <li data-md> <p>Set <var>reader</var>.<a data-link-type="dfn" href="#readablestreamdefaultreader-readrequests" id="ref-for-readablestreamdefaultreader-readrequests④">[[readRequests]]</a> to an empty <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list" id="ref-for-list⑦">list</a>.</p> <li data-md> <p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-iterate" id="ref-for-list-iterate①">For each</a> <var>readRequest</var> of <var>readRequests</var>,</p> <ol> <li data-md> <p>Perform <var>readRequest</var>’s <a data-link-type="dfn" href="#read-request-close-steps" id="ref-for-read-request-close-steps④">close steps</a>.</p> </ol> </ol> </ol> </div> <div class="algorithm" data-algorithm="ReadableStreamError"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableStreamError" id="readable-stream-error">ReadableStreamError(<var>stream</var>, <var>e</var>)</dfn> performs the following steps: <ol> <li data-md> <p class="assertion">Assert: <var>stream</var>.<a data-link-type="dfn" href="#readablestream-state" id="ref-for-readablestream-state①②">[[state]]</a> is "<code>readable</code>".</p> <li data-md> <p>Set <var>stream</var>.<a data-link-type="dfn" href="#readablestream-state" id="ref-for-readablestream-state①③">[[state]]</a> to "<code>errored</code>".</p> <li data-md> <p>Set <var>stream</var>.<a data-link-type="dfn" href="#readablestream-storederror" id="ref-for-readablestream-storederror⑤">[[storedError]]</a> to <var>e</var>.</p> <li data-md> <p>Let <var>reader</var> be <var>stream</var>.<a data-link-type="dfn" href="#readablestream-reader" id="ref-for-readablestream-reader⑧">[[reader]]</a>.</p> <li data-md> <p>If <var>reader</var> is undefined, return.</p> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#reject" id="ref-for-reject④">Reject</a> <var>reader</var>.<a data-link-type="dfn" href="#readablestreamgenericreader-closedpromise" id="ref-for-readablestreamgenericreader-closedpromise⑦">[[closedPromise]]</a> with <var>e</var>.</p> <li data-md> <p>Set <var>reader</var>.<a data-link-type="dfn" href="#readablestreamgenericreader-closedpromise" id="ref-for-readablestreamgenericreader-closedpromise⑧">[[closedPromise]]</a>.[[PromiseIsHandled]] to true.</p> <li data-md> <p>If <var>reader</var> <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#implements" id="ref-for-implements①⑥">implements</a> <code class="idl"><a data-link-type="idl" href="#readablestreamdefaultreader" id="ref-for-readablestreamdefaultreader①④">ReadableStreamDefaultReader</a></code>,</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#abstract-opdef-readablestreamdefaultreadererrorreadrequests" id="ref-for-abstract-opdef-readablestreamdefaultreadererrorreadrequests">ReadableStreamDefaultReaderErrorReadRequests</a>(<var>reader</var>, <var>e</var>).</p> </ol> <li data-md> <p>Otherwise,</p> <ol> <li data-md> <p class="assertion">Assert: <var>reader</var> <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#implements" id="ref-for-implements①⑦">implements</a> <code class="idl"><a data-link-type="idl" href="#readablestreambyobreader" id="ref-for-readablestreambyobreader①⑤">ReadableStreamBYOBReader</a></code>.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#abstract-opdef-readablestreambyobreadererrorreadintorequests" id="ref-for-abstract-opdef-readablestreambyobreadererrorreadintorequests">ReadableStreamBYOBReaderErrorReadIntoRequests</a>(<var>reader</var>, <var>e</var>).</p> </ol> </ol> </div> <div class="algorithm" data-algorithm="ReadableStreamFulfillReadIntoRequest"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableStreamFulfillReadIntoRequest" id="readable-stream-fulfill-read-into-request">ReadableStreamFulfillReadIntoRequest(<var>stream</var>, <var>chunk</var>, <var>done</var>)</dfn> performs the following steps: <ol> <li data-md> <p class="assertion">Assert: ! <a data-link-type="abstract-op" href="#readable-stream-has-byob-reader" id="ref-for-readable-stream-has-byob-reader">ReadableStreamHasBYOBReader</a>(<var>stream</var>) is true.</p> <li data-md> <p>Let <var>reader</var> be <var>stream</var>.<a data-link-type="dfn" href="#readablestream-reader" id="ref-for-readablestream-reader⑨">[[reader]]</a>.</p> <li data-md> <p class="assertion">Assert: <var>reader</var>.<a data-link-type="dfn" href="#readablestreambyobreader-readintorequests" id="ref-for-readablestreambyobreader-readintorequests④">[[readIntoRequests]]</a> is not <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-is-empty" id="ref-for-list-is-empty⑨">empty</a>.</p> <li data-md> <p>Let <var>readIntoRequest</var> be <var>reader</var>.<a data-link-type="dfn" href="#readablestreambyobreader-readintorequests" id="ref-for-readablestreambyobreader-readintorequests⑤">[[readIntoRequests]]</a>[0].</p> <li data-md> <p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-remove" id="ref-for-list-remove">Remove</a> <var>readIntoRequest</var> from <var>reader</var>.<a data-link-type="dfn" href="#readablestreambyobreader-readintorequests" id="ref-for-readablestreambyobreader-readintorequests⑥">[[readIntoRequests]]</a>.</p> <li data-md> <p>If <var>done</var> is true, perform <var>readIntoRequest</var>’s <a data-link-type="dfn" href="#read-into-request-close-steps" id="ref-for-read-into-request-close-steps④">close steps</a>, given <var>chunk</var>.</p> <li data-md> <p>Otherwise, perform <var>readIntoRequest</var>’s <a data-link-type="dfn" href="#read-into-request-chunk-steps" id="ref-for-read-into-request-chunk-steps②">chunk steps</a>, given <var>chunk</var>.</p> </ol> </div> <div class="algorithm" data-algorithm="ReadableStreamFulfillReadRequest"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableStreamFulfillReadRequest" id="readable-stream-fulfill-read-request">ReadableStreamFulfillReadRequest(<var>stream</var>, <var>chunk</var>, <var>done</var>)</dfn> performs the following steps: <ol> <li data-md> <p class="assertion">Assert: ! <a data-link-type="abstract-op" href="#readable-stream-has-default-reader" id="ref-for-readable-stream-has-default-reader①">ReadableStreamHasDefaultReader</a>(<var>stream</var>) is true.</p> <li data-md> <p>Let <var>reader</var> be <var>stream</var>.<a data-link-type="dfn" href="#readablestream-reader" id="ref-for-readablestream-reader①⓪">[[reader]]</a>.</p> <li data-md> <p class="assertion">Assert: <var>reader</var>.<a data-link-type="dfn" href="#readablestreamdefaultreader-readrequests" id="ref-for-readablestreamdefaultreader-readrequests⑤">[[readRequests]]</a> is not <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-is-empty" id="ref-for-list-is-empty①⓪">empty</a>.</p> <li data-md> <p>Let <var>readRequest</var> be <var>reader</var>.<a data-link-type="dfn" href="#readablestreamdefaultreader-readrequests" id="ref-for-readablestreamdefaultreader-readrequests⑥">[[readRequests]]</a>[0].</p> <li data-md> <p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-remove" id="ref-for-list-remove①">Remove</a> <var>readRequest</var> from <var>reader</var>.<a data-link-type="dfn" href="#readablestreamdefaultreader-readrequests" id="ref-for-readablestreamdefaultreader-readrequests⑦">[[readRequests]]</a>.</p> <li data-md> <p>If <var>done</var> is true, perform <var>readRequest</var>’s <a data-link-type="dfn" href="#read-request-close-steps" id="ref-for-read-request-close-steps⑤">close steps</a>.</p> <li data-md> <p>Otherwise, perform <var>readRequest</var>’s <a data-link-type="dfn" href="#read-request-chunk-steps" id="ref-for-read-request-chunk-steps⑤">chunk steps</a>, given <var>chunk</var>.</p> </ol> </div> <div class="algorithm" data-algorithm="ReadableStreamGetNumReadIntoRequests"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableStreamGetNumReadIntoRequests" id="readable-stream-get-num-read-into-requests">ReadableStreamGetNumReadIntoRequests(<var>stream</var>)</dfn> performs the following steps: <ol> <li data-md> <p class="assertion">Assert: ! <a data-link-type="abstract-op" href="#readable-stream-has-byob-reader" id="ref-for-readable-stream-has-byob-reader①">ReadableStreamHasBYOBReader</a>(<var>stream</var>) is true.</p> <li data-md> <p>Return <var>stream</var>.<a data-link-type="dfn" href="#readablestream-reader" id="ref-for-readablestream-reader①①">[[reader]]</a>.<a data-link-type="dfn" href="#readablestreambyobreader-readintorequests" id="ref-for-readablestreambyobreader-readintorequests⑦">[[readIntoRequests]]</a>'s <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-size" id="ref-for-list-size">size</a>.</p> </ol> </div> <div class="algorithm" data-algorithm="ReadableStreamGetNumReadRequests"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableStreamGetNumReadRequests" id="readable-stream-get-num-read-requests">ReadableStreamGetNumReadRequests(<var>stream</var>)</dfn> performs the following steps: <ol> <li data-md> <p class="assertion">Assert: ! <a data-link-type="abstract-op" href="#readable-stream-has-default-reader" id="ref-for-readable-stream-has-default-reader②">ReadableStreamHasDefaultReader</a>(<var>stream</var>) is true.</p> <li data-md> <p>Return <var>stream</var>.<a data-link-type="dfn" href="#readablestream-reader" id="ref-for-readablestream-reader①②">[[reader]]</a>.<a data-link-type="dfn" href="#readablestreamdefaultreader-readrequests" id="ref-for-readablestreamdefaultreader-readrequests⑧">[[readRequests]]</a>'s <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-size" id="ref-for-list-size①">size</a>.</p> </ol> </div> <div class="algorithm" data-algorithm="ReadableStreamHasBYOBReader"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableStreamHasBYOBReader" id="readable-stream-has-byob-reader">ReadableStreamHasBYOBReader(<var>stream</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>reader</var> be <var>stream</var>.<a data-link-type="dfn" href="#readablestream-reader" id="ref-for-readablestream-reader①③">[[reader]]</a>.</p> <li data-md> <p>If <var>reader</var> is undefined, return false.</p> <li data-md> <p>If <var>reader</var> <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#implements" id="ref-for-implements①⑧">implements</a> <code class="idl"><a data-link-type="idl" href="#readablestreambyobreader" id="ref-for-readablestreambyobreader①⑥">ReadableStreamBYOBReader</a></code>, return true.</p> <li data-md> <p>Return false.</p> </ol> </div> <div class="algorithm" data-algorithm="ReadableStreamHasDefaultReader"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableStreamHasDefaultReader" id="readable-stream-has-default-reader">ReadableStreamHasDefaultReader(<var>stream</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>reader</var> be <var>stream</var>.<a data-link-type="dfn" href="#readablestream-reader" id="ref-for-readablestream-reader①④">[[reader]]</a>.</p> <li data-md> <p>If <var>reader</var> is undefined, return false.</p> <li data-md> <p>If <var>reader</var> <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#implements" id="ref-for-implements①⑨">implements</a> <code class="idl"><a data-link-type="idl" href="#readablestreamdefaultreader" id="ref-for-readablestreamdefaultreader①⑤">ReadableStreamDefaultReader</a></code>, return true.</p> <li data-md> <p>Return false.</p> </ol> </div> <h4 class="heading settled" data-level="4.9.3" id="rs-reader-abstract-ops"><span class="secno">4.9.3. </span><span class="content">Readers</span><a class="self-link" href="#rs-reader-abstract-ops"></a></h4> <p>The following abstract operations support the implementation and manipulation of <code class="idl"><a data-link-type="idl" href="#readablestreamdefaultreader" id="ref-for-readablestreamdefaultreader①⑥">ReadableStreamDefaultReader</a></code> and <code class="idl"><a data-link-type="idl" href="#readablestreambyobreader" id="ref-for-readablestreambyobreader①⑦">ReadableStreamBYOBReader</a></code> instances.</p> <div class="algorithm" data-algorithm="ReadableStreamReaderGenericCancel"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableStreamReaderGenericCancel" id="readable-stream-reader-generic-cancel">ReadableStreamReaderGenericCancel(<var>reader</var>, <var>reason</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>stream</var> be <var>reader</var>.<a data-link-type="dfn" href="#readablestreamgenericreader-stream" id="ref-for-readablestreamgenericreader-stream⑦">[[stream]]</a>.</p> <li data-md> <p class="assertion">Assert: <var>stream</var> is not undefined.</p> <li data-md> <p>Return ! <a data-link-type="abstract-op" href="#readable-stream-cancel" id="ref-for-readable-stream-cancel①①">ReadableStreamCancel</a>(<var>stream</var>, <var>reason</var>).</p> </ol> </div> <div class="algorithm" data-algorithm="ReadableStreamReaderGenericInitialize"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableStreamReaderGenericInitialize" id="readable-stream-reader-generic-initialize">ReadableStreamReaderGenericInitialize(<var>reader</var>, <var>stream</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Set <var>reader</var>.<a data-link-type="dfn" href="#readablestreamgenericreader-stream" id="ref-for-readablestreamgenericreader-stream⑧">[[stream]]</a> to <var>stream</var>.</p> <li data-md> <p>Set <var>stream</var>.<a data-link-type="dfn" href="#readablestream-reader" id="ref-for-readablestream-reader①⑤">[[reader]]</a> to <var>reader</var>.</p> <li data-md> <p>If <var>stream</var>.<a data-link-type="dfn" href="#readablestream-state" id="ref-for-readablestream-state①④">[[state]]</a> is "<code>readable</code>",</p> <ol> <li data-md> <p>Set <var>reader</var>.<a data-link-type="dfn" href="#readablestreamgenericreader-closedpromise" id="ref-for-readablestreamgenericreader-closedpromise⑨">[[closedPromise]]</a> to <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-new-promise" id="ref-for-a-new-promise⑥">a new promise</a>.</p> </ol> <li data-md> <p>Otherwise, if <var>stream</var>.<a data-link-type="dfn" href="#readablestream-state" id="ref-for-readablestream-state①⑤">[[state]]</a> is "<code>closed</code>",</p> <ol> <li data-md> <p>Set <var>reader</var>.<a data-link-type="dfn" href="#readablestreamgenericreader-closedpromise" id="ref-for-readablestreamgenericreader-closedpromise①⓪">[[closedPromise]]</a> to <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-resolved-with" id="ref-for-a-promise-resolved-with①③">a promise resolved with</a> undefined.</p> </ol> <li data-md> <p>Otherwise,</p> <ol> <li data-md> <p class="assertion">Assert: <var>stream</var>.<a data-link-type="dfn" href="#readablestream-state" id="ref-for-readablestream-state①⑥">[[state]]</a> is "<code>errored</code>".</p> <li data-md> <p>Set <var>reader</var>.<a data-link-type="dfn" href="#readablestreamgenericreader-closedpromise" id="ref-for-readablestreamgenericreader-closedpromise①①">[[closedPromise]]</a> to <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-rejected-with" id="ref-for-a-promise-rejected-with①⑥">a promise rejected with</a> <var>stream</var>.<a data-link-type="dfn" href="#readablestream-storederror" id="ref-for-readablestream-storederror⑥">[[storedError]]</a>.</p> <li data-md> <p>Set <var>reader</var>.<a data-link-type="dfn" href="#readablestreamgenericreader-closedpromise" id="ref-for-readablestreamgenericreader-closedpromise①②">[[closedPromise]]</a>.[[PromiseIsHandled]] to true.</p> </ol> </ol> </div> <div class="algorithm" data-algorithm="ReadableStreamReaderGenericRelease"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableStreamReaderGenericRelease" id="readable-stream-reader-generic-release">ReadableStreamReaderGenericRelease(<var>reader</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>stream</var> be <var>reader</var>.<a data-link-type="dfn" href="#readablestreamgenericreader-stream" id="ref-for-readablestreamgenericreader-stream⑨">[[stream]]</a>.</p> <li data-md> <p class="assertion">Assert: <var>stream</var> is not undefined.</p> <li data-md> <p class="assertion">Assert: <var>stream</var>.<a data-link-type="dfn" href="#readablestream-reader" id="ref-for-readablestream-reader①⑥">[[reader]]</a> is <var>reader</var>.</p> <li data-md> <p>If <var>stream</var>.<a data-link-type="dfn" href="#readablestream-state" id="ref-for-readablestream-state①⑦">[[state]]</a> is "<code>readable</code>", <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#reject" id="ref-for-reject⑤">reject</a> <var>reader</var>.<a data-link-type="dfn" href="#readablestreamgenericreader-closedpromise" id="ref-for-readablestreamgenericreader-closedpromise①③">[[closedPromise]]</a> with a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror③①">TypeError</a></code> exception.</p> <li data-md> <p>Otherwise, set <var>reader</var>.<a data-link-type="dfn" href="#readablestreamgenericreader-closedpromise" id="ref-for-readablestreamgenericreader-closedpromise①④">[[closedPromise]]</a> to <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-rejected-with" id="ref-for-a-promise-rejected-with①⑦">a promise rejected with</a> a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror③②">TypeError</a></code> exception.</p> <li data-md> <p>Set <var>reader</var>.<a data-link-type="dfn" href="#readablestreamgenericreader-closedpromise" id="ref-for-readablestreamgenericreader-closedpromise①⑤">[[closedPromise]]</a>.[[PromiseIsHandled]] to true.</p> <li data-md> <p>Perform ! <var>stream</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller③⑧">[[controller]]</a>.<a data-link-type="abstract-op" href="#abstract-opdef-readablestreamcontroller-releasesteps" id="ref-for-abstract-opdef-readablestreamcontroller-releasesteps②">[[ReleaseSteps]]</a>().</p> <li data-md> <p>Set <var>stream</var>.<a data-link-type="dfn" href="#readablestream-reader" id="ref-for-readablestream-reader①⑦">[[reader]]</a> to undefined.</p> <li data-md> <p>Set <var>reader</var>.<a data-link-type="dfn" href="#readablestreamgenericreader-stream" id="ref-for-readablestreamgenericreader-stream①⓪">[[stream]]</a> to undefined.</p> </ol> </div> <div class="algorithm" data-algorithm="ReadableStreamBYOBReaderErrorReadIntoRequests"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableStreamBYOBReaderErrorReadIntoRequests" id="abstract-opdef-readablestreambyobreadererrorreadintorequests">ReadableStreamBYOBReaderErrorReadIntoRequests(<var>reader</var>, <var>e</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>readIntoRequests</var> be <var>reader</var>.<a data-link-type="dfn" href="#readablestreambyobreader-readintorequests" id="ref-for-readablestreambyobreader-readintorequests⑧">[[readIntoRequests]]</a>.</p> <li data-md> <p>Set <var>reader</var>.<a data-link-type="dfn" href="#readablestreambyobreader-readintorequests" id="ref-for-readablestreambyobreader-readintorequests⑨">[[readIntoRequests]]</a> to a new empty <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list" id="ref-for-list⑧">list</a>.</p> <li data-md> <p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-iterate" id="ref-for-list-iterate②">For each</a> <var>readIntoRequest</var> of <var>readIntoRequests</var>,</p> <ol> <li data-md> <p>Perform <var>readIntoRequest</var>’s <a data-link-type="dfn" href="#read-into-request-error-steps" id="ref-for-read-into-request-error-steps②">error steps</a>, given <var>e</var>.</p> </ol> </ol> </div> <div class="algorithm" data-algorithm="ReadableStreamBYOBReaderRead"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableStreamBYOBReaderRead" id="readable-stream-byob-reader-read">ReadableStreamBYOBReaderRead(<var>reader</var>, <var>view</var>, <var>min</var>, <var>readIntoRequest</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>stream</var> be <var>reader</var>.<a data-link-type="dfn" href="#readablestreamgenericreader-stream" id="ref-for-readablestreamgenericreader-stream①①">[[stream]]</a>.</p> <li data-md> <p class="assertion">Assert: <var>stream</var> is not undefined.</p> <li data-md> <p>Set <var>stream</var>.<a data-link-type="dfn" href="#readablestream-disturbed" id="ref-for-readablestream-disturbed③">[[disturbed]]</a> to true.</p> <li data-md> <p>If <var>stream</var>.<a data-link-type="dfn" href="#readablestream-state" id="ref-for-readablestream-state①⑧">[[state]]</a> is "<code>errored</code>", perform <var>readIntoRequest</var>’s <a data-link-type="dfn" href="#read-into-request-error-steps" id="ref-for-read-into-request-error-steps③">error steps</a> given <var>stream</var>.<a data-link-type="dfn" href="#readablestream-storederror" id="ref-for-readablestream-storederror⑦">[[storedError]]</a>.</p> <li data-md> <p>Otherwise, perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-pull-into" id="ref-for-readable-byte-stream-controller-pull-into">ReadableByteStreamControllerPullInto</a>(<var>stream</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller③⑨">[[controller]]</a>, <var>view</var>, <var>min</var>, <var>readIntoRequest</var>).</p> </ol> </div> <div class="algorithm" data-algorithm="ReadableStreamBYOBReaderRelease"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableStreamBYOBReaderRelease" id="abstract-opdef-readablestreambyobreaderrelease">ReadableStreamBYOBReaderRelease(<var>reader</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-reader-generic-release" id="ref-for-readable-stream-reader-generic-release">ReadableStreamReaderGenericRelease</a>(<var>reader</var>).</p> <li data-md> <p>Let <var>e</var> be a new <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror③③">TypeError</a></code> exception.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#abstract-opdef-readablestreambyobreadererrorreadintorequests" id="ref-for-abstract-opdef-readablestreambyobreadererrorreadintorequests①">ReadableStreamBYOBReaderErrorReadIntoRequests</a>(<var>reader</var>, <var>e</var>).</p> </ol> </div> <div class="algorithm" data-algorithm="ReadableStreamDefaultReaderErrorReadRequests"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableStreamDefaultReaderErrorReadRequests" id="abstract-opdef-readablestreamdefaultreadererrorreadrequests">ReadableStreamDefaultReaderErrorReadRequests(<var>reader</var>, <var>e</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>readRequests</var> be <var>reader</var>.<a data-link-type="dfn" href="#readablestreamdefaultreader-readrequests" id="ref-for-readablestreamdefaultreader-readrequests⑨">[[readRequests]]</a>.</p> <li data-md> <p>Set <var>reader</var>.<a data-link-type="dfn" href="#readablestreamdefaultreader-readrequests" id="ref-for-readablestreamdefaultreader-readrequests①⓪">[[readRequests]]</a> to a new empty <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list" id="ref-for-list⑨">list</a>.</p> <li data-md> <p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-iterate" id="ref-for-list-iterate③">For each</a> <var>readRequest</var> of <var>readRequests</var>,</p> <ol> <li data-md> <p>Perform <var>readRequest</var>’s <a data-link-type="dfn" href="#read-request-error-steps" id="ref-for-read-request-error-steps⑤">error steps</a>, given <var>e</var>.</p> </ol> </ol> </div> <div class="algorithm" data-algorithm="ReadableStreamDefaultReaderRead"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableStreamDefaultReaderRead" id="readable-stream-default-reader-read">ReadableStreamDefaultReaderRead(<var>reader</var>, <var>readRequest</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>stream</var> be <var>reader</var>.<a data-link-type="dfn" href="#readablestreamgenericreader-stream" id="ref-for-readablestreamgenericreader-stream①②">[[stream]]</a>.</p> <li data-md> <p class="assertion">Assert: <var>stream</var> is not undefined.</p> <li data-md> <p>Set <var>stream</var>.<a data-link-type="dfn" href="#readablestream-disturbed" id="ref-for-readablestream-disturbed④">[[disturbed]]</a> to true.</p> <li data-md> <p>If <var>stream</var>.<a data-link-type="dfn" href="#readablestream-state" id="ref-for-readablestream-state①⑨">[[state]]</a> is "<code>closed</code>", perform <var>readRequest</var>’s <a data-link-type="dfn" href="#read-request-close-steps" id="ref-for-read-request-close-steps⑥">close steps</a>.</p> <li data-md> <p>Otherwise, if <var>stream</var>.<a data-link-type="dfn" href="#readablestream-state" id="ref-for-readablestream-state②⓪">[[state]]</a> is "<code>errored</code>", perform <var>readRequest</var>’s <a data-link-type="dfn" href="#read-request-error-steps" id="ref-for-read-request-error-steps⑥">error steps</a> given <var>stream</var>.<a data-link-type="dfn" href="#readablestream-storederror" id="ref-for-readablestream-storederror⑧">[[storedError]]</a>.</p> <li data-md> <p>Otherwise,</p> <ol> <li data-md> <p class="assertion">Assert: <var>stream</var>.<a data-link-type="dfn" href="#readablestream-state" id="ref-for-readablestream-state②①">[[state]]</a> is "<code>readable</code>".</p> <li data-md> <p>Perform ! <var>stream</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller④⓪">[[controller]]</a>.<a data-link-type="abstract-op" href="#abstract-opdef-readablestreamcontroller-pullsteps" id="ref-for-abstract-opdef-readablestreamcontroller-pullsteps②">[[PullSteps]]</a>(<var>readRequest</var>).</p> </ol> </ol> </div> <div class="algorithm" data-algorithm="ReadableStreamDefaultReaderRelease"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableStreamDefaultReaderRelease" id="abstract-opdef-readablestreamdefaultreaderrelease">ReadableStreamDefaultReaderRelease(<var>reader</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-reader-generic-release" id="ref-for-readable-stream-reader-generic-release①">ReadableStreamReaderGenericRelease</a>(<var>reader</var>).</p> <li data-md> <p>Let <var>e</var> be a new <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror③④">TypeError</a></code> exception.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#abstract-opdef-readablestreamdefaultreadererrorreadrequests" id="ref-for-abstract-opdef-readablestreamdefaultreadererrorreadrequests①">ReadableStreamDefaultReaderErrorReadRequests</a>(<var>reader</var>, <var>e</var>).</p> </ol> </div> <div class="algorithm" data-algorithm="SetUpReadableStreamBYOBReader"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="SetUpReadableStreamBYOBReader" id="set-up-readable-stream-byob-reader">SetUpReadableStreamBYOBReader(<var>reader</var>, <var>stream</var>)</dfn> performs the following steps: <ol> <li data-md> <p>If ! <a data-link-type="abstract-op" href="#is-readable-stream-locked" id="ref-for-is-readable-stream-locked⑥">IsReadableStreamLocked</a>(<var>stream</var>) is true, throw a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror③⑤">TypeError</a></code> exception.</p> <li data-md> <p>If <var>stream</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller④①">[[controller]]</a> does not <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#implements" id="ref-for-implements②⓪">implement</a> <code class="idl"><a data-link-type="idl" href="#readablebytestreamcontroller" id="ref-for-readablebytestreamcontroller①⑦">ReadableByteStreamController</a></code>, throw a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror③⑥">TypeError</a></code> exception.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-reader-generic-initialize" id="ref-for-readable-stream-reader-generic-initialize">ReadableStreamReaderGenericInitialize</a>(<var>reader</var>, <var>stream</var>).</p> <li data-md> <p>Set <var>reader</var>.<a data-link-type="dfn" href="#readablestreambyobreader-readintorequests" id="ref-for-readablestreambyobreader-readintorequests①⓪">[[readIntoRequests]]</a> to a new empty <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list" id="ref-for-list①⓪">list</a>.</p> </ol> </div> <div class="algorithm" data-algorithm="SetUpReadableStreamDefaultReader"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="SetUpReadableStreamDefaultReader" id="set-up-readable-stream-default-reader">SetUpReadableStreamDefaultReader(<var>reader</var>, <var>stream</var>)</dfn> performs the following steps: <ol> <li data-md> <p>If ! <a data-link-type="abstract-op" href="#is-readable-stream-locked" id="ref-for-is-readable-stream-locked⑦">IsReadableStreamLocked</a>(<var>stream</var>) is true, throw a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror③⑦">TypeError</a></code> exception.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-reader-generic-initialize" id="ref-for-readable-stream-reader-generic-initialize①">ReadableStreamReaderGenericInitialize</a>(<var>reader</var>, <var>stream</var>).</p> <li data-md> <p>Set <var>reader</var>.<a data-link-type="dfn" href="#readablestreamdefaultreader-readrequests" id="ref-for-readablestreamdefaultreader-readrequests①①">[[readRequests]]</a> to a new empty <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list" id="ref-for-list①①">list</a>.</p> </ol> </div> <h4 class="heading settled" data-level="4.9.4" id="rs-default-controller-abstract-ops"><span class="secno">4.9.4. </span><span class="content">Default controllers</span><a class="self-link" href="#rs-default-controller-abstract-ops"></a></h4> <p>The following abstract operations support the implementation of the <code class="idl"><a data-link-type="idl" href="#readablestreamdefaultcontroller" id="ref-for-readablestreamdefaultcontroller①①">ReadableStreamDefaultController</a></code> class.</p> <div class="algorithm" data-algorithm="ReadableStreamDefaultControllerCallPullIfNeeded"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableStreamDefaultControllerCallPullIfNeeded" id="readable-stream-default-controller-call-pull-if-needed">ReadableStreamDefaultControllerCallPullIfNeeded(<var>controller</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>shouldPull</var> be ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-should-call-pull" id="ref-for-readable-stream-default-controller-should-call-pull">ReadableStreamDefaultControllerShouldCallPull</a>(<var>controller</var>).</p> <li data-md> <p>If <var>shouldPull</var> is false, return.</p> <li data-md> <p>If <var>controller</var>.<a data-link-type="dfn" href="#readablestreamdefaultcontroller-pulling" id="ref-for-readablestreamdefaultcontroller-pulling">[[pulling]]</a> is true,</p> <ol> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#readablestreamdefaultcontroller-pullagain" id="ref-for-readablestreamdefaultcontroller-pullagain">[[pullAgain]]</a> to true.</p> <li data-md> <p>Return.</p> </ol> <li data-md> <p class="assertion">Assert: <var>controller</var>.<a data-link-type="dfn" href="#readablestreamdefaultcontroller-pullagain" id="ref-for-readablestreamdefaultcontroller-pullagain①">[[pullAgain]]</a> is false.</p> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#readablestreamdefaultcontroller-pulling" id="ref-for-readablestreamdefaultcontroller-pulling①">[[pulling]]</a> to true.</p> <li data-md> <p>Let <var>pullPromise</var> be the result of performing <var>controller</var>.<a data-link-type="dfn" href="#readablestreamdefaultcontroller-pullalgorithm" id="ref-for-readablestreamdefaultcontroller-pullalgorithm">[[pullAlgorithm]]</a>.</p> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#upon-fulfillment" id="ref-for-upon-fulfillment①">Upon fulfillment</a> of <var>pullPromise</var>,</p> <ol> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#readablestreamdefaultcontroller-pulling" id="ref-for-readablestreamdefaultcontroller-pulling②">[[pulling]]</a> to false.</p> <li data-md> <p>If <var>controller</var>.<a data-link-type="dfn" href="#readablestreamdefaultcontroller-pullagain" id="ref-for-readablestreamdefaultcontroller-pullagain②">[[pullAgain]]</a> is true,</p> <ol> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#readablestreamdefaultcontroller-pullagain" id="ref-for-readablestreamdefaultcontroller-pullagain③">[[pullAgain]]</a> to false.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-call-pull-if-needed" id="ref-for-readable-stream-default-controller-call-pull-if-needed②">ReadableStreamDefaultControllerCallPullIfNeeded</a>(<var>controller</var>).</p> </ol> </ol> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#upon-rejection" id="ref-for-upon-rejection③">Upon rejection</a> of <var>pullPromise</var> with reason <var>e</var>,</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-error" id="ref-for-readable-stream-default-controller-error⑤">ReadableStreamDefaultControllerError</a>(<var>controller</var>, <var>e</var>).</p> </ol> </ol> </div> <div class="algorithm" data-algorithm="ReadableStreamDefaultControllerShouldCallPull"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableStreamDefaultControllerShouldCallPull" id="readable-stream-default-controller-should-call-pull">ReadableStreamDefaultControllerShouldCallPull(<var>controller</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>stream</var> be <var>controller</var>.<a data-link-type="dfn" href="#readablestreamdefaultcontroller-stream" id="ref-for-readablestreamdefaultcontroller-stream①">[[stream]]</a>.</p> <li data-md> <p>If ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-can-close-or-enqueue" id="ref-for-readable-stream-default-controller-can-close-or-enqueue②">ReadableStreamDefaultControllerCanCloseOrEnqueue</a>(<var>controller</var>) is false, return false.</p> <li data-md> <p>If <var>controller</var>.<a data-link-type="dfn" href="#readablestreamdefaultcontroller-started" id="ref-for-readablestreamdefaultcontroller-started">[[started]]</a> is false, return false.</p> <li data-md> <p>If ! <a data-link-type="abstract-op" href="#is-readable-stream-locked" id="ref-for-is-readable-stream-locked⑧">IsReadableStreamLocked</a>(<var>stream</var>) is true and ! <a data-link-type="abstract-op" href="#readable-stream-get-num-read-requests" id="ref-for-readable-stream-get-num-read-requests①">ReadableStreamGetNumReadRequests</a>(<var>stream</var>) > 0, return true.</p> <li data-md> <p>Let <var>desiredSize</var> be ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-get-desired-size" id="ref-for-readable-stream-default-controller-get-desired-size①">ReadableStreamDefaultControllerGetDesiredSize</a>(<var>controller</var>).</p> <li data-md> <p class="assertion">Assert: <var>desiredSize</var> is not null.</p> <li data-md> <p>If <var>desiredSize</var> > 0, return true.</p> <li data-md> <p>Return false.</p> </ol> </div> <div class="algorithm" data-algorithm="ReadableStreamDefaultControllerClearAlgorithms"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableStreamDefaultControllerClearAlgorithms" id="readable-stream-default-controller-clear-algorithms">ReadableStreamDefaultControllerClearAlgorithms(<var>controller</var>)</dfn> is called once the stream is closed or errored and the algorithms will not be executed any more. By removing the algorithm references it permits the <a data-link-type="dfn" href="#underlying-source" id="ref-for-underlying-source②⑤">underlying source</a> object to be garbage collected even if the <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream④⑤">ReadableStream</a></code> itself is still referenced. <p class="note" role="note">This is observable using <a href="https://github.com/tc39/proposal-weakrefs/">weak references</a>. See <a href="https://github.com/tc39/proposal-weakrefs/issues/31">tc39/proposal-weakrefs#31</a> for more detail. </p> <p>It performs the following steps:</p> <ol> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#readablestreamdefaultcontroller-pullalgorithm" id="ref-for-readablestreamdefaultcontroller-pullalgorithm①">[[pullAlgorithm]]</a> to undefined.</p> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#readablestreamdefaultcontroller-cancelalgorithm" id="ref-for-readablestreamdefaultcontroller-cancelalgorithm①">[[cancelAlgorithm]]</a> to undefined.</p> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#readablestreamdefaultcontroller-strategysizealgorithm" id="ref-for-readablestreamdefaultcontroller-strategysizealgorithm">[[strategySizeAlgorithm]]</a> to undefined.</p> </ol> </div> <div class="algorithm" data-algorithm="ReadableStreamDefaultControllerClose"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableStreamDefaultControllerClose" id="readable-stream-default-controller-close">ReadableStreamDefaultControllerClose(<var>controller</var>)</dfn> performs the following steps: <ol> <li data-md> <p>If ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-can-close-or-enqueue" id="ref-for-readable-stream-default-controller-can-close-or-enqueue③">ReadableStreamDefaultControllerCanCloseOrEnqueue</a>(<var>controller</var>) is false, return.</p> <li data-md> <p>Let <var>stream</var> be <var>controller</var>.<a data-link-type="dfn" href="#readablestreamdefaultcontroller-stream" id="ref-for-readablestreamdefaultcontroller-stream②">[[stream]]</a>.</p> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#readablestreamdefaultcontroller-closerequested" id="ref-for-readablestreamdefaultcontroller-closerequested①">[[closeRequested]]</a> to true.</p> <li data-md> <p>If <var>controller</var>.<a data-link-type="dfn" href="#readablestreamdefaultcontroller-queue" id="ref-for-readablestreamdefaultcontroller-queue③">[[queue]]</a> <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-is-empty" id="ref-for-list-is-empty①①">is empty</a>,</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-clear-algorithms" id="ref-for-readable-stream-default-controller-clear-algorithms②">ReadableStreamDefaultControllerClearAlgorithms</a>(<var>controller</var>).</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-close" id="ref-for-readable-stream-close②">ReadableStreamClose</a>(<var>stream</var>).</p> </ol> </ol> </div> <div class="algorithm" data-algorithm="ReadableStreamDefaultControllerEnqueue"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableStreamDefaultControllerEnqueue" id="readable-stream-default-controller-enqueue">ReadableStreamDefaultControllerEnqueue(<var>controller</var>, <var>chunk</var>)</dfn> performs the following steps: <ol> <li data-md> <p>If ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-can-close-or-enqueue" id="ref-for-readable-stream-default-controller-can-close-or-enqueue④">ReadableStreamDefaultControllerCanCloseOrEnqueue</a>(<var>controller</var>) is false, return.</p> <li data-md> <p>Let <var>stream</var> be <var>controller</var>.<a data-link-type="dfn" href="#readablestreamdefaultcontroller-stream" id="ref-for-readablestreamdefaultcontroller-stream③">[[stream]]</a>.</p> <li data-md> <p>If ! <a data-link-type="abstract-op" href="#is-readable-stream-locked" id="ref-for-is-readable-stream-locked⑨">IsReadableStreamLocked</a>(<var>stream</var>) is true and ! <a data-link-type="abstract-op" href="#readable-stream-get-num-read-requests" id="ref-for-readable-stream-get-num-read-requests②">ReadableStreamGetNumReadRequests</a>(<var>stream</var>) > 0, perform ! <a data-link-type="abstract-op" href="#readable-stream-fulfill-read-request" id="ref-for-readable-stream-fulfill-read-request">ReadableStreamFulfillReadRequest</a>(<var>stream</var>, <var>chunk</var>, false).</p> <li data-md> <p>Otherwise,</p> <ol> <li data-md> <p>Let <var>result</var> be the result of performing <var>controller</var>.<a data-link-type="dfn" href="#readablestreamdefaultcontroller-strategysizealgorithm" id="ref-for-readablestreamdefaultcontroller-strategysizealgorithm①">[[strategySizeAlgorithm]]</a>, passing in <var>chunk</var>, and interpreting the result as a <a data-link-type="dfn" href="https://tc39.es/ecma262/multipage/ecmascript-data-types-and-values.html#sec-completion-record-specification-type" id="ref-for-sec-completion-record-specification-type①">completion record</a>.</p> <li data-md> <p>If <var>result</var> is an abrupt completion,</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-error" id="ref-for-readable-stream-default-controller-error⑥">ReadableStreamDefaultControllerError</a>(<var>controller</var>, <var>result</var>.[[Value]]).</p> <li data-md> <p>Return <var>result</var>.</p> </ol> <li data-md> <p>Let <var>chunkSize</var> be <var>result</var>.[[Value]].</p> <li data-md> <p>Let <var>enqueueResult</var> be <a data-link-type="abstract-op" href="#enqueue-value-with-size" id="ref-for-enqueue-value-with-size">EnqueueValueWithSize</a>(<var>controller</var>, <var>chunk</var>, <var>chunkSize</var>).</p> <li data-md> <p>If <var>enqueueResult</var> is an abrupt completion,</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-error" id="ref-for-readable-stream-default-controller-error⑦">ReadableStreamDefaultControllerError</a>(<var>controller</var>, <var>enqueueResult</var>.[[Value]]).</p> <li data-md> <p>Return <var>enqueueResult</var>.</p> </ol> </ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-call-pull-if-needed" id="ref-for-readable-stream-default-controller-call-pull-if-needed③">ReadableStreamDefaultControllerCallPullIfNeeded</a>(<var>controller</var>).</p> </ol> </div> <div class="algorithm" data-algorithm="ReadableStreamDefaultControllerError"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableStreamDefaultControllerError" id="readable-stream-default-controller-error">ReadableStreamDefaultControllerError(<var>controller</var>, <var>e</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>stream</var> be <var>controller</var>.<a data-link-type="dfn" href="#readablestreamdefaultcontroller-stream" id="ref-for-readablestreamdefaultcontroller-stream④">[[stream]]</a>.</p> <li data-md> <p>If <var>stream</var>.<a data-link-type="dfn" href="#readablestream-state" id="ref-for-readablestream-state②②">[[state]]</a> is not "<code>readable</code>", return.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#reset-queue" id="ref-for-reset-queue②">ResetQueue</a>(<var>controller</var>).</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-clear-algorithms" id="ref-for-readable-stream-default-controller-clear-algorithms③">ReadableStreamDefaultControllerClearAlgorithms</a>(<var>controller</var>).</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-error" id="ref-for-readable-stream-error">ReadableStreamError</a>(<var>stream</var>, <var>e</var>).</p> </ol> </div> <div class="algorithm" data-algorithm="ReadableStreamDefaultControllerGetDesiredSize"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableStreamDefaultControllerGetDesiredSize" id="readable-stream-default-controller-get-desired-size">ReadableStreamDefaultControllerGetDesiredSize(<var>controller</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>state</var> be <var>controller</var>.<a data-link-type="dfn" href="#readablestreamdefaultcontroller-stream" id="ref-for-readablestreamdefaultcontroller-stream⑤">[[stream]]</a>.<a data-link-type="dfn" href="#readablestream-state" id="ref-for-readablestream-state②③">[[state]]</a>.</p> <li data-md> <p>If <var>state</var> is "<code>errored</code>", return null.</p> <li data-md> <p>If <var>state</var> is "<code>closed</code>", return 0.</p> <li data-md> <p>Return <var>controller</var>.<a data-link-type="dfn" href="#readablestreamdefaultcontroller-strategyhwm" id="ref-for-readablestreamdefaultcontroller-strategyhwm">[[strategyHWM]]</a> − <var>controller</var>.<a data-link-type="dfn" href="#readablestreamdefaultcontroller-queuetotalsize" id="ref-for-readablestreamdefaultcontroller-queuetotalsize">[[queueTotalSize]]</a>.</p> </ol> </div> <div class="algorithm" data-algorithm="ReadableStreamDefaultControllerHasBackpressure"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableStreamDefaultControllerHasBackpressure" id="rs-default-controller-has-backpressure">ReadableStreamDefaultControllerHasBackpressure(<var>controller</var>)</dfn> is used in the implementation of <code class="idl"><a data-link-type="idl" href="#transformstream" id="ref-for-transformstream②">TransformStream</a></code>. It performs the following steps: <ol> <li data-md> <p>If ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-should-call-pull" id="ref-for-readable-stream-default-controller-should-call-pull①">ReadableStreamDefaultControllerShouldCallPull</a>(<var>controller</var>) is true, return false.</p> <li data-md> <p>Otherwise, return true.</p> </ol> </div> <div class="algorithm" data-algorithm="ReadableStreamDefaultControllerCanCloseOrEnqueue"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableStreamDefaultControllerCanCloseOrEnqueue" id="readable-stream-default-controller-can-close-or-enqueue">ReadableStreamDefaultControllerCanCloseOrEnqueue(<var>controller</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>state</var> be <var>controller</var>.<a data-link-type="dfn" href="#readablestreamdefaultcontroller-stream" id="ref-for-readablestreamdefaultcontroller-stream⑥">[[stream]]</a>.<a data-link-type="dfn" href="#readablestream-state" id="ref-for-readablestream-state②④">[[state]]</a>.</p> <li data-md> <p>If <var>controller</var>.<a data-link-type="dfn" href="#readablestreamdefaultcontroller-closerequested" id="ref-for-readablestreamdefaultcontroller-closerequested②">[[closeRequested]]</a> is false and <var>state</var> is "<code>readable</code>", return true.</p> <li data-md> <p>Otherwise, return false.</p> </ol> <p class="note" role="note">The case where <var>controller</var>.<a data-link-type="dfn" href="#readablestreamdefaultcontroller-closerequested" id="ref-for-readablestreamdefaultcontroller-closerequested③">[[closeRequested]]</a> is false, but <var>state</var> is not "<code>readable</code>", happens when the stream is errored via <code class="idl"><a data-link-type="idl" href="#rs-default-controller-error" id="ref-for-rs-default-controller-error②">controller.error()</a></code>, or when it is closed without its controller’s <code class="idl"><a data-link-type="idl" href="#rs-default-controller-close" id="ref-for-rs-default-controller-close②">controller.close()</a></code> method ever being called: e.g., if the stream was closed by a call to <code class="idl"><a data-link-type="idl" href="#rs-cancel" id="ref-for-rs-cancel⑥">stream.cancel()</a></code>. </p> </div> <div class="algorithm" data-algorithm="SetUpReadableStreamDefaultController"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="SetUpReadableStreamDefaultController" id="set-up-readable-stream-default-controller">SetUpReadableStreamDefaultController(<var>stream</var>, <var>controller</var>, <var>startAlgorithm</var>, <var>pullAlgorithm</var>, <var>cancelAlgorithm</var>, <var>highWaterMark</var>, <var>sizeAlgorithm</var>)</dfn> performs the following steps: <ol> <li data-md> <p class="assertion">Assert: <var>stream</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller④②">[[controller]]</a> is undefined.</p> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#readablestreamdefaultcontroller-stream" id="ref-for-readablestreamdefaultcontroller-stream⑦">[[stream]]</a> to <var>stream</var>.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#reset-queue" id="ref-for-reset-queue③">ResetQueue</a>(<var>controller</var>).</p> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#readablestreamdefaultcontroller-started" id="ref-for-readablestreamdefaultcontroller-started①">[[started]]</a>, <var>controller</var>.<a data-link-type="dfn" href="#readablestreamdefaultcontroller-closerequested" id="ref-for-readablestreamdefaultcontroller-closerequested④">[[closeRequested]]</a>, <var>controller</var>.<a data-link-type="dfn" href="#readablestreamdefaultcontroller-pullagain" id="ref-for-readablestreamdefaultcontroller-pullagain④">[[pullAgain]]</a>, and <var>controller</var>.<a data-link-type="dfn" href="#readablestreamdefaultcontroller-pulling" id="ref-for-readablestreamdefaultcontroller-pulling③">[[pulling]]</a> to false.</p> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#readablestreamdefaultcontroller-strategysizealgorithm" id="ref-for-readablestreamdefaultcontroller-strategysizealgorithm②">[[strategySizeAlgorithm]]</a> to <var>sizeAlgorithm</var> and <var>controller</var>.<a data-link-type="dfn" href="#readablestreamdefaultcontroller-strategyhwm" id="ref-for-readablestreamdefaultcontroller-strategyhwm①">[[strategyHWM]]</a> to <var>highWaterMark</var>.</p> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#readablestreamdefaultcontroller-pullalgorithm" id="ref-for-readablestreamdefaultcontroller-pullalgorithm②">[[pullAlgorithm]]</a> to <var>pullAlgorithm</var>.</p> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#readablestreamdefaultcontroller-cancelalgorithm" id="ref-for-readablestreamdefaultcontroller-cancelalgorithm②">[[cancelAlgorithm]]</a> to <var>cancelAlgorithm</var>.</p> <li data-md> <p>Set <var>stream</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller④③">[[controller]]</a> to <var>controller</var>.</p> <li data-md> <p>Let <var>startResult</var> be the result of performing <var>startAlgorithm</var>. (This might throw an exception.)</p> <li data-md> <p>Let <var>startPromise</var> be <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-resolved-with" id="ref-for-a-promise-resolved-with①④">a promise resolved with</a> <var>startResult</var>.</p> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#upon-fulfillment" id="ref-for-upon-fulfillment②">Upon fulfillment</a> of <var>startPromise</var>,</p> <ol> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#readablestreamdefaultcontroller-started" id="ref-for-readablestreamdefaultcontroller-started②">[[started]]</a> to true.</p> <li data-md> <p class="assertion">Assert: <var>controller</var>.<a data-link-type="dfn" href="#readablestreamdefaultcontroller-pulling" id="ref-for-readablestreamdefaultcontroller-pulling④">[[pulling]]</a> is false.</p> <li data-md> <p class="assertion">Assert: <var>controller</var>.<a data-link-type="dfn" href="#readablestreamdefaultcontroller-pullagain" id="ref-for-readablestreamdefaultcontroller-pullagain⑤">[[pullAgain]]</a> is false.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-call-pull-if-needed" id="ref-for-readable-stream-default-controller-call-pull-if-needed④">ReadableStreamDefaultControllerCallPullIfNeeded</a>(<var>controller</var>).</p> </ol> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#upon-rejection" id="ref-for-upon-rejection④">Upon rejection</a> of <var>startPromise</var> with reason <var>r</var>,</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-error" id="ref-for-readable-stream-default-controller-error⑧">ReadableStreamDefaultControllerError</a>(<var>controller</var>, <var>r</var>).</p> </ol> </ol> </div> <div class="algorithm" data-algorithm="SetUpReadableStreamDefaultControllerFromUnderlyingSource"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="SetUpReadableStreamDefaultControllerFromUnderlyingSource" id="set-up-readable-stream-default-controller-from-underlying-source">SetUpReadableStreamDefaultControllerFromUnderlyingSource(<var>stream</var>, <var>underlyingSource</var>, <var>underlyingSourceDict</var>, <var>highWaterMark</var>, <var>sizeAlgorithm</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>controller</var> be a <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#new" id="ref-for-new⑨">new</a> <code class="idl"><a data-link-type="idl" href="#readablestreamdefaultcontroller" id="ref-for-readablestreamdefaultcontroller①②">ReadableStreamDefaultController</a></code>.</p> <li data-md> <p>Let <var>startAlgorithm</var> be an algorithm that returns undefined.</p> <li data-md> <p>Let <var>pullAlgorithm</var> be an algorithm that returns <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-resolved-with" id="ref-for-a-promise-resolved-with①⑤">a promise resolved with</a> undefined.</p> <li data-md> <p>Let <var>cancelAlgorithm</var> be an algorithm that returns <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-resolved-with" id="ref-for-a-promise-resolved-with①⑥">a promise resolved with</a> undefined.</p> <li data-md> <p>If <var>underlyingSourceDict</var>["<code class="idl"><a data-link-type="idl" href="#dom-underlyingsource-start" id="ref-for-dom-underlyingsource-start④">start</a></code>"] <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#map-exists" id="ref-for-map-exists⑤">exists</a>, then set <var>startAlgorithm</var> to an algorithm which returns the result of <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#invoke-a-callback-function" id="ref-for-invoke-a-callback-function①">invoking</a> <var>underlyingSourceDict</var>["<code class="idl"><a data-link-type="idl" href="#dom-underlyingsource-start" id="ref-for-dom-underlyingsource-start⑤">start</a></code>"] with argument list « <var>controller</var> » and <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-callback-this-value" id="ref-for-dfn-callback-this-value">callback this value</a> <var>underlyingSource</var>.</p> <li data-md> <p>If <var>underlyingSourceDict</var>["<code class="idl"><a data-link-type="idl" href="#dom-underlyingsource-pull" id="ref-for-dom-underlyingsource-pull④">pull</a></code>"] <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#map-exists" id="ref-for-map-exists⑥">exists</a>, then set <var>pullAlgorithm</var> to an algorithm which returns the result of <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#invoke-a-callback-function" id="ref-for-invoke-a-callback-function②">invoking</a> <var>underlyingSourceDict</var>["<code class="idl"><a data-link-type="idl" href="#dom-underlyingsource-pull" id="ref-for-dom-underlyingsource-pull⑤">pull</a></code>"] with argument list « <var>controller</var> » and <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-callback-this-value" id="ref-for-dfn-callback-this-value①">callback this value</a> <var>underlyingSource</var>.</p> <li data-md> <p>If <var>underlyingSourceDict</var>["<code class="idl"><a data-link-type="idl" href="#dom-underlyingsource-cancel" id="ref-for-dom-underlyingsource-cancel②">cancel</a></code>"] <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#map-exists" id="ref-for-map-exists⑦">exists</a>, then set <var>cancelAlgorithm</var> to an algorithm which takes an argument <var>reason</var> and returns the result of <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#invoke-a-callback-function" id="ref-for-invoke-a-callback-function③">invoking</a> <var>underlyingSourceDict</var>["<code class="idl"><a data-link-type="idl" href="#dom-underlyingsource-cancel" id="ref-for-dom-underlyingsource-cancel③">cancel</a></code>"] with argument list « <var>reason</var> » and <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-callback-this-value" id="ref-for-dfn-callback-this-value②">callback this value</a> <var>underlyingSource</var>.</p> <li data-md> <p>Perform ? <a data-link-type="abstract-op" href="#set-up-readable-stream-default-controller" id="ref-for-set-up-readable-stream-default-controller①">SetUpReadableStreamDefaultController</a>(<var>stream</var>, <var>controller</var>, <var>startAlgorithm</var>, <var>pullAlgorithm</var>, <var>cancelAlgorithm</var>, <var>highWaterMark</var>, <var>sizeAlgorithm</var>).</p> </ol> </div> <h4 class="heading settled" data-level="4.9.5" id="rbs-controller-abstract-ops"><span class="secno">4.9.5. </span><span class="content">Byte stream controllers</span><a class="self-link" href="#rbs-controller-abstract-ops"></a></h4> <div class="algorithm" data-algorithm="ReadableByteStreamControllerCallPullIfNeeded"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableByteStreamControllerCallPullIfNeeded" id="readable-byte-stream-controller-call-pull-if-needed">ReadableByteStreamControllerCallPullIfNeeded(<var>controller</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>shouldPull</var> be ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-should-call-pull" id="ref-for-readable-byte-stream-controller-should-call-pull">ReadableByteStreamControllerShouldCallPull</a>(<var>controller</var>).</p> <li data-md> <p>If <var>shouldPull</var> is false, return.</p> <li data-md> <p>If <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-pulling" id="ref-for-readablebytestreamcontroller-pulling">[[pulling]]</a> is true,</p> <ol> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-pullagain" id="ref-for-readablebytestreamcontroller-pullagain">[[pullAgain]]</a> to true.</p> <li data-md> <p>Return.</p> </ol> <li data-md> <p class="assertion">Assert: <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-pullagain" id="ref-for-readablebytestreamcontroller-pullagain①">[[pullAgain]]</a> is false.</p> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-pulling" id="ref-for-readablebytestreamcontroller-pulling①">[[pulling]]</a> to true.</p> <li data-md> <p>Let <var>pullPromise</var> be the result of performing <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-pullalgorithm" id="ref-for-readablebytestreamcontroller-pullalgorithm">[[pullAlgorithm]]</a>.</p> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#upon-fulfillment" id="ref-for-upon-fulfillment③">Upon fulfillment</a> of <var>pullPromise</var>,</p> <ol> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-pulling" id="ref-for-readablebytestreamcontroller-pulling②">[[pulling]]</a> to false.</p> <li data-md> <p>If <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-pullagain" id="ref-for-readablebytestreamcontroller-pullagain②">[[pullAgain]]</a> is true,</p> <ol> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-pullagain" id="ref-for-readablebytestreamcontroller-pullagain③">[[pullAgain]]</a> to false.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-call-pull-if-needed" id="ref-for-readable-byte-stream-controller-call-pull-if-needed①">ReadableByteStreamControllerCallPullIfNeeded</a>(<var>controller</var>).</p> </ol> </ol> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#upon-rejection" id="ref-for-upon-rejection⑤">Upon rejection</a> of <var>pullPromise</var> with reason <var>e</var>,</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-error" id="ref-for-readable-byte-stream-controller-error⑦">ReadableByteStreamControllerError</a>(<var>controller</var>, <var>e</var>).</p> </ol> </ol> </div> <div class="algorithm" data-algorithm="ReadableByteStreamControllerClearAlgorithms"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableByteStreamControllerClearAlgorithms" id="readable-byte-stream-controller-clear-algorithms">ReadableByteStreamControllerClearAlgorithms(<var>controller</var>)</dfn> is called once the stream is closed or errored and the algorithms will not be executed any more. By removing the algorithm references it permits the <a data-link-type="dfn" href="#underlying-byte-source" id="ref-for-underlying-byte-source①④">underlying byte source</a> object to be garbage collected even if the <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream④⑥">ReadableStream</a></code> itself is still referenced. <p class="note" role="note">This is observable using <a href="https://github.com/tc39/proposal-weakrefs/">weak references</a>. See <a href="https://github.com/tc39/proposal-weakrefs/issues/31">tc39/proposal-weakrefs#31</a> for more detail. </p> <p>It performs the following steps:</p> <ol> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-pullalgorithm" id="ref-for-readablebytestreamcontroller-pullalgorithm①">[[pullAlgorithm]]</a> to undefined.</p> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-cancelalgorithm" id="ref-for-readablebytestreamcontroller-cancelalgorithm①">[[cancelAlgorithm]]</a> to undefined.</p> </ol> </div> <div class="algorithm" data-algorithm="ReadableByteStreamControllerClearPendingPullIntos"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableByteStreamControllerClearPendingPullIntos" id="readable-byte-stream-controller-clear-pending-pull-intos">ReadableByteStreamControllerClearPendingPullIntos(<var>controller</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-invalidate-byob-request" id="ref-for-readable-byte-stream-controller-invalidate-byob-request">ReadableByteStreamControllerInvalidateBYOBRequest</a>(<var>controller</var>).</p> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-pendingpullintos" id="ref-for-readablebytestreamcontroller-pendingpullintos⑦">[[pendingPullIntos]]</a> to a new empty <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list" id="ref-for-list①②">list</a>.</p> </ol> </div> <div class="algorithm" data-algorithm="ReadableByteStreamControllerClose"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableByteStreamControllerClose" id="readable-byte-stream-controller-close">ReadableByteStreamControllerClose(<var>controller</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>stream</var> be <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-stream" id="ref-for-readablebytestreamcontroller-stream③">[[stream]]</a>.</p> <li data-md> <p>If <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-closerequested" id="ref-for-readablebytestreamcontroller-closerequested②">[[closeRequested]]</a> is true or <var>stream</var>.<a data-link-type="dfn" href="#readablestream-state" id="ref-for-readablestream-state②⑤">[[state]]</a> is not "<code>readable</code>", return.</p> <li data-md> <p>If <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-queuetotalsize" id="ref-for-readablebytestreamcontroller-queuetotalsize②">[[queueTotalSize]]</a> > 0,</p> <ol> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-closerequested" id="ref-for-readablebytestreamcontroller-closerequested③">[[closeRequested]]</a> to true.</p> <li data-md> <p>Return.</p> </ol> <li data-md> <p>If <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-pendingpullintos" id="ref-for-readablebytestreamcontroller-pendingpullintos⑧">[[pendingPullIntos]]</a> is not empty,</p> <ol> <li data-md> <p>Let <var>firstPendingPullInto</var> be <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-pendingpullintos" id="ref-for-readablebytestreamcontroller-pendingpullintos⑨">[[pendingPullIntos]]</a>[0].</p> <li data-md> <p>If the remainder after dividing <var>firstPendingPullInto</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-bytes-filled" id="ref-for-pull-into-descriptor-bytes-filled①">bytes filled</a> by <var>firstPendingPullInto</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-element-size" id="ref-for-pull-into-descriptor-element-size②">element size</a> is not 0,</p> <ol> <li data-md> <p>Let <var>e</var> be a new <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror③⑧">TypeError</a></code> exception.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-error" id="ref-for-readable-byte-stream-controller-error⑧">ReadableByteStreamControllerError</a>(<var>controller</var>, <var>e</var>).</p> <li data-md> <p>Throw <var>e</var>.</p> </ol> </ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-clear-algorithms" id="ref-for-readable-byte-stream-controller-clear-algorithms①">ReadableByteStreamControllerClearAlgorithms</a>(<var>controller</var>).</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-close" id="ref-for-readable-stream-close③">ReadableStreamClose</a>(<var>stream</var>).</p> </ol> </div> <div class="algorithm" data-algorithm="ReadableByteStreamControllerCommitPullIntoDescriptor"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableByteStreamControllerCommitPullIntoDescriptor" id="readable-byte-stream-controller-commit-pull-into-descriptor">ReadableByteStreamControllerCommitPullIntoDescriptor(<var>stream</var>, <var>pullIntoDescriptor</var>)</dfn> performs the following steps: <ol> <li data-md> <p class="assertion">Assert: <var>stream</var>.<a data-link-type="dfn" href="#readablestream-state" id="ref-for-readablestream-state②⑥">[[state]]</a> is not "<code>errored</code>".</p> <li data-md> <p class="assertion">Assert: <var>pullIntoDescriptor</var>.<a data-link-type="dfn" href="#pull-into-descriptor-reader-type" id="ref-for-pull-into-descriptor-reader-type②">reader type</a> is not "<code>none</code>".</p> <li data-md> <p>Let <var>done</var> be false.</p> <li data-md> <p>If <var>stream</var>.<a data-link-type="dfn" href="#readablestream-state" id="ref-for-readablestream-state②⑦">[[state]]</a> is "<code>closed</code>",</p> <ol> <li data-md> <p class="assertion">Assert: the remainder after dividing <var>pullIntoDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-bytes-filled" id="ref-for-pull-into-descriptor-bytes-filled②">bytes filled</a> by <var>pullIntoDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-element-size" id="ref-for-pull-into-descriptor-element-size③">element size</a> is 0.</p> <li data-md> <p>Set <var>done</var> to true.</p> </ol> <li data-md> <p>Let <var>filledView</var> be ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-convert-pull-into-descriptor" id="ref-for-readable-byte-stream-controller-convert-pull-into-descriptor">ReadableByteStreamControllerConvertPullIntoDescriptor</a>(<var>pullIntoDescriptor</var>).</p> <li data-md> <p>If <var>pullIntoDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-reader-type" id="ref-for-pull-into-descriptor-reader-type③">reader type</a> is "<code>default</code>",</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-fulfill-read-request" id="ref-for-readable-stream-fulfill-read-request①">ReadableStreamFulfillReadRequest</a>(<var>stream</var>, <var>filledView</var>, <var>done</var>).</p> </ol> <li data-md> <p>Otherwise,</p> <ol> <li data-md> <p class="assertion">Assert: <var>pullIntoDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-reader-type" id="ref-for-pull-into-descriptor-reader-type④">reader type</a> is "<code>byob</code>".</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-fulfill-read-into-request" id="ref-for-readable-stream-fulfill-read-into-request">ReadableStreamFulfillReadIntoRequest</a>(<var>stream</var>, <var>filledView</var>, <var>done</var>).</p> </ol> </ol> </div> <div class="algorithm" data-algorithm="ReadableByteStreamControllerConvertPullIntoDescriptor"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableByteStreamControllerConvertPullIntoDescriptor" id="readable-byte-stream-controller-convert-pull-into-descriptor">ReadableByteStreamControllerConvertPullIntoDescriptor(<var>pullIntoDescriptor</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>bytesFilled</var> be <var>pullIntoDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-bytes-filled" id="ref-for-pull-into-descriptor-bytes-filled③">bytes filled</a>.</p> <li data-md> <p>Let <var>elementSize</var> be <var>pullIntoDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-element-size" id="ref-for-pull-into-descriptor-element-size④">element size</a>.</p> <li data-md> <p class="assertion">Assert: <var>bytesFilled</var> ≤ <var>pullIntoDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-byte-length" id="ref-for-pull-into-descriptor-byte-length①">byte length</a>.</p> <li data-md> <p class="assertion">Assert: the remainder after dividing <var>bytesFilled</var> by <var>elementSize</var> is 0.</p> <li data-md> <p>Let <var>buffer</var> be ! <a data-link-type="abstract-op" href="#transfer-array-buffer" id="ref-for-transfer-array-buffer①⓪">TransferArrayBuffer</a>(<var>pullIntoDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-buffer" id="ref-for-pull-into-descriptor-buffer⑧">buffer</a>).</p> <li data-md> <p>Return ! <a data-link-type="abstract-op" href="https://tc39.es/ecma262/multipage/abstract-operations.html#sec-construct" id="ref-for-sec-construct①">Construct</a>(<var>pullIntoDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-view-constructor" id="ref-for-pull-into-descriptor-view-constructor②">view constructor</a>, « <var>buffer</var>, <var>pullIntoDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-byte-offset" id="ref-for-pull-into-descriptor-byte-offset①">byte offset</a>, <var>bytesFilled</var> ÷ <var>elementSize</var> »).</p> </ol> </div> <div class="algorithm" data-algorithm="ReadableByteStreamControllerEnqueue"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableByteStreamControllerEnqueue" id="readable-byte-stream-controller-enqueue">ReadableByteStreamControllerEnqueue(<var>controller</var>, <var>chunk</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>stream</var> be <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-stream" id="ref-for-readablebytestreamcontroller-stream④">[[stream]]</a>.</p> <li data-md> <p>If <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-closerequested" id="ref-for-readablebytestreamcontroller-closerequested④">[[closeRequested]]</a> is true or <var>stream</var>.<a data-link-type="dfn" href="#readablestream-state" id="ref-for-readablestream-state②⑧">[[state]]</a> is not "<code>readable</code>", return.</p> <li data-md> <p>Let <var>buffer</var> be <var>chunk</var>.[[ViewedArrayBuffer]].</p> <li data-md> <p>Let <var>byteOffset</var> be <var>chunk</var>.[[ByteOffset]].</p> <li data-md> <p>Let <var>byteLength</var> be <var>chunk</var>.[[ByteLength]].</p> <li data-md> <p>If ! <a data-link-type="abstract-op" href="https://tc39.es/ecma262/multipage/structured-data.html#sec-isdetachedbuffer" id="ref-for-sec-isdetachedbuffer③">IsDetachedBuffer</a>(<var>buffer</var>) is true, throw a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror③⑨">TypeError</a></code> exception.</p> <li data-md> <p>Let <var>transferredBuffer</var> be ? <a data-link-type="abstract-op" href="#transfer-array-buffer" id="ref-for-transfer-array-buffer①">TransferArrayBuffer</a>(<var>buffer</var>).</p> <li data-md> <p>If <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-pendingpullintos" id="ref-for-readablebytestreamcontroller-pendingpullintos①⓪">[[pendingPullIntos]]</a> is not <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-is-empty" id="ref-for-list-is-empty①②">empty</a>,</p> <ol> <li data-md> <p>Let <var>firstPendingPullInto</var> be <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-pendingpullintos" id="ref-for-readablebytestreamcontroller-pendingpullintos①①">[[pendingPullIntos]]</a>[0].</p> <li data-md> <p>If ! <a data-link-type="abstract-op" href="https://tc39.es/ecma262/multipage/structured-data.html#sec-isdetachedbuffer" id="ref-for-sec-isdetachedbuffer④">IsDetachedBuffer</a>(<var>firstPendingPullInto</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-buffer" id="ref-for-pull-into-descriptor-buffer⑨">buffer</a>) is true, throw a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror④⓪">TypeError</a></code> exception.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-invalidate-byob-request" id="ref-for-readable-byte-stream-controller-invalidate-byob-request①">ReadableByteStreamControllerInvalidateBYOBRequest</a>(<var>controller</var>).</p> <li data-md> <p>Set <var>firstPendingPullInto</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-buffer" id="ref-for-pull-into-descriptor-buffer①⓪">buffer</a> to ! <a data-link-type="abstract-op" href="#transfer-array-buffer" id="ref-for-transfer-array-buffer②">TransferArrayBuffer</a>(<var>firstPendingPullInto</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-buffer" id="ref-for-pull-into-descriptor-buffer①①">buffer</a>).</p> <li data-md> <p>If <var>firstPendingPullInto</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-reader-type" id="ref-for-pull-into-descriptor-reader-type⑤">reader type</a> is "<code>none</code>", perform ? <a data-link-type="abstract-op" href="#abstract-opdef-readablebytestreamcontrollerenqueuedetachedpullintotoqueue" id="ref-for-abstract-opdef-readablebytestreamcontrollerenqueuedetachedpullintotoqueue">ReadableByteStreamControllerEnqueueDetachedPullIntoToQueue</a>(<var>controller</var>, <var>firstPendingPullInto</var>).</p> </ol> <li data-md> <p>If ! <a data-link-type="abstract-op" href="#readable-stream-has-default-reader" id="ref-for-readable-stream-has-default-reader③">ReadableStreamHasDefaultReader</a>(<var>stream</var>) is true,</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#abstract-opdef-readablebytestreamcontrollerprocessreadrequestsusingqueue" id="ref-for-abstract-opdef-readablebytestreamcontrollerprocessreadrequestsusingqueue">ReadableByteStreamControllerProcessReadRequestsUsingQueue</a>(<var>controller</var>).</p> <li data-md> <p>If ! <a data-link-type="abstract-op" href="#readable-stream-get-num-read-requests" id="ref-for-readable-stream-get-num-read-requests③">ReadableStreamGetNumReadRequests</a>(<var>stream</var>) is 0,</p> <ol> <li data-md> <p class="assertion">Assert: <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-pendingpullintos" id="ref-for-readablebytestreamcontroller-pendingpullintos①②">[[pendingPullIntos]]</a> is <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-is-empty" id="ref-for-list-is-empty①③">empty</a>.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-enqueue-chunk-to-queue" id="ref-for-readable-byte-stream-controller-enqueue-chunk-to-queue">ReadableByteStreamControllerEnqueueChunkToQueue</a>(<var>controller</var>, <var>transferredBuffer</var>, <var>byteOffset</var>, <var>byteLength</var>).</p> </ol> <li data-md> <p>Otherwise,</p> <ol> <li data-md> <p class="assertion">Assert: <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-queue" id="ref-for-readablebytestreamcontroller-queue②">[[queue]]</a> <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-is-empty" id="ref-for-list-is-empty①④">is empty</a>.</p> <li data-md> <p>If <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-pendingpullintos" id="ref-for-readablebytestreamcontroller-pendingpullintos①③">[[pendingPullIntos]]</a> is not <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-is-empty" id="ref-for-list-is-empty①⑤">empty</a>,</p> <ol> <li data-md> <p class="assertion">Assert: <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-pendingpullintos" id="ref-for-readablebytestreamcontroller-pendingpullintos①④">[[pendingPullIntos]]</a>[0]'s <a data-link-type="dfn" href="#pull-into-descriptor-reader-type" id="ref-for-pull-into-descriptor-reader-type⑥">reader type</a> is "<code>default</code>".</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-shift-pending-pull-into" id="ref-for-readable-byte-stream-controller-shift-pending-pull-into">ReadableByteStreamControllerShiftPendingPullInto</a>(<var>controller</var>).</p> </ol> <li data-md> <p>Let <var>transferredView</var> be ! <a data-link-type="abstract-op" href="https://tc39.es/ecma262/multipage/abstract-operations.html#sec-construct" id="ref-for-sec-construct②">Construct</a>(<code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/multipage/indexed-collections.html#sec-typedarray-objects" id="ref-for-sec-typedarray-objects④">%Uint8Array%</a></code>, « <var>transferredBuffer</var>, <var>byteOffset</var>, <var>byteLength</var> »).</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-fulfill-read-request" id="ref-for-readable-stream-fulfill-read-request②">ReadableStreamFulfillReadRequest</a>(<var>stream</var>, <var>transferredView</var>, false).</p> </ol> </ol> <li data-md> <p>Otherwise, if ! <a data-link-type="abstract-op" href="#readable-stream-has-byob-reader" id="ref-for-readable-stream-has-byob-reader②">ReadableStreamHasBYOBReader</a>(<var>stream</var>) is true,</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-enqueue-chunk-to-queue" id="ref-for-readable-byte-stream-controller-enqueue-chunk-to-queue①">ReadableByteStreamControllerEnqueueChunkToQueue</a>(<var>controller</var>, <var>transferredBuffer</var>, <var>byteOffset</var>, <var>byteLength</var>).</p> <li data-md> <p>Let <var>filledPullIntos</var> be the result of performing ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-process-pull-into-descriptors-using-queue" id="ref-for-readable-byte-stream-controller-process-pull-into-descriptors-using-queue">ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue</a>(<var>controller</var>).</p> <li data-md> <p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-iterate" id="ref-for-list-iterate④">For each</a> <var>filledPullInto</var> of <var>filledPullIntos</var>,</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-commit-pull-into-descriptor" id="ref-for-readable-byte-stream-controller-commit-pull-into-descriptor">ReadableByteStreamControllerCommitPullIntoDescriptor</a>(<var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-stream" id="ref-for-readablebytestreamcontroller-stream⑤">[[stream]]</a>, <var>filledPullInto</var>).</p> </ol> </ol> <li data-md> <p>Otherwise,</p> <ol> <li data-md> <p class="assertion">Assert: ! <a data-link-type="abstract-op" href="#is-readable-stream-locked" id="ref-for-is-readable-stream-locked①⓪">IsReadableStreamLocked</a>(<var>stream</var>) is false.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-enqueue-chunk-to-queue" id="ref-for-readable-byte-stream-controller-enqueue-chunk-to-queue②">ReadableByteStreamControllerEnqueueChunkToQueue</a>(<var>controller</var>, <var>transferredBuffer</var>, <var>byteOffset</var>, <var>byteLength</var>).</p> </ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-call-pull-if-needed" id="ref-for-readable-byte-stream-controller-call-pull-if-needed②">ReadableByteStreamControllerCallPullIfNeeded</a>(<var>controller</var>).</p> </ol> </div> <div class="algorithm" data-algorithm="ReadableByteStreamControllerEnqueueChunkToQueue"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableByteStreamControllerEnqueueChunkToQueue" id="readable-byte-stream-controller-enqueue-chunk-to-queue">ReadableByteStreamControllerEnqueueChunkToQueue(<var>controller</var>, <var>buffer</var>, <var>byteOffset</var>, <var>byteLength</var>)</dfn> performs the following steps: <ol> <li data-md> <p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-append" id="ref-for-list-append③">Append</a> a new <a data-link-type="dfn" href="#readable-byte-stream-queue-entry" id="ref-for-readable-byte-stream-queue-entry①">readable byte stream queue entry</a> with <a data-link-type="dfn" href="#readable-byte-stream-queue-entry-buffer" id="ref-for-readable-byte-stream-queue-entry-buffer">buffer</a> <var>buffer</var>, <a data-link-type="dfn" href="#readable-byte-stream-queue-entry-byte-offset" id="ref-for-readable-byte-stream-queue-entry-byte-offset">byte offset</a> <var>byteOffset</var>, and <a data-link-type="dfn" href="#readable-byte-stream-queue-entry-byte-length" id="ref-for-readable-byte-stream-queue-entry-byte-length">byte length</a> <var>byteLength</var> to <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-queue" id="ref-for-readablebytestreamcontroller-queue③">[[queue]]</a>.</p> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-queuetotalsize" id="ref-for-readablebytestreamcontroller-queuetotalsize③">[[queueTotalSize]]</a> to <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-queuetotalsize" id="ref-for-readablebytestreamcontroller-queuetotalsize④">[[queueTotalSize]]</a> + <var>byteLength</var>.</p> </ol> </div> <div class="algorithm" data-algorithm="ReadableByteStreamControllerEnqueueClonedChunkToQueue"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableByteStreamControllerEnqueueClonedChunkToQueue" id="abstract-opdef-readablebytestreamcontrollerenqueueclonedchunktoqueue">ReadableByteStreamControllerEnqueueClonedChunkToQueue(<var>controller</var>, <var>buffer</var>, <var>byteOffset</var>, <var>byteLength</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>cloneResult</var> be <a data-link-type="abstract-op" href="https://tc39.es/ecma262/multipage/structured-data.html#sec-clonearraybuffer" id="ref-for-sec-clonearraybuffer">CloneArrayBuffer</a>(<var>buffer</var>, <var>byteOffset</var>, <var>byteLength</var>, <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/multipage/structured-data.html#sec-arraybuffer-constructor" id="ref-for-sec-arraybuffer-constructor①">%ArrayBuffer%</a></code>).</p> <li data-md> <p>If <var>cloneResult</var> is an abrupt completion,</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-error" id="ref-for-readable-byte-stream-controller-error⑨">ReadableByteStreamControllerError</a>(<var>controller</var>, <var>cloneResult</var>.[[Value]]).</p> <li data-md> <p>Return <var>cloneResult</var>.</p> </ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-enqueue-chunk-to-queue" id="ref-for-readable-byte-stream-controller-enqueue-chunk-to-queue③">ReadableByteStreamControllerEnqueueChunkToQueue</a>(<var>controller</var>, <var>cloneResult</var>.[[Value]], 0, <var>byteLength</var>).</p> </ol> </div> <div class="algorithm" data-algorithm="ReadableByteStreamControllerEnqueueDetachedPullIntoToQueue"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableByteStreamControllerEnqueueDetachedPullIntoToQueue" id="abstract-opdef-readablebytestreamcontrollerenqueuedetachedpullintotoqueue">ReadableByteStreamControllerEnqueueDetachedPullIntoToQueue(<var>controller</var>, <var>pullIntoDescriptor</var>)</dfn> performs the following steps: <ol> <li data-md> <p class="assertion">Assert: <var>pullIntoDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-reader-type" id="ref-for-pull-into-descriptor-reader-type⑦">reader type</a> is "<code>none</code>".</p> <li data-md> <p>If <var>pullIntoDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-bytes-filled" id="ref-for-pull-into-descriptor-bytes-filled④">bytes filled</a> > 0, perform ? <a data-link-type="abstract-op" href="#abstract-opdef-readablebytestreamcontrollerenqueueclonedchunktoqueue" id="ref-for-abstract-opdef-readablebytestreamcontrollerenqueueclonedchunktoqueue">ReadableByteStreamControllerEnqueueClonedChunkToQueue</a>(<var>controller</var>, <var>pullIntoDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-buffer" id="ref-for-pull-into-descriptor-buffer①②">buffer</a>, <var>pullIntoDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-byte-offset" id="ref-for-pull-into-descriptor-byte-offset②">byte offset</a>, <var>pullIntoDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-bytes-filled" id="ref-for-pull-into-descriptor-bytes-filled⑤">bytes filled</a>).</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-shift-pending-pull-into" id="ref-for-readable-byte-stream-controller-shift-pending-pull-into①">ReadableByteStreamControllerShiftPendingPullInto</a>(<var>controller</var>).</p> </ol> </div> <div class="algorithm" data-algorithm="ReadableByteStreamControllerError"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableByteStreamControllerError" id="readable-byte-stream-controller-error">ReadableByteStreamControllerError(<var>controller</var>, <var>e</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>stream</var> be <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-stream" id="ref-for-readablebytestreamcontroller-stream⑥">[[stream]]</a>.</p> <li data-md> <p>If <var>stream</var>.<a data-link-type="dfn" href="#readablestream-state" id="ref-for-readablestream-state②⑨">[[state]]</a> is not "<code>readable</code>", return.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-clear-pending-pull-intos" id="ref-for-readable-byte-stream-controller-clear-pending-pull-intos①">ReadableByteStreamControllerClearPendingPullIntos</a>(<var>controller</var>).</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#reset-queue" id="ref-for-reset-queue④">ResetQueue</a>(<var>controller</var>).</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-clear-algorithms" id="ref-for-readable-byte-stream-controller-clear-algorithms②">ReadableByteStreamControllerClearAlgorithms</a>(<var>controller</var>).</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-error" id="ref-for-readable-stream-error①">ReadableStreamError</a>(<var>stream</var>, <var>e</var>).</p> </ol> </div> <div class="algorithm" data-algorithm="ReadableByteStreamControllerFillHeadPullIntoDescriptor"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableByteStreamControllerFillHeadPullIntoDescriptor" id="readable-byte-stream-controller-fill-head-pull-into-descriptor">ReadableByteStreamControllerFillHeadPullIntoDescriptor(<var>controller</var>, <var>size</var>, <var>pullIntoDescriptor</var>)</dfn> performs the following steps: <ol> <li data-md> <p class="assertion">Assert: either <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-pendingpullintos" id="ref-for-readablebytestreamcontroller-pendingpullintos①⑤">[[pendingPullIntos]]</a> <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-is-empty" id="ref-for-list-is-empty①⑥">is empty</a>, or <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-pendingpullintos" id="ref-for-readablebytestreamcontroller-pendingpullintos①⑥">[[pendingPullIntos]]</a>[0] is <var>pullIntoDescriptor</var>.</p> <li data-md> <p class="assertion">Assert: <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-byobrequest" id="ref-for-readablebytestreamcontroller-byobrequest">[[byobRequest]]</a> is null.</p> <li data-md> <p>Set <var>pullIntoDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-bytes-filled" id="ref-for-pull-into-descriptor-bytes-filled⑥">bytes filled</a> to <a data-link-type="dfn" href="#pull-into-descriptor-bytes-filled" id="ref-for-pull-into-descriptor-bytes-filled⑦">bytes filled</a> + <var>size</var>.</p> </ol> </div> <div class="algorithm" data-algorithm="ReadableByteStreamControllerFillPullIntoDescriptorFromQueue"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableByteStreamControllerFillPullIntoDescriptorFromQueue" id="readable-byte-stream-controller-fill-pull-into-descriptor-from-queue">ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(<var>controller</var>, <var>pullIntoDescriptor</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>maxBytesToCopy</var> be min(<var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-queuetotalsize" id="ref-for-readablebytestreamcontroller-queuetotalsize⑤">[[queueTotalSize]]</a>, <var>pullIntoDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-byte-length" id="ref-for-pull-into-descriptor-byte-length②">byte length</a> − <var>pullIntoDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-bytes-filled" id="ref-for-pull-into-descriptor-bytes-filled⑧">bytes filled</a>).</p> <li data-md> <p>Let <var>maxBytesFilled</var> be <var>pullIntoDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-bytes-filled" id="ref-for-pull-into-descriptor-bytes-filled⑨">bytes filled</a> + <var>maxBytesToCopy</var>.</p> <li data-md> <p>Let <var>totalBytesToCopyRemaining</var> be <var>maxBytesToCopy</var>.</p> <li data-md> <p>Let <var>ready</var> be false.</p> <li data-md> <p class="assertion">Assert: ! <a data-link-type="abstract-op" href="https://tc39.es/ecma262/multipage/structured-data.html#sec-isdetachedbuffer" id="ref-for-sec-isdetachedbuffer⑤">IsDetachedBuffer</a>(<var>pullIntoDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-buffer" id="ref-for-pull-into-descriptor-buffer①③">buffer</a>) is false.</p> <li data-md> <p class="assertion">Assert: <var>pullIntoDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-bytes-filled" id="ref-for-pull-into-descriptor-bytes-filled①⓪">bytes filled</a> < <var>pullIntoDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-minimum-fill" id="ref-for-pull-into-descriptor-minimum-fill①">minimum fill</a>.</p> <li data-md> <p>Let <var>remainderBytes</var> be the remainder after dividing <var>maxBytesFilled</var> by <var>pullIntoDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-element-size" id="ref-for-pull-into-descriptor-element-size⑤">element size</a>.</p> <li data-md> <p>Let <var>maxAlignedBytes</var> be <var>maxBytesFilled</var> − <var>remainderBytes</var>.</p> <li data-md> <p>If <var>maxAlignedBytes</var> ≥ <var>pullIntoDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-minimum-fill" id="ref-for-pull-into-descriptor-minimum-fill②">minimum fill</a>,</p> <ol> <li data-md> <p>Set <var>totalBytesToCopyRemaining</var> to <var>maxAlignedBytes</var> − <var>pullIntoDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-bytes-filled" id="ref-for-pull-into-descriptor-bytes-filled①①">bytes filled</a>.</p> <li data-md> <p>Set <var>ready</var> to true.</p> <p class="note" role="note">A descriptor for a <code class="idl"><a data-link-type="idl" href="#byob-reader-read" id="ref-for-byob-reader-read⑧">read()</a></code> request that is not yet filled up to its minimum length will stay at the head of the queue, so the <a data-link-type="dfn" href="#underlying-source" id="ref-for-underlying-source②⑥">underlying source</a> can keep filling it. </p> </ol> <li data-md> <p>Let <var>queue</var> be <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-queue" id="ref-for-readablebytestreamcontroller-queue④">[[queue]]</a>.</p> <li data-md> <p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#iteration-while" id="ref-for-iteration-while">While</a> <var>totalBytesToCopyRemaining</var> > 0,</p> <ol> <li data-md> <p>Let <var>headOfQueue</var> be <var>queue</var>[0].</p> <li data-md> <p>Let <var>bytesToCopy</var> be min(<var>totalBytesToCopyRemaining</var>, <var>headOfQueue</var>’s <a data-link-type="dfn" href="#readable-byte-stream-queue-entry-byte-length" id="ref-for-readable-byte-stream-queue-entry-byte-length①">byte length</a>).</p> <li data-md> <p>Let <var>destStart</var> be <var>pullIntoDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-byte-offset" id="ref-for-pull-into-descriptor-byte-offset③">byte offset</a> + <var>pullIntoDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-bytes-filled" id="ref-for-pull-into-descriptor-bytes-filled①②">bytes filled</a>.</p> <li data-md> <p class="assertion">Assert: ! <a data-link-type="abstract-op" href="#abstract-opdef-cancopydatablockbytes" id="ref-for-abstract-opdef-cancopydatablockbytes">CanCopyDataBlockBytes</a>(<var>pullIntoDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-buffer" id="ref-for-pull-into-descriptor-buffer①④">buffer</a>, <var>destStart</var>, <var>headOfQueue</var>’s <a data-link-type="dfn" href="#readable-byte-stream-queue-entry-buffer" id="ref-for-readable-byte-stream-queue-entry-buffer①">buffer</a>, <var>headOfQueue</var>’s <a data-link-type="dfn" href="#readable-byte-stream-queue-entry-byte-offset" id="ref-for-readable-byte-stream-queue-entry-byte-offset①">byte offset</a>, <var>bytesToCopy</var>) is true.</p> <p class="warning">If this assertion were to fail (due to a bug in this specification or its implementation), then the next step may read from or write to potentially invalid memory. The user agent should always check this assertion, and stop in an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#implementation-defined" id="ref-for-implementation-defined">implementation-defined</a> manner if it fails (e.g. by crashing the process, or by <a data-link-type="abstract-op" href="#readable-byte-stream-controller-error" id="ref-for-readable-byte-stream-controller-error①⓪">erroring the stream</a>). </p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="https://tc39.es/ecma262/multipage/ecmascript-data-types-and-values.html#sec-copydatablockbytes" id="ref-for-sec-copydatablockbytes">CopyDataBlockBytes</a>(<var>pullIntoDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-buffer" id="ref-for-pull-into-descriptor-buffer①⑤">buffer</a>.[[ArrayBufferData]], <var>destStart</var>, <var>headOfQueue</var>’s <a data-link-type="dfn" href="#readable-byte-stream-queue-entry-buffer" id="ref-for-readable-byte-stream-queue-entry-buffer②">buffer</a>.[[ArrayBufferData]], <var>headOfQueue</var>’s <a data-link-type="dfn" href="#readable-byte-stream-queue-entry-byte-offset" id="ref-for-readable-byte-stream-queue-entry-byte-offset②">byte offset</a>, <var>bytesToCopy</var>).</p> <li data-md> <p>If <var>headOfQueue</var>’s <a data-link-type="dfn" href="#readable-byte-stream-queue-entry-byte-length" id="ref-for-readable-byte-stream-queue-entry-byte-length②">byte length</a> is <var>bytesToCopy</var>,</p> <ol> <li data-md> <p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-remove" id="ref-for-list-remove②">Remove</a> <var>queue</var>[0].</p> </ol> <li data-md> <p>Otherwise,</p> <ol> <li data-md> <p>Set <var>headOfQueue</var>’s <a data-link-type="dfn" href="#readable-byte-stream-queue-entry-byte-offset" id="ref-for-readable-byte-stream-queue-entry-byte-offset③">byte offset</a> to <var>headOfQueue</var>’s <a data-link-type="dfn" href="#readable-byte-stream-queue-entry-byte-offset" id="ref-for-readable-byte-stream-queue-entry-byte-offset④">byte offset</a> + <var>bytesToCopy</var>.</p> <li data-md> <p>Set <var>headOfQueue</var>’s <a data-link-type="dfn" href="#readable-byte-stream-queue-entry-byte-length" id="ref-for-readable-byte-stream-queue-entry-byte-length③">byte length</a> to <var>headOfQueue</var>’s <a data-link-type="dfn" href="#readable-byte-stream-queue-entry-byte-length" id="ref-for-readable-byte-stream-queue-entry-byte-length④">byte length</a> − <var>bytesToCopy</var>.</p> </ol> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-queuetotalsize" id="ref-for-readablebytestreamcontroller-queuetotalsize⑥">[[queueTotalSize]]</a> to <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-queuetotalsize" id="ref-for-readablebytestreamcontroller-queuetotalsize⑦">[[queueTotalSize]]</a> − <var>bytesToCopy</var>.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-fill-head-pull-into-descriptor" id="ref-for-readable-byte-stream-controller-fill-head-pull-into-descriptor">ReadableByteStreamControllerFillHeadPullIntoDescriptor</a>(<var>controller</var>, <var>bytesToCopy</var>, <var>pullIntoDescriptor</var>).</p> <li data-md> <p>Set <var>totalBytesToCopyRemaining</var> to <var>totalBytesToCopyRemaining</var> − <var>bytesToCopy</var>.</p> </ol> <li data-md> <p>If <var>ready</var> is false,</p> <ol> <li data-md> <p class="assertion">Assert: <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-queuetotalsize" id="ref-for-readablebytestreamcontroller-queuetotalsize⑧">[[queueTotalSize]]</a> is 0.</p> <li data-md> <p class="assertion">Assert: <var>pullIntoDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-bytes-filled" id="ref-for-pull-into-descriptor-bytes-filled①③">bytes filled</a> > 0.</p> <li data-md> <p class="assertion">Assert: <var>pullIntoDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-bytes-filled" id="ref-for-pull-into-descriptor-bytes-filled①④">bytes filled</a> < <var>pullIntoDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-minimum-fill" id="ref-for-pull-into-descriptor-minimum-fill③">minimum fill</a>.</p> </ol> <li data-md> <p>Return <var>ready</var>.</p> </ol> </div> <div class="algorithm" data-algorithm="ReadableByteStreamControllerFillReadRequestFromQueue"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableByteStreamControllerFillReadRequestFromQueue" id="abstract-opdef-readablebytestreamcontrollerfillreadrequestfromqueue">ReadableByteStreamControllerFillReadRequestFromQueue(<var>controller</var>, <var>readRequest</var>)</dfn> performs the following steps: <ol> <li data-md> <p class="assertion">Assert: <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-queuetotalsize" id="ref-for-readablebytestreamcontroller-queuetotalsize⑨">[[queueTotalSize]]</a> > 0.</p> <li data-md> <p>Let <var>entry</var> be <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-queue" id="ref-for-readablebytestreamcontroller-queue⑤">[[queue]]</a>[0].</p> <li data-md> <p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-remove" id="ref-for-list-remove③">Remove</a> <var>entry</var> from <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-queue" id="ref-for-readablebytestreamcontroller-queue⑥">[[queue]]</a>.</p> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-queuetotalsize" id="ref-for-readablebytestreamcontroller-queuetotalsize①⓪">[[queueTotalSize]]</a> to <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-queuetotalsize" id="ref-for-readablebytestreamcontroller-queuetotalsize①①">[[queueTotalSize]]</a> − <var>entry</var>’s <a data-link-type="dfn" href="#readable-byte-stream-queue-entry-byte-length" id="ref-for-readable-byte-stream-queue-entry-byte-length⑤">byte length</a>.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-handle-queue-drain" id="ref-for-readable-byte-stream-controller-handle-queue-drain">ReadableByteStreamControllerHandleQueueDrain</a>(<var>controller</var>).</p> <li data-md> <p>Let <var>view</var> be ! <a data-link-type="abstract-op" href="https://tc39.es/ecma262/multipage/abstract-operations.html#sec-construct" id="ref-for-sec-construct③">Construct</a>(<code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/multipage/indexed-collections.html#sec-typedarray-objects" id="ref-for-sec-typedarray-objects⑤">%Uint8Array%</a></code>, « <var>entry</var>’s <a data-link-type="dfn" href="#readable-byte-stream-queue-entry-buffer" id="ref-for-readable-byte-stream-queue-entry-buffer③">buffer</a>, <var>entry</var>’s <a data-link-type="dfn" href="#readable-byte-stream-queue-entry-byte-offset" id="ref-for-readable-byte-stream-queue-entry-byte-offset⑤">byte offset</a>, <var>entry</var>’s <a data-link-type="dfn" href="#readable-byte-stream-queue-entry-byte-length" id="ref-for-readable-byte-stream-queue-entry-byte-length⑥">byte length</a> »).</p> <li data-md> <p>Perform <var>readRequest</var>’s <a data-link-type="dfn" href="#read-request-chunk-steps" id="ref-for-read-request-chunk-steps⑥">chunk steps</a>, given <var>view</var>.</p> </ol> </div> <div class="algorithm" data-algorithm="ReadableByteStreamControllerGetBYOBRequest"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableByteStreamControllerGetBYOBRequest" id="abstract-opdef-readablebytestreamcontrollergetbyobrequest">ReadableByteStreamControllerGetBYOBRequest(<var>controller</var>)</dfn> performs the following steps: <ol> <li data-md> <p>If <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-byobrequest" id="ref-for-readablebytestreamcontroller-byobrequest①">[[byobRequest]]</a> is null and <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-pendingpullintos" id="ref-for-readablebytestreamcontroller-pendingpullintos①⑦">[[pendingPullIntos]]</a> is not <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-is-empty" id="ref-for-list-is-empty①⑦">empty</a>,</p> <ol> <li data-md> <p>Let <var>firstDescriptor</var> be <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-pendingpullintos" id="ref-for-readablebytestreamcontroller-pendingpullintos①⑧">[[pendingPullIntos]]</a>[0].</p> <li data-md> <p>Let <var>view</var> be ! <a data-link-type="abstract-op" href="https://tc39.es/ecma262/multipage/abstract-operations.html#sec-construct" id="ref-for-sec-construct④">Construct</a>(<code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/multipage/indexed-collections.html#sec-typedarray-objects" id="ref-for-sec-typedarray-objects⑥">%Uint8Array%</a></code>, « <var>firstDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-buffer" id="ref-for-pull-into-descriptor-buffer①⑥">buffer</a>, <var>firstDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-byte-offset" id="ref-for-pull-into-descriptor-byte-offset④">byte offset</a> + <var>firstDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-bytes-filled" id="ref-for-pull-into-descriptor-bytes-filled①⑤">bytes filled</a>, <var>firstDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-byte-length" id="ref-for-pull-into-descriptor-byte-length③">byte length</a> − <var>firstDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-bytes-filled" id="ref-for-pull-into-descriptor-bytes-filled①⑥">bytes filled</a> »).</p> <li data-md> <p>Let <var>byobRequest</var> be a <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#new" id="ref-for-new①⓪">new</a> <code class="idl"><a data-link-type="idl" href="#readablestreambyobrequest" id="ref-for-readablestreambyobrequest⑥">ReadableStreamBYOBRequest</a></code>.</p> <li data-md> <p>Set <var>byobRequest</var>.<a data-link-type="dfn" href="#readablestreambyobrequest-controller" id="ref-for-readablestreambyobrequest-controller④">[[controller]]</a> to <var>controller</var>.</p> <li data-md> <p>Set <var>byobRequest</var>.<a data-link-type="dfn" href="#readablestreambyobrequest-view" id="ref-for-readablestreambyobrequest-view⑥">[[view]]</a> to <var>view</var>.</p> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-byobrequest" id="ref-for-readablebytestreamcontroller-byobrequest②">[[byobRequest]]</a> to <var>byobRequest</var>.</p> </ol> <li data-md> <p>Return <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-byobrequest" id="ref-for-readablebytestreamcontroller-byobrequest③">[[byobRequest]]</a>.</p> </ol> </div> <div class="algorithm" data-algorithm="ReadableByteStreamControllerGetDesiredSize"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableByteStreamControllerGetDesiredSize" id="readable-byte-stream-controller-get-desired-size">ReadableByteStreamControllerGetDesiredSize(<var>controller</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>state</var> be <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-stream" id="ref-for-readablebytestreamcontroller-stream⑦">[[stream]]</a>.<a data-link-type="dfn" href="#readablestream-state" id="ref-for-readablestream-state③⓪">[[state]]</a>.</p> <li data-md> <p>If <var>state</var> is "<code>errored</code>", return null.</p> <li data-md> <p>If <var>state</var> is "<code>closed</code>", return 0.</p> <li data-md> <p>Return <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-strategyhwm" id="ref-for-readablebytestreamcontroller-strategyhwm">[[strategyHWM]]</a> − <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-queuetotalsize" id="ref-for-readablebytestreamcontroller-queuetotalsize①②">[[queueTotalSize]]</a>.</p> </ol> </div> <div class="algorithm" data-algorithm="ReadableByteStreamControllerHandleQueueDrain"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableByteStreamControllerHandleQueueDrain" id="readable-byte-stream-controller-handle-queue-drain">ReadableByteStreamControllerHandleQueueDrain(<var>controller</var>)</dfn> performs the following steps: <ol> <li data-md> <p class="assertion">Assert: <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-stream" id="ref-for-readablebytestreamcontroller-stream⑧">[[stream]]</a>.<a data-link-type="dfn" href="#readablestream-state" id="ref-for-readablestream-state③①">[[state]]</a> is "<code>readable</code>".</p> <li data-md> <p>If <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-queuetotalsize" id="ref-for-readablebytestreamcontroller-queuetotalsize①③">[[queueTotalSize]]</a> is 0 and <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-closerequested" id="ref-for-readablebytestreamcontroller-closerequested⑤">[[closeRequested]]</a> is true,</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-clear-algorithms" id="ref-for-readable-byte-stream-controller-clear-algorithms③">ReadableByteStreamControllerClearAlgorithms</a>(<var>controller</var>).</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-close" id="ref-for-readable-stream-close④">ReadableStreamClose</a>(<var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-stream" id="ref-for-readablebytestreamcontroller-stream⑨">[[stream]]</a>).</p> </ol> <li data-md> <p>Otherwise,</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-call-pull-if-needed" id="ref-for-readable-byte-stream-controller-call-pull-if-needed③">ReadableByteStreamControllerCallPullIfNeeded</a>(<var>controller</var>).</p> </ol> </ol> </div> <div class="algorithm" data-algorithm="ReadableByteStreamControllerInvalidateBYOBRequest"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableByteStreamControllerInvalidateBYOBRequest" id="readable-byte-stream-controller-invalidate-byob-request">ReadableByteStreamControllerInvalidateBYOBRequest(<var>controller</var>)</dfn> performs the following steps: <ol> <li data-md> <p>If <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-byobrequest" id="ref-for-readablebytestreamcontroller-byobrequest④">[[byobRequest]]</a> is null, return.</p> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-byobrequest" id="ref-for-readablebytestreamcontroller-byobrequest⑤">[[byobRequest]]</a>.<a data-link-type="dfn" href="#readablestreambyobrequest-controller" id="ref-for-readablestreambyobrequest-controller⑤">[[controller]]</a> to undefined.</p> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-byobrequest" id="ref-for-readablebytestreamcontroller-byobrequest⑥">[[byobRequest]]</a>.<a data-link-type="dfn" href="#readablestreambyobrequest-view" id="ref-for-readablestreambyobrequest-view⑦">[[view]]</a> to null.</p> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-byobrequest" id="ref-for-readablebytestreamcontroller-byobrequest⑦">[[byobRequest]]</a> to null.</p> </ol> </div> <div class="algorithm" data-algorithm="ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue" id="readable-byte-stream-controller-process-pull-into-descriptors-using-queue">ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(<var>controller</var>)</dfn> performs the following steps: <ol> <li data-md> <p class="assertion">Assert: <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-closerequested" id="ref-for-readablebytestreamcontroller-closerequested⑥">[[closeRequested]]</a> is false.</p> <li data-md> <p>Let <var>filledPullIntos</var> be a new empty <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list" id="ref-for-list①③">list</a>.</p> <li data-md> <p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#iteration-while" id="ref-for-iteration-while①">While</a> <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-pendingpullintos" id="ref-for-readablebytestreamcontroller-pendingpullintos①⑨">[[pendingPullIntos]]</a> is not <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-is-empty" id="ref-for-list-is-empty①⑧">empty</a>,</p> <ol> <li data-md> <p>If <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-queuetotalsize" id="ref-for-readablebytestreamcontroller-queuetotalsize①④">[[queueTotalSize]]</a> is 0, then <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#iteration-break" id="ref-for-iteration-break">break</a>.</p> <li data-md> <p>Let <var>pullIntoDescriptor</var> be <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-pendingpullintos" id="ref-for-readablebytestreamcontroller-pendingpullintos②⓪">[[pendingPullIntos]]</a>[0].</p> <li data-md> <p>If ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-fill-pull-into-descriptor-from-queue" id="ref-for-readable-byte-stream-controller-fill-pull-into-descriptor-from-queue">ReadableByteStreamControllerFillPullIntoDescriptorFromQueue</a>(<var>controller</var>, <var>pullIntoDescriptor</var>) is true,</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-shift-pending-pull-into" id="ref-for-readable-byte-stream-controller-shift-pending-pull-into②">ReadableByteStreamControllerShiftPendingPullInto</a>(<var>controller</var>).</p> <li data-md> <p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-append" id="ref-for-list-append④">Append</a> <var>pullIntoDescriptor</var> to <var>filledPullIntos</var>.</p> </ol> </ol> <li data-md> <p>Return <var>filledPullIntos</var>.</p> </ol> </div> <div class="algorithm" data-algorithm="ReadableByteStreamControllerProcessReadRequestsUsingQueue"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableByteStreamControllerProcessReadRequestsUsingQueue" id="abstract-opdef-readablebytestreamcontrollerprocessreadrequestsusingqueue">ReadableByteStreamControllerProcessReadRequestsUsingQueue(<var>controller</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>reader</var> be <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-stream" id="ref-for-readablebytestreamcontroller-stream①⓪">[[stream]]</a>.<a data-link-type="dfn" href="#readablestream-reader" id="ref-for-readablestream-reader①⑧">[[reader]]</a>.</p> <li data-md> <p class="assertion">Assert: <var>reader</var> <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#implements" id="ref-for-implements②①">implements</a> <code class="idl"><a data-link-type="idl" href="#readablestreamdefaultreader" id="ref-for-readablestreamdefaultreader①⑦">ReadableStreamDefaultReader</a></code>.</p> <li data-md> <p>While <var>reader</var>.<a data-link-type="dfn" href="#readablestreamdefaultreader-readrequests" id="ref-for-readablestreamdefaultreader-readrequests①②">[[readRequests]]</a> is not <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-is-empty" id="ref-for-list-is-empty①⑨">empty</a>,</p> <ol> <li data-md> <p>If <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-queuetotalsize" id="ref-for-readablebytestreamcontroller-queuetotalsize①⑤">[[queueTotalSize]]</a> is 0, return.</p> <li data-md> <p>Let <var>readRequest</var> be <var>reader</var>.<a data-link-type="dfn" href="#readablestreamdefaultreader-readrequests" id="ref-for-readablestreamdefaultreader-readrequests①③">[[readRequests]]</a>[0].</p> <li data-md> <p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-remove" id="ref-for-list-remove④">Remove</a> <var>readRequest</var> from <var>reader</var>.<a data-link-type="dfn" href="#readablestreamdefaultreader-readrequests" id="ref-for-readablestreamdefaultreader-readrequests①④">[[readRequests]]</a>.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#abstract-opdef-readablebytestreamcontrollerfillreadrequestfromqueue" id="ref-for-abstract-opdef-readablebytestreamcontrollerfillreadrequestfromqueue①">ReadableByteStreamControllerFillReadRequestFromQueue</a>(<var>controller</var>, <var>readRequest</var>).</p> </ol> </ol> </div> <div class="algorithm" data-algorithm="ReadableByteStreamControllerPullInto"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableByteStreamControllerPullInto" id="readable-byte-stream-controller-pull-into">ReadableByteStreamControllerPullInto(<var>controller</var>, <var>view</var>, <var>min</var>, <var>readIntoRequest</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>stream</var> be <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-stream" id="ref-for-readablebytestreamcontroller-stream①①">[[stream]]</a>.</p> <li data-md> <p>Let <var>elementSize</var> be 1.</p> <li data-md> <p>Let <var>ctor</var> be <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/multipage/structured-data.html#sec-dataview-constructor" id="ref-for-sec-dataview-constructor①">%DataView%</a></code>.</p> <li data-md> <p>If <var>view</var> has a [[TypedArrayName]] internal slot (i.e., it is not a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-dataview-objects" id="ref-for-sec-dataview-objects②">DataView</a></code>),</p> <ol> <li data-md> <p>Set <var>elementSize</var> to the element size specified in <a data-link-type="dfn" href="https://tc39.es/ecma262/#table-49" id="ref-for-table-49①">the typed array constructors table</a> for <var>view</var>.[[TypedArrayName]].</p> <li data-md> <p>Set <var>ctor</var> to the constructor specified in <a data-link-type="dfn" href="https://tc39.es/ecma262/#table-49" id="ref-for-table-49②">the typed array constructors table</a> for <var>view</var>.[[TypedArrayName]].</p> </ol> <li data-md> <p>Let <var>minimumFill</var> be <var>min</var> × <var>elementSize</var>.</p> <li data-md> <p class="assertion">Assert: <var>minimumFill</var> ≥ 0 and <var>minimumFill</var> ≤ <var>view</var>.[[ByteLength]].</p> <li data-md> <p class="assertion">Assert: the remainder after dividing <var>minimumFill</var> by <var>elementSize</var> is 0.</p> <li data-md> <p>Let <var>byteOffset</var> be <var>view</var>.[[ByteOffset]].</p> <li data-md> <p>Let <var>byteLength</var> be <var>view</var>.[[ByteLength]].</p> <li data-md> <p>Let <var>bufferResult</var> be <a data-link-type="abstract-op" href="#transfer-array-buffer" id="ref-for-transfer-array-buffer③">TransferArrayBuffer</a>(<var>view</var>.[[ViewedArrayBuffer]]).</p> <li data-md> <p>If <var>bufferResult</var> is an abrupt completion,</p> <ol> <li data-md> <p>Perform <var>readIntoRequest</var>’s <a data-link-type="dfn" href="#read-into-request-error-steps" id="ref-for-read-into-request-error-steps④">error steps</a>, given <var>bufferResult</var>.[[Value]].</p> <li data-md> <p>Return.</p> </ol> <li data-md> <p>Let <var>buffer</var> be <var>bufferResult</var>.[[Value]].</p> <li data-md> <p>Let <var>pullIntoDescriptor</var> be a new <a data-link-type="dfn" href="#pull-into-descriptor" id="ref-for-pull-into-descriptor②">pull-into descriptor</a> with</p> <dl class="props"> <dt><a data-link-type="dfn" href="#pull-into-descriptor-buffer" id="ref-for-pull-into-descriptor-buffer①⑦">buffer</a> <dd><var>buffer</var> <dt><a data-link-type="dfn" href="#pull-into-descriptor-buffer-byte-length" id="ref-for-pull-into-descriptor-buffer-byte-length①">buffer byte length</a> <dd><var>buffer</var>.[[ArrayBufferByteLength]] <dt><a data-link-type="dfn" href="#pull-into-descriptor-byte-offset" id="ref-for-pull-into-descriptor-byte-offset⑤">byte offset</a> <dd><var>byteOffset</var> <dt><a data-link-type="dfn" href="#pull-into-descriptor-byte-length" id="ref-for-pull-into-descriptor-byte-length④">byte length</a> <dd><var>byteLength</var> <dt><a data-link-type="dfn" href="#pull-into-descriptor-bytes-filled" id="ref-for-pull-into-descriptor-bytes-filled①⑦">bytes filled</a> <dd>0 <dt><a data-link-type="dfn" href="#pull-into-descriptor-minimum-fill" id="ref-for-pull-into-descriptor-minimum-fill④">minimum fill</a> <dd><var>minimumFill</var> <dt><a data-link-type="dfn" href="#pull-into-descriptor-element-size" id="ref-for-pull-into-descriptor-element-size⑥">element size</a> <dd><var>elementSize</var> <dt><a data-link-type="dfn" href="#pull-into-descriptor-view-constructor" id="ref-for-pull-into-descriptor-view-constructor③">view constructor</a> <dd><var>ctor</var> <dt><a data-link-type="dfn" href="#pull-into-descriptor-reader-type" id="ref-for-pull-into-descriptor-reader-type⑧">reader type</a> <dd>"<code>byob</code>" </dl> <li data-md> <p>If <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-pendingpullintos" id="ref-for-readablebytestreamcontroller-pendingpullintos②①">[[pendingPullIntos]]</a> is not empty,</p> <ol> <li data-md> <p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-append" id="ref-for-list-append⑤">Append</a> <var>pullIntoDescriptor</var> to <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-pendingpullintos" id="ref-for-readablebytestreamcontroller-pendingpullintos②②">[[pendingPullIntos]]</a>.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-add-read-into-request" id="ref-for-readable-stream-add-read-into-request">ReadableStreamAddReadIntoRequest</a>(<var>stream</var>, <var>readIntoRequest</var>).</p> <li data-md> <p>Return.</p> </ol> <li data-md> <p>If <var>stream</var>.<a data-link-type="dfn" href="#readablestream-state" id="ref-for-readablestream-state③②">[[state]]</a> is "<code>closed</code>",</p> <ol> <li data-md> <p>Let <var>emptyView</var> be ! <a data-link-type="abstract-op" href="https://tc39.es/ecma262/multipage/abstract-operations.html#sec-construct" id="ref-for-sec-construct⑤">Construct</a>(<var>ctor</var>, « <var>pullIntoDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-buffer" id="ref-for-pull-into-descriptor-buffer①⑧">buffer</a>, <var>pullIntoDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-byte-offset" id="ref-for-pull-into-descriptor-byte-offset⑥">byte offset</a>, 0 »).</p> <li data-md> <p>Perform <var>readIntoRequest</var>’s <a data-link-type="dfn" href="#read-into-request-close-steps" id="ref-for-read-into-request-close-steps⑤">close steps</a>, given <var>emptyView</var>.</p> <li data-md> <p>Return.</p> </ol> <li data-md> <p>If <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-queuetotalsize" id="ref-for-readablebytestreamcontroller-queuetotalsize①⑥">[[queueTotalSize]]</a> > 0,</p> <ol> <li data-md> <p>If ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-fill-pull-into-descriptor-from-queue" id="ref-for-readable-byte-stream-controller-fill-pull-into-descriptor-from-queue①">ReadableByteStreamControllerFillPullIntoDescriptorFromQueue</a>(<var>controller</var>, <var>pullIntoDescriptor</var>) is true,</p> <ol> <li data-md> <p>Let <var>filledView</var> be ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-convert-pull-into-descriptor" id="ref-for-readable-byte-stream-controller-convert-pull-into-descriptor①">ReadableByteStreamControllerConvertPullIntoDescriptor</a>(<var>pullIntoDescriptor</var>).</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-handle-queue-drain" id="ref-for-readable-byte-stream-controller-handle-queue-drain①">ReadableByteStreamControllerHandleQueueDrain</a>(<var>controller</var>).</p> <li data-md> <p>Perform <var>readIntoRequest</var>’s <a data-link-type="dfn" href="#read-into-request-chunk-steps" id="ref-for-read-into-request-chunk-steps③">chunk steps</a>, given <var>filledView</var>.</p> <li data-md> <p>Return.</p> </ol> <li data-md> <p>If <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-closerequested" id="ref-for-readablebytestreamcontroller-closerequested⑦">[[closeRequested]]</a> is true,</p> <ol> <li data-md> <p>Let <var>e</var> be a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror④①">TypeError</a></code> exception.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-error" id="ref-for-readable-byte-stream-controller-error①①">ReadableByteStreamControllerError</a>(<var>controller</var>, <var>e</var>).</p> <li data-md> <p>Perform <var>readIntoRequest</var>’s <a data-link-type="dfn" href="#read-into-request-error-steps" id="ref-for-read-into-request-error-steps⑤">error steps</a>, given <var>e</var>.</p> <li data-md> <p>Return.</p> </ol> </ol> <li data-md> <p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-append" id="ref-for-list-append⑥">Append</a> <var>pullIntoDescriptor</var> to <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-pendingpullintos" id="ref-for-readablebytestreamcontroller-pendingpullintos②③">[[pendingPullIntos]]</a>.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-add-read-into-request" id="ref-for-readable-stream-add-read-into-request①">ReadableStreamAddReadIntoRequest</a>(<var>stream</var>, <var>readIntoRequest</var>).</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-call-pull-if-needed" id="ref-for-readable-byte-stream-controller-call-pull-if-needed④">ReadableByteStreamControllerCallPullIfNeeded</a>(<var>controller</var>).</p> </ol> </div> <div class="algorithm" data-algorithm="ReadableByteStreamControllerRespond"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableByteStreamControllerRespond" id="readable-byte-stream-controller-respond">ReadableByteStreamControllerRespond(<var>controller</var>, <var>bytesWritten</var>)</dfn> performs the following steps: <ol> <li data-md> <p class="assertion">Assert: <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-pendingpullintos" id="ref-for-readablebytestreamcontroller-pendingpullintos②④">[[pendingPullIntos]]</a> is not empty.</p> <li data-md> <p>Let <var>firstDescriptor</var> be <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-pendingpullintos" id="ref-for-readablebytestreamcontroller-pendingpullintos②⑤">[[pendingPullIntos]]</a>[0].</p> <li data-md> <p>Let <var>state</var> be <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-stream" id="ref-for-readablebytestreamcontroller-stream①②">[[stream]]</a>.<a data-link-type="dfn" href="#readablestream-state" id="ref-for-readablestream-state③③">[[state]]</a>.</p> <li data-md> <p>If <var>state</var> is "<code>closed</code>",</p> <ol> <li data-md> <p>If <var>bytesWritten</var> is not 0, throw a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror④②">TypeError</a></code> exception.</p> </ol> <li data-md> <p>Otherwise,</p> <ol> <li data-md> <p class="assertion">Assert: <var>state</var> is "<code>readable</code>".</p> <li data-md> <p>If <var>bytesWritten</var> is 0, throw a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror④③">TypeError</a></code> exception.</p> <li data-md> <p>If <var>firstDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-bytes-filled" id="ref-for-pull-into-descriptor-bytes-filled①⑧">bytes filled</a> + <var>bytesWritten</var> > <var>firstDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-byte-length" id="ref-for-pull-into-descriptor-byte-length⑤">byte length</a>, throw a <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#exceptiondef-rangeerror" id="ref-for-exceptiondef-rangeerror③">RangeError</a></code> exception.</p> </ol> <li data-md> <p>Set <var>firstDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-buffer" id="ref-for-pull-into-descriptor-buffer①⑨">buffer</a> to ! <a data-link-type="abstract-op" href="#transfer-array-buffer" id="ref-for-transfer-array-buffer④">TransferArrayBuffer</a>(<var>firstDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-buffer" id="ref-for-pull-into-descriptor-buffer②⓪">buffer</a>).</p> <li data-md> <p>Perform ? <a data-link-type="abstract-op" href="#readable-byte-stream-controller-respond-internal" id="ref-for-readable-byte-stream-controller-respond-internal">ReadableByteStreamControllerRespondInternal</a>(<var>controller</var>, <var>bytesWritten</var>).</p> </ol> </div> <div class="algorithm" data-algorithm="ReadableByteStreamControllerRespondInClosedState"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableByteStreamControllerRespondInClosedState" id="readable-byte-stream-controller-respond-in-closed-state">ReadableByteStreamControllerRespondInClosedState(<var>controller</var>, <var>firstDescriptor</var>)</dfn> performs the following steps: <ol> <li data-md> <p class="assertion">Assert: the remainder after dividing <var>firstDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-bytes-filled" id="ref-for-pull-into-descriptor-bytes-filled①⑨">bytes filled</a> by <var>firstDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-element-size" id="ref-for-pull-into-descriptor-element-size⑦">element size</a> is 0.</p> <li data-md> <p>If <var>firstDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-reader-type" id="ref-for-pull-into-descriptor-reader-type⑨">reader type</a> is "<code>none</code>", perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-shift-pending-pull-into" id="ref-for-readable-byte-stream-controller-shift-pending-pull-into③">ReadableByteStreamControllerShiftPendingPullInto</a>(<var>controller</var>).</p> <li data-md> <p>Let <var>stream</var> be <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-stream" id="ref-for-readablebytestreamcontroller-stream①③">[[stream]]</a>.</p> <li data-md> <p>If ! <a data-link-type="abstract-op" href="#readable-stream-has-byob-reader" id="ref-for-readable-stream-has-byob-reader③">ReadableStreamHasBYOBReader</a>(<var>stream</var>) is true,</p> <ol> <li data-md> <p>Let <var>filledPullIntos</var> be a new empty <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list" id="ref-for-list①④">list</a>.</p> <li data-md> <p>Let <var>i</var> be 0.</p> <li data-md> <p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#iteration-while" id="ref-for-iteration-while②">While</a> <var>i</var> < ! <a data-link-type="abstract-op" href="#readable-stream-get-num-read-into-requests" id="ref-for-readable-stream-get-num-read-into-requests">ReadableStreamGetNumReadIntoRequests</a>(<var>stream</var>),</p> <ol> <li data-md> <p>Let <var>pullIntoDescriptor</var> be ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-shift-pending-pull-into" id="ref-for-readable-byte-stream-controller-shift-pending-pull-into④">ReadableByteStreamControllerShiftPendingPullInto</a>(<var>controller</var>).</p> <li data-md> <p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-append" id="ref-for-list-append⑦">Append</a> <var>pullIntoDescriptor</var> to <var>filledPullIntos</var>.</p> <li data-md> <p>Set <var>i</var> to <var>i</var> + 1.</p> </ol> <li data-md> <p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-iterate" id="ref-for-list-iterate⑤">For each</a> <var>filledPullInto</var> of <var>filledPullIntos</var>,</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-commit-pull-into-descriptor" id="ref-for-readable-byte-stream-controller-commit-pull-into-descriptor①">ReadableByteStreamControllerCommitPullIntoDescriptor</a>(<var>stream</var>, <var>filledPullInto</var>).</p> </ol> </ol> </ol> </div> <div class="algorithm" data-algorithm="ReadableByteStreamControllerRespondInReadableState"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableByteStreamControllerRespondInReadableState" id="readable-byte-stream-controller-respond-in-readable-state">ReadableByteStreamControllerRespondInReadableState(<var>controller</var>, <var>bytesWritten</var>, <var>pullIntoDescriptor</var>)</dfn> performs the following steps: <ol> <li data-md> <p class="assertion">Assert: <var>pullIntoDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-bytes-filled" id="ref-for-pull-into-descriptor-bytes-filled②⓪">bytes filled</a> + <var>bytesWritten</var> ≤ <var>pullIntoDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-byte-length" id="ref-for-pull-into-descriptor-byte-length⑥">byte length</a>.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-fill-head-pull-into-descriptor" id="ref-for-readable-byte-stream-controller-fill-head-pull-into-descriptor①">ReadableByteStreamControllerFillHeadPullIntoDescriptor</a>(<var>controller</var>, <var>bytesWritten</var>, <var>pullIntoDescriptor</var>).</p> <li data-md> <p>If <var>pullIntoDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-reader-type" id="ref-for-pull-into-descriptor-reader-type①⓪">reader type</a> is "<code>none</code>",</p> <ol> <li data-md> <p>Perform ? <a data-link-type="abstract-op" href="#abstract-opdef-readablebytestreamcontrollerenqueuedetachedpullintotoqueue" id="ref-for-abstract-opdef-readablebytestreamcontrollerenqueuedetachedpullintotoqueue①">ReadableByteStreamControllerEnqueueDetachedPullIntoToQueue</a>(<var>controller</var>, <var>pullIntoDescriptor</var>).</p> <li data-md> <p>Let <var>filledPullIntos</var> be the result of performing ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-process-pull-into-descriptors-using-queue" id="ref-for-readable-byte-stream-controller-process-pull-into-descriptors-using-queue①">ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue</a>(<var>controller</var>).</p> <li data-md> <p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-iterate" id="ref-for-list-iterate⑥">For each</a> <var>filledPullInto</var> of <var>filledPullIntos</var>,</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-commit-pull-into-descriptor" id="ref-for-readable-byte-stream-controller-commit-pull-into-descriptor②">ReadableByteStreamControllerCommitPullIntoDescriptor</a>(<var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-stream" id="ref-for-readablebytestreamcontroller-stream①④">[[stream]]</a>, <var>filledPullInto</var>).</p> </ol> <li data-md> <p>Return.</p> </ol> <li data-md> <p>If <var>pullIntoDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-bytes-filled" id="ref-for-pull-into-descriptor-bytes-filled②①">bytes filled</a> < <var>pullIntoDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-minimum-fill" id="ref-for-pull-into-descriptor-minimum-fill⑤">minimum fill</a>, return.</p> <p class="note" role="note">A descriptor for a <code class="idl"><a data-link-type="idl" href="#byob-reader-read" id="ref-for-byob-reader-read⑨">read()</a></code> request that is not yet filled up to its minimum length will stay at the head of the queue, so the <a data-link-type="dfn" href="#underlying-source" id="ref-for-underlying-source②⑦">underlying source</a> can keep filling it. </p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-shift-pending-pull-into" id="ref-for-readable-byte-stream-controller-shift-pending-pull-into⑤">ReadableByteStreamControllerShiftPendingPullInto</a>(<var>controller</var>).</p> <li data-md> <p>Let <var>remainderSize</var> be the remainder after dividing <var>pullIntoDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-bytes-filled" id="ref-for-pull-into-descriptor-bytes-filled②②">bytes filled</a> by <var>pullIntoDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-element-size" id="ref-for-pull-into-descriptor-element-size⑧">element size</a>.</p> <li data-md> <p>If <var>remainderSize</var> > 0,</p> <ol> <li data-md> <p>Let <var>end</var> be <var>pullIntoDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-byte-offset" id="ref-for-pull-into-descriptor-byte-offset⑦">byte offset</a> + <var>pullIntoDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-bytes-filled" id="ref-for-pull-into-descriptor-bytes-filled②③">bytes filled</a>.</p> <li data-md> <p>Perform ? <a data-link-type="abstract-op" href="#abstract-opdef-readablebytestreamcontrollerenqueueclonedchunktoqueue" id="ref-for-abstract-opdef-readablebytestreamcontrollerenqueueclonedchunktoqueue①">ReadableByteStreamControllerEnqueueClonedChunkToQueue</a>(<var>controller</var>, <var>pullIntoDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-buffer" id="ref-for-pull-into-descriptor-buffer②①">buffer</a>, <var>end</var> − <var>remainderSize</var>, <var>remainderSize</var>).</p> </ol> <li data-md> <p>Set <var>pullIntoDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-bytes-filled" id="ref-for-pull-into-descriptor-bytes-filled②④">bytes filled</a> to <var>pullIntoDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-bytes-filled" id="ref-for-pull-into-descriptor-bytes-filled②⑤">bytes filled</a> − <var>remainderSize</var>.</p> <li data-md> <p>Let <var>filledPullIntos</var> be the result of performing ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-process-pull-into-descriptors-using-queue" id="ref-for-readable-byte-stream-controller-process-pull-into-descriptors-using-queue②">ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue</a>(<var>controller</var>).</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-commit-pull-into-descriptor" id="ref-for-readable-byte-stream-controller-commit-pull-into-descriptor③">ReadableByteStreamControllerCommitPullIntoDescriptor</a>(<var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-stream" id="ref-for-readablebytestreamcontroller-stream①⑤">[[stream]]</a>, <var>pullIntoDescriptor</var>).</p> <li data-md> <p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-iterate" id="ref-for-list-iterate⑦">For each</a> <var>filledPullInto</var> of <var>filledPullIntos</var>,</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-commit-pull-into-descriptor" id="ref-for-readable-byte-stream-controller-commit-pull-into-descriptor④">ReadableByteStreamControllerCommitPullIntoDescriptor</a>(<var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-stream" id="ref-for-readablebytestreamcontroller-stream①⑥">[[stream]]</a>, <var>filledPullInto</var>).</p> </ol> </ol> </div> <div class="algorithm" data-algorithm="ReadableByteStreamControllerRespondInternal"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableByteStreamControllerRespondInternal" id="readable-byte-stream-controller-respond-internal">ReadableByteStreamControllerRespondInternal(<var>controller</var>, <var>bytesWritten</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>firstDescriptor</var> be <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-pendingpullintos" id="ref-for-readablebytestreamcontroller-pendingpullintos②⑥">[[pendingPullIntos]]</a>[0].</p> <li data-md> <p class="assertion">Assert: ! <a data-link-type="abstract-op" href="#can-transfer-array-buffer" id="ref-for-can-transfer-array-buffer">CanTransferArrayBuffer</a>(<var>firstDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-buffer" id="ref-for-pull-into-descriptor-buffer②②">buffer</a>) is true.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-invalidate-byob-request" id="ref-for-readable-byte-stream-controller-invalidate-byob-request②">ReadableByteStreamControllerInvalidateBYOBRequest</a>(<var>controller</var>).</p> <li data-md> <p>Let <var>state</var> be <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-stream" id="ref-for-readablebytestreamcontroller-stream①⑦">[[stream]]</a>.<a data-link-type="dfn" href="#readablestream-state" id="ref-for-readablestream-state③④">[[state]]</a>.</p> <li data-md> <p>If <var>state</var> is "<code>closed</code>",</p> <ol> <li data-md> <p class="assertion">Assert: <var>bytesWritten</var> is 0.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-respond-in-closed-state" id="ref-for-readable-byte-stream-controller-respond-in-closed-state">ReadableByteStreamControllerRespondInClosedState</a>(<var>controller</var>, <var>firstDescriptor</var>).</p> </ol> <li data-md> <p>Otherwise,</p> <ol> <li data-md> <p class="assertion">Assert: <var>state</var> is "<code>readable</code>".</p> <li data-md> <p class="assertion">Assert: <var>bytesWritten</var> > 0.</p> <li data-md> <p>Perform ? <a data-link-type="abstract-op" href="#readable-byte-stream-controller-respond-in-readable-state" id="ref-for-readable-byte-stream-controller-respond-in-readable-state">ReadableByteStreamControllerRespondInReadableState</a>(<var>controller</var>, <var>bytesWritten</var>, <var>firstDescriptor</var>).</p> </ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-call-pull-if-needed" id="ref-for-readable-byte-stream-controller-call-pull-if-needed⑤">ReadableByteStreamControllerCallPullIfNeeded</a>(<var>controller</var>).</p> </ol> </div> <div class="algorithm" data-algorithm="ReadableByteStreamControllerRespondWithNewView"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableByteStreamControllerRespondWithNewView" id="readable-byte-stream-controller-respond-with-new-view">ReadableByteStreamControllerRespondWithNewView(<var>controller</var>, <var>view</var>)</dfn> performs the following steps: <ol> <li data-md> <p class="assertion">Assert: <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-pendingpullintos" id="ref-for-readablebytestreamcontroller-pendingpullintos②⑦">[[pendingPullIntos]]</a> is not <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-is-empty" id="ref-for-list-is-empty②⓪">empty</a>.</p> <li data-md> <p class="assertion">Assert: ! <a data-link-type="abstract-op" href="https://tc39.es/ecma262/multipage/structured-data.html#sec-isdetachedbuffer" id="ref-for-sec-isdetachedbuffer⑥">IsDetachedBuffer</a>(<var>view</var>.[[ViewedArrayBuffer]]) is false.</p> <li data-md> <p>Let <var>firstDescriptor</var> be <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-pendingpullintos" id="ref-for-readablebytestreamcontroller-pendingpullintos②⑧">[[pendingPullIntos]]</a>[0].</p> <li data-md> <p>Let <var>state</var> be <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-stream" id="ref-for-readablebytestreamcontroller-stream①⑧">[[stream]]</a>.<a data-link-type="dfn" href="#readablestream-state" id="ref-for-readablestream-state③⑤">[[state]]</a>.</p> <li data-md> <p>If <var>state</var> is "<code>closed</code>",</p> <ol> <li data-md> <p>If <var>view</var>.[[ByteLength]] is not 0, throw a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror④④">TypeError</a></code> exception.</p> </ol> <li data-md> <p>Otherwise,</p> <ol> <li data-md> <p class="assertion">Assert: <var>state</var> is "<code>readable</code>".</p> <li data-md> <p>If <var>view</var>.[[ByteLength]] is 0, throw a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror④⑤">TypeError</a></code> exception.</p> </ol> <li data-md> <p>If <var>firstDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-byte-offset" id="ref-for-pull-into-descriptor-byte-offset⑧">byte offset</a> + <var>firstDescriptor</var>’ <a data-link-type="dfn" href="#pull-into-descriptor-bytes-filled" id="ref-for-pull-into-descriptor-bytes-filled②⑥">bytes filled</a> is not <var>view</var>.[[ByteOffset]], throw a <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#exceptiondef-rangeerror" id="ref-for-exceptiondef-rangeerror④">RangeError</a></code> exception.</p> <li data-md> <p>If <var>firstDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-buffer-byte-length" id="ref-for-pull-into-descriptor-buffer-byte-length②">buffer byte length</a> is not <var>view</var>.[[ViewedArrayBuffer]].[[ByteLength]], throw a <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#exceptiondef-rangeerror" id="ref-for-exceptiondef-rangeerror⑤">RangeError</a></code> exception.</p> <li data-md> <p>If <var>firstDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-bytes-filled" id="ref-for-pull-into-descriptor-bytes-filled②⑦">bytes filled</a> + <var>view</var>.[[ByteLength]] > <var>firstDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-byte-length" id="ref-for-pull-into-descriptor-byte-length⑦">byte length</a>, throw a <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#exceptiondef-rangeerror" id="ref-for-exceptiondef-rangeerror⑥">RangeError</a></code> exception.</p> <li data-md> <p>Let <var>viewByteLength</var> be <var>view</var>.[[ByteLength]].</p> <li data-md> <p>Set <var>firstDescriptor</var>’s <a data-link-type="dfn" href="#pull-into-descriptor-buffer" id="ref-for-pull-into-descriptor-buffer②③">buffer</a> to ? <a data-link-type="abstract-op" href="#transfer-array-buffer" id="ref-for-transfer-array-buffer⑤">TransferArrayBuffer</a>(<var>view</var>.[[ViewedArrayBuffer]]).</p> <li data-md> <p>Perform ? <a data-link-type="abstract-op" href="#readable-byte-stream-controller-respond-internal" id="ref-for-readable-byte-stream-controller-respond-internal①">ReadableByteStreamControllerRespondInternal</a>(<var>controller</var>, <var>viewByteLength</var>).</p> </ol> </div> <div class="algorithm" data-algorithm="ReadableByteStreamControllerShiftPendingPullInto"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableByteStreamControllerShiftPendingPullInto" id="readable-byte-stream-controller-shift-pending-pull-into">ReadableByteStreamControllerShiftPendingPullInto(<var>controller</var>)</dfn> performs the following steps: <ol> <li data-md> <p class="assertion">Assert: <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-byobrequest" id="ref-for-readablebytestreamcontroller-byobrequest⑧">[[byobRequest]]</a> is null.</p> <li data-md> <p>Let <var>descriptor</var> be <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-pendingpullintos" id="ref-for-readablebytestreamcontroller-pendingpullintos②⑨">[[pendingPullIntos]]</a>[0].</p> <li data-md> <p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-remove" id="ref-for-list-remove⑤">Remove</a> <var>descriptor</var> from <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-pendingpullintos" id="ref-for-readablebytestreamcontroller-pendingpullintos③⓪">[[pendingPullIntos]]</a>.</p> <li data-md> <p>Return <var>descriptor</var>.</p> </ol> </div> <div class="algorithm" data-algorithm="ReadableByteStreamControllerShouldCallPull"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ReadableByteStreamControllerShouldCallPull" id="readable-byte-stream-controller-should-call-pull">ReadableByteStreamControllerShouldCallPull(<var>controller</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>stream</var> be <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-stream" id="ref-for-readablebytestreamcontroller-stream①⑨">[[stream]]</a>.</p> <li data-md> <p>If <var>stream</var>.<a data-link-type="dfn" href="#readablestream-state" id="ref-for-readablestream-state③⑥">[[state]]</a> is not "<code>readable</code>", return false.</p> <li data-md> <p>If <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-closerequested" id="ref-for-readablebytestreamcontroller-closerequested⑧">[[closeRequested]]</a> is true, return false.</p> <li data-md> <p>If <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-started" id="ref-for-readablebytestreamcontroller-started">[[started]]</a> is false, return false.</p> <li data-md> <p>If ! <a data-link-type="abstract-op" href="#readable-stream-has-default-reader" id="ref-for-readable-stream-has-default-reader④">ReadableStreamHasDefaultReader</a>(<var>stream</var>) is true and ! <a data-link-type="abstract-op" href="#readable-stream-get-num-read-requests" id="ref-for-readable-stream-get-num-read-requests④">ReadableStreamGetNumReadRequests</a>(<var>stream</var>) > 0, return true.</p> <li data-md> <p>If ! <a data-link-type="abstract-op" href="#readable-stream-has-byob-reader" id="ref-for-readable-stream-has-byob-reader④">ReadableStreamHasBYOBReader</a>(<var>stream</var>) is true and ! <a data-link-type="abstract-op" href="#readable-stream-get-num-read-into-requests" id="ref-for-readable-stream-get-num-read-into-requests①">ReadableStreamGetNumReadIntoRequests</a>(<var>stream</var>) > 0, return true.</p> <li data-md> <p>Let <var>desiredSize</var> be ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-get-desired-size" id="ref-for-readable-byte-stream-controller-get-desired-size①">ReadableByteStreamControllerGetDesiredSize</a>(<var>controller</var>).</p> <li data-md> <p class="assertion">Assert: <var>desiredSize</var> is not null.</p> <li data-md> <p>If <var>desiredSize</var> > 0, return true.</p> <li data-md> <p>Return false.</p> </ol> </div> <div class="algorithm" data-algorithm="SetUpReadableByteStreamController"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="SetUpReadableByteStreamController" id="set-up-readable-byte-stream-controller">SetUpReadableByteStreamController(<var>stream</var>, <var>controller</var>, <var>startAlgorithm</var>, <var>pullAlgorithm</var>, <var>cancelAlgorithm</var>, <var>highWaterMark</var>, <var>autoAllocateChunkSize</var>)</dfn> performs the following steps: <ol> <li data-md> <p class="assertion">Assert: <var>stream</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller④④">[[controller]]</a> is undefined.</p> <li data-md> <p>If <var>autoAllocateChunkSize</var> is not undefined,</p> <ol> <li data-md> <p class="assertion">Assert: ! <a data-link-type="abstract-op" href="https://tc39.es/ecma262/#sec-isinteger" id="ref-for-sec-isinteger">IsInteger</a>(<var>autoAllocateChunkSize</var>) is true.</p> <li data-md> <p class="assertion">Assert: <var>autoAllocateChunkSize</var> is positive.</p> </ol> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-stream" id="ref-for-readablebytestreamcontroller-stream②⓪">[[stream]]</a> to <var>stream</var>.</p> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-pullagain" id="ref-for-readablebytestreamcontroller-pullagain④">[[pullAgain]]</a> and <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-pulling" id="ref-for-readablebytestreamcontroller-pulling③">[[pulling]]</a> to false.</p> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-byobrequest" id="ref-for-readablebytestreamcontroller-byobrequest⑨">[[byobRequest]]</a> to null.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#reset-queue" id="ref-for-reset-queue⑤">ResetQueue</a>(<var>controller</var>).</p> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-closerequested" id="ref-for-readablebytestreamcontroller-closerequested⑨">[[closeRequested]]</a> and <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-started" id="ref-for-readablebytestreamcontroller-started①">[[started]]</a> to false.</p> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-strategyhwm" id="ref-for-readablebytestreamcontroller-strategyhwm①">[[strategyHWM]]</a> to <var>highWaterMark</var>.</p> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-pullalgorithm" id="ref-for-readablebytestreamcontroller-pullalgorithm②">[[pullAlgorithm]]</a> to <var>pullAlgorithm</var>.</p> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-cancelalgorithm" id="ref-for-readablebytestreamcontroller-cancelalgorithm②">[[cancelAlgorithm]]</a> to <var>cancelAlgorithm</var>.</p> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-autoallocatechunksize" id="ref-for-readablebytestreamcontroller-autoallocatechunksize①">[[autoAllocateChunkSize]]</a> to <var>autoAllocateChunkSize</var>.</p> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-pendingpullintos" id="ref-for-readablebytestreamcontroller-pendingpullintos③①">[[pendingPullIntos]]</a> to a new empty <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list" id="ref-for-list①⑤">list</a>.</p> <li data-md> <p>Set <var>stream</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller④⑤">[[controller]]</a> to <var>controller</var>.</p> <li data-md> <p>Let <var>startResult</var> be the result of performing <var>startAlgorithm</var>.</p> <li data-md> <p>Let <var>startPromise</var> be <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-resolved-with" id="ref-for-a-promise-resolved-with①⑦">a promise resolved with</a> <var>startResult</var>.</p> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#upon-fulfillment" id="ref-for-upon-fulfillment④">Upon fulfillment</a> of <var>startPromise</var>,</p> <ol> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-started" id="ref-for-readablebytestreamcontroller-started②">[[started]]</a> to true.</p> <li data-md> <p class="assertion">Assert: <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-pulling" id="ref-for-readablebytestreamcontroller-pulling④">[[pulling]]</a> is false.</p> <li data-md> <p class="assertion">Assert: <var>controller</var>.<a data-link-type="dfn" href="#readablebytestreamcontroller-pullagain" id="ref-for-readablebytestreamcontroller-pullagain⑤">[[pullAgain]]</a> is false.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-call-pull-if-needed" id="ref-for-readable-byte-stream-controller-call-pull-if-needed⑥">ReadableByteStreamControllerCallPullIfNeeded</a>(<var>controller</var>).</p> </ol> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#upon-rejection" id="ref-for-upon-rejection⑥">Upon rejection</a> of <var>startPromise</var> with reason <var>r</var>,</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-error" id="ref-for-readable-byte-stream-controller-error①②">ReadableByteStreamControllerError</a>(<var>controller</var>, <var>r</var>).</p> </ol> </ol> </div> <div class="algorithm" data-algorithm="SetUpReadableByteStreamControllerFromUnderlyingSource"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="SetUpReadableByteStreamControllerFromUnderlyingSource" id="set-up-readable-byte-stream-controller-from-underlying-source">SetUpReadableByteStreamControllerFromUnderlyingSource(<var>stream</var>, <var>underlyingSource</var>, <var>underlyingSourceDict</var>, <var>highWaterMark</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>controller</var> be a <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#new" id="ref-for-new①①">new</a> <code class="idl"><a data-link-type="idl" href="#readablebytestreamcontroller" id="ref-for-readablebytestreamcontroller①⑧">ReadableByteStreamController</a></code>.</p> <li data-md> <p>Let <var>startAlgorithm</var> be an algorithm that returns undefined.</p> <li data-md> <p>Let <var>pullAlgorithm</var> be an algorithm that returns <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-resolved-with" id="ref-for-a-promise-resolved-with①⑧">a promise resolved with</a> undefined.</p> <li data-md> <p>Let <var>cancelAlgorithm</var> be an algorithm that returns <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-resolved-with" id="ref-for-a-promise-resolved-with①⑨">a promise resolved with</a> undefined.</p> <li data-md> <p>If <var>underlyingSourceDict</var>["<code class="idl"><a data-link-type="idl" href="#dom-underlyingsource-start" id="ref-for-dom-underlyingsource-start⑥">start</a></code>"] <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#map-exists" id="ref-for-map-exists⑧">exists</a>, then set <var>startAlgorithm</var> to an algorithm which returns the result of <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#invoke-a-callback-function" id="ref-for-invoke-a-callback-function④">invoking</a> <var>underlyingSourceDict</var>["<code class="idl"><a data-link-type="idl" href="#dom-underlyingsource-start" id="ref-for-dom-underlyingsource-start⑦">start</a></code>"] with argument list « <var>controller</var> » and <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-callback-this-value" id="ref-for-dfn-callback-this-value③">callback this value</a> <var>underlyingSource</var>.</p> <li data-md> <p>If <var>underlyingSourceDict</var>["<code class="idl"><a data-link-type="idl" href="#dom-underlyingsource-pull" id="ref-for-dom-underlyingsource-pull⑥">pull</a></code>"] <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#map-exists" id="ref-for-map-exists⑨">exists</a>, then set <var>pullAlgorithm</var> to an algorithm which returns the result of <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#invoke-a-callback-function" id="ref-for-invoke-a-callback-function⑤">invoking</a> <var>underlyingSourceDict</var>["<code class="idl"><a data-link-type="idl" href="#dom-underlyingsource-pull" id="ref-for-dom-underlyingsource-pull⑦">pull</a></code>"] with argument list « <var>controller</var> » and <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-callback-this-value" id="ref-for-dfn-callback-this-value④">callback this value</a> <var>underlyingSource</var>.</p> <li data-md> <p>If <var>underlyingSourceDict</var>["<code class="idl"><a data-link-type="idl" href="#dom-underlyingsource-cancel" id="ref-for-dom-underlyingsource-cancel④">cancel</a></code>"] <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#map-exists" id="ref-for-map-exists①⓪">exists</a>, then set <var>cancelAlgorithm</var> to an algorithm which takes an argument <var>reason</var> and returns the result of <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#invoke-a-callback-function" id="ref-for-invoke-a-callback-function⑥">invoking</a> <var>underlyingSourceDict</var>["<code class="idl"><a data-link-type="idl" href="#dom-underlyingsource-cancel" id="ref-for-dom-underlyingsource-cancel⑤">cancel</a></code>"] with argument list « <var>reason</var> » and <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-callback-this-value" id="ref-for-dfn-callback-this-value⑤">callback this value</a> <var>underlyingSource</var>.</p> <li data-md> <p>Let <var>autoAllocateChunkSize</var> be <var>underlyingSourceDict</var>["<code class="idl"><a data-link-type="idl" href="#dom-underlyingsource-autoallocatechunksize" id="ref-for-dom-underlyingsource-autoallocatechunksize①">autoAllocateChunkSize</a></code>"], if it <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#map-exists" id="ref-for-map-exists①①">exists</a>, or undefined otherwise.</p> <li data-md> <p>If <var>autoAllocateChunkSize</var> is 0, then throw a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror④⑥">TypeError</a></code> exception.</p> <li data-md> <p>Perform ? <a data-link-type="abstract-op" href="#set-up-readable-byte-stream-controller" id="ref-for-set-up-readable-byte-stream-controller①">SetUpReadableByteStreamController</a>(<var>stream</var>, <var>controller</var>, <var>startAlgorithm</var>, <var>pullAlgorithm</var>, <var>cancelAlgorithm</var>, <var>highWaterMark</var>, <var>autoAllocateChunkSize</var>).</p> </ol> </div> <h2 class="heading settled" data-level="5" id="ws"><span class="secno">5. </span><span class="content">Writable streams</span><a class="self-link" href="#ws"></a></h2> <h3 class="heading settled" data-level="5.1" id="ws-intro"><span class="secno">5.1. </span><span class="content">Using writable streams</span><a class="self-link" href="#ws-intro"></a></h3> <div class="example" id="example-basic-pipe-to-2"> <a class="self-link" href="#example-basic-pipe-to-2"></a> The usual way to write to a writable stream is to simply <a data-link-type="dfn" href="#piping" id="ref-for-piping⑧">pipe</a> a <a data-link-type="dfn" href="#readable-stream" id="ref-for-readable-stream①④">readable stream</a> to it. This ensures that <a data-link-type="dfn" href="#backpressure" id="ref-for-backpressure⑨">backpressure</a> is respected, so that if the writable stream’s <a data-link-type="dfn" href="#underlying-sink" id="ref-for-underlying-sink⑤">underlying sink</a> is not able to accept data as fast as the readable stream can produce it, the readable stream is informed of this and has a chance to slow down its data production. <pre class="highlight">readableStream<c- p>.</c->pipeTo<c- p>(</c->writableStream<c- p>)</c-> <c- p>.</c->then<c- p>(()</c-> <c- p>=></c-> console<c- p>.</c->log<c- p>(</c-><c- u>"All data successfully written!"</c-><c- p>))</c-> <c- p>.</c-><c- k>catch</c-><c- p>(</c->e <c- p>=></c-> console<c- p>.</c->error<c- p>(</c-><c- u>"Something went wrong!"</c-><c- p>,</c-> e<c- p>));</c-> </pre> </div> <div class="example" id="example-manual-write-batch"> <a class="self-link" href="#example-manual-write-batch"></a> You can also write directly to writable streams by acquiring a <a data-link-type="dfn" href="#writer" id="ref-for-writer①">writer</a> and using its <code class="idl"><a data-link-type="idl" href="#default-writer-write" id="ref-for-default-writer-write">write()</a></code> and <code class="idl"><a data-link-type="idl" href="#default-writer-close" id="ref-for-default-writer-close">close()</a></code> methods. Since writable streams queue any incoming writes, and take care internally to forward them to the <a data-link-type="dfn" href="#underlying-sink" id="ref-for-underlying-sink⑥">underlying sink</a> in sequence, you can indiscriminately write to a writable stream without much ceremony: <pre class="highlight"><c- a>function</c-> writeArrayToStream<c- p>(</c->array<c- p>,</c-> writableStream<c- p>)</c-> <c- p>{</c-> <c- a>const</c-> writer <c- o>=</c-> writableStream<c- p>.</c->getWriter<c- p>();</c-> array<c- p>.</c->forEach<c- p>(</c->chunk <c- p>=></c-> writer<c- p>.</c->write<c- p>(</c->chunk<c- p>).</c-><c- k>catch</c-><c- p>(()</c-> <c- p>=></c-> <c- p>{}));</c-> <c- k>return</c-> writer<c- p>.</c->close<c- p>();</c-> <c- p>}</c-> writeArrayToStream<c- p>([</c-><c- mf>1</c-><c- p>,</c-> <c- mf>2</c-><c- p>,</c-> <c- mf>3</c-><c- p>,</c-> <c- mf>4</c-><c- p>,</c-> <c- mf>5</c-><c- p>],</c-> writableStream<c- p>)</c-> <c- p>.</c->then<c- p>(()</c-> <c- p>=></c-> console<c- p>.</c->log<c- p>(</c-><c- u>"All done!"</c-><c- p>))</c-> <c- p>.</c-><c- k>catch</c-><c- p>(</c->e <c- p>=></c-> console<c- p>.</c->error<c- p>(</c-><c- u>"Error with the stream: "</c-> <c- o>+</c-> e<c- p>));</c-> </pre> <p>Note how we use <code>.catch(() => {})</code> to suppress any rejections from the <code class="idl"><a data-link-type="idl" href="#default-writer-write" id="ref-for-default-writer-write①">write()</a></code> method; we’ll be notified of any fatal errors via a rejection of the <code class="idl"><a data-link-type="idl" href="#default-writer-close" id="ref-for-default-writer-close①">close()</a></code> method, and leaving them un-caught would cause potential <code class="idl"><a data-link-type="idl" href="https://html.spec.whatwg.org/multipage/indices.html#event-unhandledrejection" id="ref-for-event-unhandledrejection">unhandledrejection</a></code> events and console warnings.</p> </div> <div class="example" id="example-manual-write-with-error-handling"> <a class="self-link" href="#example-manual-write-with-error-handling"></a> In the previous example we only paid attention to the success or failure of the entire stream, by looking at the promise returned by the writer’s <code class="idl"><a data-link-type="idl" href="#default-writer-close" id="ref-for-default-writer-close②">close()</a></code> method. That promise will reject if anything goes wrong with the stream—initializing it, writing to it, or closing it. And it will fulfill once the stream is successfully closed. Often this is all you care about. <p>However, if you care about the success of writing a specific <a data-link-type="dfn" href="#chunk" id="ref-for-chunk⑤⓪">chunk</a>, you can use the promise returned by the writer’s <code class="idl"><a data-link-type="idl" href="#default-writer-write" id="ref-for-default-writer-write②">write()</a></code> method:</p> <pre class="highlight">writer<c- p>.</c->write<c- p>(</c-><c- u>"i am a chunk of data"</c-><c- p>)</c-> <c- p>.</c->then<c- p>(()</c-> <c- p>=></c-> console<c- p>.</c->log<c- p>(</c-><c- u>"chunk successfully written!"</c-><c- p>))</c-> <c- p>.</c-><c- k>catch</c-><c- p>(</c->e <c- p>=></c-> console<c- p>.</c->error<c- p>(</c->e<c- p>));</c-> </pre> <p>What "success" means is up to a given stream instance (or more precisely, its <a data-link-type="dfn" href="#underlying-sink" id="ref-for-underlying-sink⑦">underlying sink</a>) to decide. For example, for a file stream it could simply mean that the OS has accepted the write, and not necessarily that the chunk has been flushed to disk. Some streams might not be able to give such a signal at all, in which case the returned promise will fulfill immediately.</p> </div> <div class="example" id="example-manual-write-with-backpressure"> <a class="self-link" href="#example-manual-write-with-backpressure"></a> The <code class="idl"><a data-link-type="idl" href="#default-writer-desired-size" id="ref-for-default-writer-desired-size①">desiredSize</a></code> and <code class="idl"><a data-link-type="idl" href="#default-writer-ready" id="ref-for-default-writer-ready">ready</a></code> properties of <a data-link-type="dfn" href="#writer" id="ref-for-writer②">writable stream writers</a> allow <a data-link-type="dfn" href="#producer" id="ref-for-producer②">producers</a> to more precisely respond to flow control signals from the stream, to keep memory usage below the stream’s specified <a data-link-type="dfn" href="#high-water-mark" id="ref-for-high-water-mark②">high water mark</a>. The following example writes an infinite sequence of random bytes to a stream, using <code class="idl"><a data-link-type="idl" href="#default-writer-desired-size" id="ref-for-default-writer-desired-size②">desiredSize</a></code> to determine how many bytes to generate at a given time, and using <code class="idl"><a data-link-type="idl" href="#default-writer-ready" id="ref-for-default-writer-ready①">ready</a></code> to wait for the <a data-link-type="dfn" href="#backpressure" id="ref-for-backpressure①⓪">backpressure</a> to subside. <pre class="highlight"><c- k>async</c-> <c- a>function</c-> writeRandomBytesForever<c- p>(</c->writableStream<c- p>)</c-> <c- p>{</c-> <c- a>const</c-> writer <c- o>=</c-> writableStream<c- p>.</c->getWriter<c- p>();</c-> <c- k>while</c-> <c- p>(</c-><c- kc>true</c-><c- p>)</c-> <c- p>{</c-> <c- k>await</c-> writer<c- p>.</c->ready<c- p>;</c-> <c- a>const</c-> bytes <c- o>=</c-> <c- ow>new</c-> Uint8Array<c- p>(</c->writer<c- p>.</c->desiredSize<c- p>);</c-> crypto<c- p>.</c->getRandomValues<c- p>(</c->bytes<c- p>);</c-> <c- c1>// Purposefully don't await; awaiting writer.ready is enough.</c-> writer<c- p>.</c->write<c- p>(</c->bytes<c- p>).</c-><c- k>catch</c-><c- p>(()</c-> <c- p>=></c-> <c- p>{});</c-> <c- p>}</c-> <c- p>}</c-> writeRandomBytesForever<c- p>(</c->myWritableStream<c- p>).</c-><c- k>catch</c-><c- p>(</c->e <c- p>=></c-> console<c- p>.</c->error<c- p>(</c-><c- u>"Something broke"</c-><c- p>,</c-> e<c- p>));</c-> </pre> <p>Note how we don’t <code>await</code> the promise returned by <code class="idl"><a data-link-type="idl" href="#default-writer-write" id="ref-for-default-writer-write③">write()</a></code>; this would be redundant with <code>await</code>ing the <code class="idl"><a data-link-type="idl" href="#default-writer-ready" id="ref-for-default-writer-ready②">ready</a></code> promise. Additionally, similar to <a href="#example-manual-write-batch">a previous example</a>, we use the <code>.catch(() => {})</code> pattern on the promises returned by <code class="idl"><a data-link-type="idl" href="#default-writer-write" id="ref-for-default-writer-write④">write()</a></code>; in this case we’ll be notified about any failures <code>await</code>ing the <code class="idl"><a data-link-type="idl" href="#default-writer-ready" id="ref-for-default-writer-ready③">ready</a></code> promise.</p> </div> <div class="example" id="example-manual-write-dont-await"> <a class="self-link" href="#example-manual-write-dont-await"></a> To further emphasize how it’s a bad idea to <code>await</code> the promise returned by <code class="idl"><a data-link-type="idl" href="#default-writer-write" id="ref-for-default-writer-write⑤">write()</a></code>, consider a modification of the above example, where we continue to use the <code class="idl"><a data-link-type="idl" href="#writablestreamdefaultwriter" id="ref-for-writablestreamdefaultwriter①">WritableStreamDefaultWriter</a></code> interface directly, but we don’t control how many bytes we have to write at a given time. In that case, the <a data-link-type="dfn" href="#backpressure" id="ref-for-backpressure①①">backpressure</a>-respecting code looks the same: <pre class="highlight"><c- k>async</c-> <c- a>function</c-> writeSuppliedBytesForever<c- p>(</c->writableStream<c- p>,</c-> getBytes<c- p>)</c-> <c- p>{</c-> <c- a>const</c-> writer <c- o>=</c-> writableStream<c- p>.</c->getWriter<c- p>();</c-> <c- k>while</c-> <c- p>(</c-><c- kc>true</c-><c- p>)</c-> <c- p>{</c-> <c- k>await</c-> writer<c- p>.</c->ready<c- p>;</c-> <c- a>const</c-> bytes <c- o>=</c-> getBytes<c- p>();</c-> writer<c- p>.</c->write<c- p>(</c->bytes<c- p>).</c-><c- k>catch</c-><c- p>(()</c-> <c- p>=></c-> <c- p>{});</c-> <c- p>}</c-> <c- p>}</c-> </pre> <p>Unlike the previous example, where—because we were always writing exactly <code class="idl"><a data-link-type="idl" href="#default-writer-desired-size" id="ref-for-default-writer-desired-size③">writer.desiredSize</a></code> bytes each time—the <code class="idl"><a data-link-type="idl" href="#default-writer-write" id="ref-for-default-writer-write⑥">write()</a></code> and <code class="idl"><a data-link-type="idl" href="#default-writer-ready" id="ref-for-default-writer-ready④">ready</a></code> promises were synchronized, in this case it’s quite possible that the <code class="idl"><a data-link-type="idl" href="#default-writer-ready" id="ref-for-default-writer-ready⑤">ready</a></code> promise fulfills before the one returned by <code class="idl"><a data-link-type="idl" href="#default-writer-write" id="ref-for-default-writer-write⑦">write()</a></code> does. Remember, the <code class="idl"><a data-link-type="idl" href="#default-writer-ready" id="ref-for-default-writer-ready⑥">ready</a></code> promise fulfills when the <a data-link-type="dfn" href="#desired-size-to-fill-a-streams-internal-queue" id="ref-for-desired-size-to-fill-a-streams-internal-queue④">desired size</a> becomes positive, which might be before the write succeeds (especially in cases with a larger <a data-link-type="dfn" href="#high-water-mark" id="ref-for-high-water-mark③">high water mark</a>).</p> <p>In other words, <code>await</code>ing the return value of <code class="idl"><a data-link-type="idl" href="#default-writer-write" id="ref-for-default-writer-write⑧">write()</a></code> means you never queue up writes in the stream’s <a data-link-type="dfn" href="#internal-queues" id="ref-for-internal-queues①①">internal queue</a>, instead only executing a write after the previous one succeeds, which can result in low throughput.</p> </div> <h3 class="heading settled" data-level="5.2" id="ws-class"><span class="secno">5.2. </span><span class="content">The <code class="idl"><a data-link-type="idl" href="#writablestream" id="ref-for-writablestream⑧">WritableStream</a></code> class</span><a class="self-link" href="#ws-class"></a></h3> <p>The <code class="idl"><a data-link-type="idl" href="#writablestream" id="ref-for-writablestream⑨">WritableStream</a></code> represents a <a data-link-type="dfn" href="#writable-stream" id="ref-for-writable-stream⑥">writable stream</a>.</p> <h4 class="heading settled" data-level="5.2.1" id="ws-class-definition"><span class="secno">5.2.1. </span><span class="content">Interface definition</span><a class="self-link" href="#ws-class-definition"></a></h4> <p>The Web IDL definition for the <code class="idl"><a data-link-type="idl" href="#writablestream" id="ref-for-writablestream①⓪">WritableStream</a></code> class is given as follows:</p> <pre class="idl highlight def">[Exposed=*, <a class="idl-code" data-link-type="extended-attribute" href="https://html.spec.whatwg.org/multipage/structured-data.html#transferable" id="ref-for-transferable①"><c- g>Transferable</c-></a>] <c- b>interface</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="interface" data-export id="writablestream"><code><c- g>WritableStream</c-></code></dfn> { <a class="idl-code" data-link-type="constructor" href="#ws-constructor" id="ref-for-ws-constructor①"><c- g>constructor</c-></a>(<c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-object" id="ref-for-idl-object①"><c- b>object</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="WritableStream/WritableStream(underlyingSink, strategy), WritableStream/constructor(underlyingSink, strategy), WritableStream/WritableStream(underlyingSink), WritableStream/constructor(underlyingSink), WritableStream/WritableStream(), WritableStream/constructor()" data-dfn-type="argument" data-export id="dom-writablestream-writablestream-underlyingsink-strategy-underlyingsink"><code><c- g>underlyingSink</c-></code></dfn>, <c- b>optional</c-> <a data-link-type="idl-name" href="#dictdef-queuingstrategy" id="ref-for-dictdef-queuingstrategy①"><c- n>QueuingStrategy</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="WritableStream/WritableStream(underlyingSink, strategy), WritableStream/constructor(underlyingSink, strategy), WritableStream/WritableStream(underlyingSink), WritableStream/constructor(underlyingSink), WritableStream/WritableStream(), WritableStream/constructor()" data-dfn-type="argument" data-export id="dom-writablestream-writablestream-underlyingsink-strategy-strategy"><code><c- g>strategy</c-></code></dfn> = {}); <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-boolean" id="ref-for-idl-boolean⑥"><c- b>boolean</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="boolean" href="#ws-locked" id="ref-for-ws-locked①"><c- g>locked</c-></a>; <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise" id="ref-for-idl-promise⑧"><c- b>Promise</c-></a><<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined" id="ref-for-idl-undefined①⑥"><c- b>undefined</c-></a>> <a class="idl-code" data-link-type="method" href="#ws-abort" id="ref-for-ws-abort①"><c- g>abort</c-></a>(<c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any" id="ref-for-idl-any①⓪"><c- b>any</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="WritableStream/abort(reason), WritableStream/abort()" data-dfn-type="argument" data-export id="dom-writablestream-abort-reason-reason"><code><c- g>reason</c-></code></dfn>); <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise" id="ref-for-idl-promise⑨"><c- b>Promise</c-></a><<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined" id="ref-for-idl-undefined①⑦"><c- b>undefined</c-></a>> <a class="idl-code" data-link-type="method" href="#ws-close" id="ref-for-ws-close"><c- g>close</c-></a>(); <a data-link-type="idl-name" href="#writablestreamdefaultwriter" id="ref-for-writablestreamdefaultwriter②"><c- n>WritableStreamDefaultWriter</c-></a> <a class="idl-code" data-link-type="method" href="#ws-get-writer" id="ref-for-ws-get-writer"><c- g>getWriter</c-></a>(); }; </pre> <h4 class="heading settled" data-level="5.2.2" id="ws-internal-slots"><span class="secno">5.2.2. </span><span class="content">Internal slots</span><a class="self-link" href="#ws-internal-slots"></a></h4> <p>Instances of <code class="idl"><a data-link-type="idl" href="#writablestream" id="ref-for-writablestream①①">WritableStream</a></code> are created with the internal slots described in the following table:</p> <table> <thead> <tr> <th>Internal Slot <th>Description (<em>non-normative</em>) <tbody> <tr> <td><dfn class="dfn-paneled" data-dfn-for="WritableStream" data-dfn-type="dfn" data-noexport id="writablestream-backpressure">[[backpressure]]</dfn> <td class="non-normative">A boolean indicating the backpressure signal set by the controller <tr> <td><dfn class="dfn-paneled" data-dfn-for="WritableStream" data-dfn-type="dfn" data-noexport id="writablestream-closerequest">[[closeRequest]]</dfn> <td class="non-normative">The promise returned from the writer’s <code class="idl"><a data-link-type="idl" href="#default-writer-close" id="ref-for-default-writer-close③">close()</a></code> method <tr> <td><dfn class="dfn-paneled" data-dfn-for="WritableStream" data-dfn-type="dfn" data-noexport id="writablestream-controller">[[controller]]</dfn> <td class="non-normative">A <code class="idl"><a data-link-type="idl" href="#writablestreamdefaultcontroller" id="ref-for-writablestreamdefaultcontroller">WritableStreamDefaultController</a></code> created with the ability to control the state and queue of this stream <tr> <td><dfn class="dfn-paneled" data-dfn-for="WritableStream" data-dfn-type="dfn" data-export id="writablestream-detached">[[Detached]]</dfn> <td class="non-normative">A boolean flag set to true when the stream is transferred <tr> <td><dfn class="dfn-paneled" data-dfn-for="WritableStream" data-dfn-type="dfn" data-noexport id="writablestream-inflightwriterequest">[[inFlightWriteRequest]]</dfn> <td class="non-normative">A slot set to the promise for the current in-flight write operation while the <a data-link-type="dfn" href="#underlying-sink" id="ref-for-underlying-sink⑧">underlying sink</a>'s write algorithm is executing and has not yet fulfilled, used to prevent reentrant calls <tr> <td><dfn class="dfn-paneled" data-dfn-for="WritableStream" data-dfn-type="dfn" data-noexport id="writablestream-inflightcloserequest">[[inFlightCloseRequest]]</dfn> <td class="non-normative">A slot set to the promise for the current in-flight close operation while the <a data-link-type="dfn" href="#underlying-sink" id="ref-for-underlying-sink⑨">underlying sink</a>'s close algorithm is executing and has not yet fulfilled, used to prevent the <code class="idl"><a data-link-type="idl" href="#default-writer-abort" id="ref-for-default-writer-abort">abort()</a></code> method from interrupting close <tr> <td><dfn class="dfn-paneled" data-dfn-for="WritableStream" data-dfn-type="dfn" data-noexport id="writablestream-pendingabortrequest">[[pendingAbortRequest]]</dfn> <td class="non-normative">A <a data-link-type="dfn" href="#pending-abort-request" id="ref-for-pending-abort-request">pending abort request</a> <tr> <td><dfn class="dfn-paneled" data-dfn-for="WritableStream" data-dfn-type="dfn" data-noexport id="writablestream-state">[[state]]</dfn> <td class="non-normative">A string containing the stream’s current state, used internally; one of "<code>writable</code>", "<code>closed</code>", "<code>erroring</code>", or "<code>errored</code>" <tr> <td><dfn class="dfn-paneled" data-dfn-for="WritableStream" data-dfn-type="dfn" data-noexport id="writablestream-storederror">[[storedError]]</dfn> <td class="non-normative">A value indicating how the stream failed, to be given as a failure reason or exception when trying to operate on the stream while in the "<code>errored</code>" state <tr> <td><dfn class="dfn-paneled" data-dfn-for="WritableStream" data-dfn-type="dfn" data-noexport id="writablestream-writer">[[writer]]</dfn> <td class="non-normative">A <code class="idl"><a data-link-type="idl" href="#writablestreamdefaultwriter" id="ref-for-writablestreamdefaultwriter③">WritableStreamDefaultWriter</a></code> instance, if the stream is <a data-link-type="dfn" href="#lock" id="ref-for-lock①②">locked to a writer</a>, or undefined if it is not <tr> <td><dfn class="dfn-paneled" data-dfn-for="WritableStream" data-dfn-type="dfn" data-noexport id="writablestream-writerequests">[[writeRequests]]</dfn> <td class="non-normative">A <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list" id="ref-for-list①⑥">list</a> of promises representing the stream’s internal queue of write requests not yet processed by the <a data-link-type="dfn" href="#underlying-sink" id="ref-for-underlying-sink①⓪">underlying sink</a> </table> <p class="note" role="note">The <a data-link-type="dfn" href="#writablestream-inflightcloserequest" id="ref-for-writablestream-inflightcloserequest">[[inFlightCloseRequest]]</a> slot and <a data-link-type="dfn" href="#writablestream-closerequest" id="ref-for-writablestream-closerequest">[[closeRequest]]</a> slot are mutually exclusive. Similarly, no element will be removed from <a data-link-type="dfn" href="#writablestream-writerequests" id="ref-for-writablestream-writerequests">[[writeRequests]]</a> while <a data-link-type="dfn" href="#writablestream-inflightwriterequest" id="ref-for-writablestream-inflightwriterequest">[[inFlightWriteRequest]]</a> is not undefined. Implementations can optimize storage for these slots based on these invariants. </p> <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="pending-abort-request">pending abort request</dfn> is a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#struct" id="ref-for-struct④">struct</a> used to track a request to abort the stream before that request is finally processed. It has the following <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#struct-item" id="ref-for-struct-item①⓪">items</a>:</p> <dl> <dt data-md><dfn class="dfn-paneled" data-dfn-for="pending abort request" data-dfn-type="dfn" data-noexport id="pending-abort-request-promise">promise</dfn> <dd data-md> <p>A promise returned from <a data-link-type="abstract-op" href="#writable-stream-abort" id="ref-for-writable-stream-abort②">WritableStreamAbort</a></p> <dt data-md><dfn class="dfn-paneled" data-dfn-for="pending abort request" data-dfn-type="dfn" data-noexport id="pending-abort-request-reason">reason</dfn> <dd data-md> <p>A JavaScript value that was passed as the abort reason to <a data-link-type="abstract-op" href="#writable-stream-abort" id="ref-for-writable-stream-abort③">WritableStreamAbort</a></p> <dt data-md><dfn class="dfn-paneled" data-dfn-for="pending abort request" data-dfn-type="dfn" data-noexport id="pending-abort-request-was-already-erroring">was already erroring</dfn> <dd data-md> <p>A boolean indicating whether or not the stream was in the "<code>erroring</code>" state when <a data-link-type="abstract-op" href="#writable-stream-abort" id="ref-for-writable-stream-abort④">WritableStreamAbort</a> was called, which impacts the outcome of the abort request</p> </dl> <h4 class="heading settled" data-level="5.2.3" id="underlying-sink-api"><span class="secno">5.2.3. </span><span class="content">The underlying sink API</span><a class="self-link" href="#underlying-sink-api"></a></h4> <p>The <code class="idl"><a data-link-type="idl" href="#ws-constructor" id="ref-for-ws-constructor②">WritableStream()</a></code> constructor accepts as its first argument a JavaScript object representing the <a data-link-type="dfn" href="#underlying-sink" id="ref-for-underlying-sink①①">underlying sink</a>. Such objects can contain any of the following properties:</p> <pre class="idl highlight def"><c- b>dictionary</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="dictionary" data-export id="dictdef-underlyingsink"><code><c- g>UnderlyingSink</c-></code></dfn> { <a data-link-type="idl-name" href="#callbackdef-underlyingsinkstartcallback" id="ref-for-callbackdef-underlyingsinkstartcallback"><c- n>UnderlyingSinkStartCallback</c-></a> <a class="idl-code" data-link-type="dict-member" data-type="UnderlyingSinkStartCallback" href="#dom-underlyingsink-start" id="ref-for-dom-underlyingsink-start"><c- g>start</c-></a>; <a data-link-type="idl-name" href="#callbackdef-underlyingsinkwritecallback" id="ref-for-callbackdef-underlyingsinkwritecallback"><c- n>UnderlyingSinkWriteCallback</c-></a> <a class="idl-code" data-link-type="dict-member" data-type="UnderlyingSinkWriteCallback" href="#dom-underlyingsink-write" id="ref-for-dom-underlyingsink-write①"><c- g>write</c-></a>; <a data-link-type="idl-name" href="#callbackdef-underlyingsinkclosecallback" id="ref-for-callbackdef-underlyingsinkclosecallback"><c- n>UnderlyingSinkCloseCallback</c-></a> <a class="idl-code" data-link-type="dict-member" data-type="UnderlyingSinkCloseCallback" href="#dom-underlyingsink-close" id="ref-for-dom-underlyingsink-close①"><c- g>close</c-></a>; <a data-link-type="idl-name" href="#callbackdef-underlyingsinkabortcallback" id="ref-for-callbackdef-underlyingsinkabortcallback"><c- n>UnderlyingSinkAbortCallback</c-></a> <a class="idl-code" data-link-type="dict-member" data-type="UnderlyingSinkAbortCallback" href="#dom-underlyingsink-abort" id="ref-for-dom-underlyingsink-abort①"><c- g>abort</c-></a>; <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any" id="ref-for-idl-any①①"><c- b>any</c-></a> <a class="idl-code" data-link-type="dict-member" data-type="any" href="#dom-underlyingsink-type" id="ref-for-dom-underlyingsink-type"><c- g>type</c-></a>; }; <c- b>callback</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="callback" data-export id="callbackdef-underlyingsinkstartcallback"><code><c- g>UnderlyingSinkStartCallback</c-></code></dfn> = <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any" id="ref-for-idl-any①②"><c- b>any</c-></a> (<a data-link-type="idl-name" href="#writablestreamdefaultcontroller" id="ref-for-writablestreamdefaultcontroller①"><c- n>WritableStreamDefaultController</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="UnderlyingSinkStartCallback" data-dfn-type="argument" data-export id="dom-underlyingsinkstartcallback-controller"><code><c- g>controller</c-></code></dfn>); <c- b>callback</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="callback" data-export id="callbackdef-underlyingsinkwritecallback"><code><c- g>UnderlyingSinkWriteCallback</c-></code></dfn> = <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise" id="ref-for-idl-promise①⓪"><c- b>Promise</c-></a><<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined" id="ref-for-idl-undefined①⑧"><c- b>undefined</c-></a>> (<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any" id="ref-for-idl-any①③"><c- b>any</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="UnderlyingSinkWriteCallback" data-dfn-type="argument" data-export id="dom-underlyingsinkwritecallback-chunk"><code><c- g>chunk</c-></code></dfn>, <a data-link-type="idl-name" href="#writablestreamdefaultcontroller" id="ref-for-writablestreamdefaultcontroller②"><c- n>WritableStreamDefaultController</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="UnderlyingSinkWriteCallback" data-dfn-type="argument" data-export id="dom-underlyingsinkwritecallback-controller"><code><c- g>controller</c-></code></dfn>); <c- b>callback</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="callback" data-export id="callbackdef-underlyingsinkclosecallback"><code><c- g>UnderlyingSinkCloseCallback</c-></code></dfn> = <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise" id="ref-for-idl-promise①①"><c- b>Promise</c-></a><<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined" id="ref-for-idl-undefined①⑨"><c- b>undefined</c-></a>> (); <c- b>callback</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="callback" data-export id="callbackdef-underlyingsinkabortcallback"><code><c- g>UnderlyingSinkAbortCallback</c-></code></dfn> = <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise" id="ref-for-idl-promise①②"><c- b>Promise</c-></a><<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined" id="ref-for-idl-undefined②⓪"><c- b>undefined</c-></a>> (<c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any" id="ref-for-idl-any①④"><c- b>any</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="UnderlyingSinkAbortCallback" data-dfn-type="argument" data-export id="dom-underlyingsinkabortcallback-reason"><code><c- g>reason</c-></code></dfn>); </pre> <dl> <dt><dfn class="dfn-paneled idl-code" data-dfn-for="UnderlyingSink" data-dfn-type="dict-member" data-export data-lt="start" id="dom-underlyingsink-start"><code>start(<var>controller</var>)</code></dfn>, <span> of type <a data-link-type="idl-name" href="#callbackdef-underlyingsinkstartcallback" id="ref-for-callbackdef-underlyingsinkstartcallback①">UnderlyingSinkStartCallback</a></span> <dd> <p>A function that is called immediately during creation of the <code class="idl"><a data-link-type="idl" href="#writablestream" id="ref-for-writablestream①②">WritableStream</a></code>. </p> <p>Typically this is used to acquire access to the <a data-link-type="dfn" href="#underlying-sink" id="ref-for-underlying-sink①②">underlying sink</a> resource being represented. </p> <p>If this setup process is asynchronous, it can return a promise to signal success or failure; a rejected promise will error the stream. Any thrown exceptions will be re-thrown by the <code class="idl"><a data-link-type="idl" href="#ws-constructor" id="ref-for-ws-constructor③">WritableStream()</a></code> constructor. </p> <dt><dfn class="dfn-paneled idl-code" data-dfn-for="UnderlyingSink" data-dfn-type="dict-member" data-export data-lt="write" id="dom-underlyingsink-write"><code>write(<var>chunk</var>, <var>controller</var>)</code></dfn>, <span> of type <a data-link-type="idl-name" href="#callbackdef-underlyingsinkwritecallback" id="ref-for-callbackdef-underlyingsinkwritecallback①">UnderlyingSinkWriteCallback</a></span> <dd> <p>A function that is called when a new <a data-link-type="dfn" href="#chunk" id="ref-for-chunk⑤①">chunk</a> of data is ready to be written to the <a data-link-type="dfn" href="#underlying-sink" id="ref-for-underlying-sink①③">underlying sink</a>. The stream implementation guarantees that this function will be called only after previous writes have succeeded, and never before <code class="idl"><a data-link-type="idl" href="#dom-underlyingsink-start" id="ref-for-dom-underlyingsink-start①">start()</a></code> has succeeded or after <code class="idl"><a data-link-type="idl" href="#dom-underlyingsink-close" id="ref-for-dom-underlyingsink-close②">close()</a></code> or <code class="idl"><a data-link-type="idl" href="#dom-underlyingsink-abort" id="ref-for-dom-underlyingsink-abort②">abort()</a></code> have been called. </p> <p>This function is used to actually send the data to the resource presented by the <a data-link-type="dfn" href="#underlying-sink" id="ref-for-underlying-sink①④">underlying sink</a>, for example by calling a lower-level API. </p> <p>If the process of writing data is asynchronous, and communicates success or failure signals back to its user, then this function can return a promise to signal success or failure. This promise return value will be communicated back to the caller of <code class="idl"><a data-link-type="idl" href="#default-writer-write" id="ref-for-default-writer-write⑨">writer.write()</a></code>, so they can monitor that individual write. Throwing an exception is treated the same as returning a rejected promise. </p> <p>Note that such signals are not always available; compare e.g. <a href="#example-ws-no-backpressure">§ 10.6 A writable stream with no backpressure or success signals</a> with <a href="#example-ws-backpressure">§ 10.7 A writable stream with backpressure and success signals</a>. In such cases, it’s best to not return anything. </p> <p>The promise potentially returned by this function also governs whether the given chunk counts as written for the purposes of computed the <a data-link-type="dfn" href="#desired-size-to-fill-a-streams-internal-queue" id="ref-for-desired-size-to-fill-a-streams-internal-queue⑤">desired size to fill the stream’s internal queue</a>. That is, during the time it takes the promise to settle, <code class="idl"><a data-link-type="idl" href="#default-writer-desired-size" id="ref-for-default-writer-desired-size④">writer.desiredSize</a></code> will stay at its previous value, only increasing to signal the desire for more chunks once the write succeeds. </p> <p>Finally, the promise potentially returned by this function is used to ensure that <a href="#write-mutable-chunks">well-behaved</a> <a data-link-type="dfn" href="#producer" id="ref-for-producer③">producers</a> do not attempt to mutate the <a data-link-type="dfn" href="#chunk" id="ref-for-chunk⑤②">chunk</a> before it has been fully processed. (This is not guaranteed by any specification machinery, but instead is an informal contract between <a data-link-type="dfn" href="#producer" id="ref-for-producer④">producers</a> and the <a data-link-type="dfn" href="#underlying-sink" id="ref-for-underlying-sink①⑤">underlying sink</a>.) </p> <dt><dfn class="dfn-paneled idl-code" data-dfn-for="UnderlyingSink" data-dfn-type="dict-member" data-export data-lt="close" id="dom-underlyingsink-close"><code>close()</code></dfn>, <span> of type <a data-link-type="idl-name" href="#callbackdef-underlyingsinkclosecallback" id="ref-for-callbackdef-underlyingsinkclosecallback①">UnderlyingSinkCloseCallback</a></span> <dd> <p>A function that is called after the <a data-link-type="dfn" href="#producer" id="ref-for-producer⑤">producer</a> signals, via <code class="idl"><a data-link-type="idl" href="#default-writer-close" id="ref-for-default-writer-close④">writer.close()</a></code>, that they are done writing <a data-link-type="dfn" href="#chunk" id="ref-for-chunk⑤③">chunks</a> to the stream, and subsequently all queued-up writes have successfully completed. </p> <p>This function can perform any actions necessary to finalize or flush writes to the <a data-link-type="dfn" href="#underlying-sink" id="ref-for-underlying-sink①⑥">underlying sink</a>, and release access to any held resources. </p> <p>If the shutdown process is asynchronous, the function can return a promise to signal success or failure; the result will be communicated via the return value of the called <code class="idl"><a data-link-type="idl" href="#default-writer-close" id="ref-for-default-writer-close⑤">writer.close()</a></code> method. Additionally, a rejected promise will error the stream, instead of letting it close successfully. Throwing an exception is treated the same as returning a rejected promise. </p> <dt><dfn class="dfn-paneled idl-code" data-dfn-for="UnderlyingSink" data-dfn-type="dict-member" data-export data-lt="abort" id="dom-underlyingsink-abort"><code>abort(<var>reason</var>)</code></dfn>, <span> of type <a data-link-type="idl-name" href="#callbackdef-underlyingsinkabortcallback" id="ref-for-callbackdef-underlyingsinkabortcallback①">UnderlyingSinkAbortCallback</a></span> <dd> <p>A function that is called after the <a data-link-type="dfn" href="#producer" id="ref-for-producer⑥">producer</a> signals, via <code class="idl"><a data-link-type="idl" href="#ws-abort" id="ref-for-ws-abort②">stream.abort()</a></code> or <code class="idl"><a data-link-type="idl" href="#default-writer-abort" id="ref-for-default-writer-abort①">writer.abort()</a></code>, that they wish to <a data-link-type="dfn" href="#abort-a-writable-stream" id="ref-for-abort-a-writable-stream③">abort</a> the stream. It takes as its argument the same value as was passed to those methods by the producer. </p> <p>Writable streams can additionally be aborted under certain conditions during <a data-link-type="dfn" href="#piping" id="ref-for-piping⑨">piping</a>; see the definition of the <code class="idl"><a data-link-type="idl" href="#rs-pipe-to" id="ref-for-rs-pipe-to⑥">pipeTo()</a></code> method for more details. </p> <p>This function can clean up any held resources, much like <code class="idl"><a data-link-type="idl" href="#dom-underlyingsink-close" id="ref-for-dom-underlyingsink-close③">close()</a></code>, but perhaps with some custom handling. </p> <p>If the shutdown process is asynchronous, the function can return a promise to signal success or failure; the result will be communicated via the return value of the called <code class="idl"><a data-link-type="idl" href="#default-writer-abort" id="ref-for-default-writer-abort②">writer.abort()</a></code> method. Throwing an exception is treated the same as returning a rejected promise. Regardless, the stream will be errored with a new <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror④⑦">TypeError</a></code> indicating that it was aborted. </p> <dt><dfn class="dfn-paneled idl-code" data-dfn-for="UnderlyingSink" data-dfn-type="dict-member" data-export id="dom-underlyingsink-type"><code>type</code></dfn>, <span> of type <a data-link-type="idl-name" href="https://webidl.spec.whatwg.org/#idl-any" id="ref-for-idl-any①⑤">any</a></span> <dd> <p>This property is reserved for future use, so any attempts to supply a value will throw an exception. </p> </dl> <p>The <code>controller</code> argument passed to <code class="idl"><a data-link-type="idl" href="#dom-underlyingsink-start" id="ref-for-dom-underlyingsink-start②">start()</a></code> and <code class="idl"><a data-link-type="idl" href="#dom-underlyingsink-write" id="ref-for-dom-underlyingsink-write②">write()</a></code> is an instance of <code class="idl"><a data-link-type="idl" href="#writablestreamdefaultcontroller" id="ref-for-writablestreamdefaultcontroller③">WritableStreamDefaultController</a></code>, and has the ability to error the stream. This is mainly used for bridging the gap with non-promise-based APIs, as seen for example in <a href="#example-ws-no-backpressure">§ 10.6 A writable stream with no backpressure or success signals</a>.</p> <h4 class="heading settled" data-level="5.2.4" id="ws-prototype"><span class="secno">5.2.4. </span><span class="content">Constructor, methods, and properties</span><a class="self-link" href="#ws-prototype"></a></h4> <dl class="domintro non-normative"> <dt><code><var>stream</var> = new <code class="idl"><a data-link-type="idl" href="#ws-constructor" id="ref-for-ws-constructor④">WritableStream</a></code>(<var>underlyingSink</var>[, <var>strategy</var>)</code> <dd> <p>Creates a new <code class="idl"><a data-link-type="idl" href="#writablestream" id="ref-for-writablestream①③">WritableStream</a></code> wrapping the provided <a data-link-type="dfn" href="#underlying-sink" id="ref-for-underlying-sink①⑦">underlying sink</a>. See <a href="#underlying-sink-api">§ 5.2.3 The underlying sink API</a> for more details on the <var>underlyingSink</var> argument. </p> <p>The <var>strategy</var> argument represents the stream’s <a data-link-type="dfn" href="#queuing-strategy" id="ref-for-queuing-strategy④">queuing strategy</a>, as described in <a href="#qs-api">§ 7.1 The queuing strategy API</a>. If it is not provided, the default behavior will be the same as a <code class="idl"><a data-link-type="idl" href="#countqueuingstrategy" id="ref-for-countqueuingstrategy②">CountQueuingStrategy</a></code> with a <a data-link-type="dfn" href="#high-water-mark" id="ref-for-high-water-mark④">high water mark</a> of 1. </p> <dt><code><var>isLocked</var> = <var>stream</var>.<code class="idl"><a data-link-type="idl" href="#ws-locked" id="ref-for-ws-locked②">locked</a></code></code> <dd> <p>Returns whether or not the writable stream is <a data-link-type="dfn" href="#lock" id="ref-for-lock①③">locked to a writer</a>. </p> <dt><code>await <var>stream</var>.<code class="idl"><a data-link-type="idl" href="#ws-abort" id="ref-for-ws-abort③">abort</a></code>([ <var>reason</var> ])</code> <dd> <p><a data-link-type="dfn" href="#abort-a-writable-stream" id="ref-for-abort-a-writable-stream④">Aborts</a> the stream, signaling that the producer can no longer successfully write to the stream and it is to be immediately moved to an errored state, with any queued-up writes discarded. This will also execute any abort mechanism of the <a data-link-type="dfn" href="#underlying-sink" id="ref-for-underlying-sink①⑧">underlying sink</a>. </p> <p>The returned promise will fulfill if the stream shuts down successfully, or reject if the underlying sink signaled that there was an error doing so. Additionally, it will reject with a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror④⑧">TypeError</a></code> (without attempting to cancel the stream) if the stream is currently <a data-link-type="dfn" href="#lock" id="ref-for-lock①④">locked</a>. </p> <dt><code>await <var>stream</var>.<code class="idl"><a data-link-type="idl" href="#ws-close" id="ref-for-ws-close①">close</a></code>()</code> <dd> <p>Closes the stream. The <a data-link-type="dfn" href="#underlying-sink" id="ref-for-underlying-sink①⑨">underlying sink</a> will finish processing any previously-written <a data-link-type="dfn" href="#chunk" id="ref-for-chunk⑤④">chunks</a>, before invoking its close behavior. During this time any further attempts to write will fail (without erroring the stream). </p> <p>The method returns a promise that will fulfill if all remaining <a data-link-type="dfn" href="#chunk" id="ref-for-chunk⑤⑤">chunks</a> are successfully written and the stream successfully closes, or rejects if an error is encountered during this process. Additionally, it will reject with a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror④⑨">TypeError</a></code> (without attempting to cancel the stream) if the stream is currently <a data-link-type="dfn" href="#lock" id="ref-for-lock①⑤">locked</a>. </p> <dt><code><var>writer</var> = <var>stream</var>.<code class="idl"><a data-link-type="idl" href="#ws-get-writer" id="ref-for-ws-get-writer①">getWriter</a></code>()</code> <dd> <p>Creates a <a data-link-type="dfn" href="#writer" id="ref-for-writer③">writer</a> (an instance of <code class="idl"><a data-link-type="idl" href="#writablestreamdefaultwriter" id="ref-for-writablestreamdefaultwriter④">WritableStreamDefaultWriter</a></code>) and <a data-link-type="dfn" href="#lock" id="ref-for-lock①⑥">locks</a> the stream to the new writer. While the stream is locked, no other writer can be acquired until this one is <a data-link-type="dfn" href="#release-a-lock" id="ref-for-release-a-lock⑦">released</a>. </p> <p>This functionality is especially useful for creating abstractions that desire the ability to write to a stream without interruption or interleaving. By getting a writer for the stream, you can ensure nobody else can write at the same time, which would cause the resulting written data to be unpredictable and probably useless. </p> </dl> <div class="algorithm" data-algorithm="WritableStream(underlyingSink, strategy)" data-algorithm-for="WritableStream"> The <dfn class="dfn-paneled idl-code" data-dfn-for="WritableStream" data-dfn-type="constructor" data-export data-lt="WritableStream(underlyingSink, strategy)|constructor(underlyingSink, strategy)|WritableStream(underlyingSink)|constructor(underlyingSink)|WritableStream()|constructor()" id="ws-constructor"><code>new WritableStream(<var>underlyingSink</var>, <var>strategy</var>)</code></dfn> constructor steps are: <ol> <li data-md> <p>If <var>underlyingSink</var> is missing, set it to null.</p> <li data-md> <p>Let <var>underlyingSinkDict</var> be <var>underlyingSink</var>, <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-convert-ecmascript-to-idl-value" id="ref-for-dfn-convert-ecmascript-to-idl-value①">converted to an IDL value</a> of type <code class="idl"><a data-link-type="idl" href="#dictdef-underlyingsink" id="ref-for-dictdef-underlyingsink">UnderlyingSink</a></code>.</p> <p class="note" role="note">We cannot declare the <var>underlyingSink</var> argument as having the <code class="idl"><a data-link-type="idl" href="#dictdef-underlyingsink" id="ref-for-dictdef-underlyingsink①">UnderlyingSink</a></code> type directly, because doing so would lose the reference to the original object. We need to retain the object so we can <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#invoke-a-callback-function" id="ref-for-invoke-a-callback-function⑦">invoke</a> the various methods on it. </p> <li data-md> <p>If <var>underlyingSinkDict</var>["<code class="idl"><a data-link-type="idl" href="#dom-underlyingsink-type" id="ref-for-dom-underlyingsink-type①">type</a></code>"] <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#map-exists" id="ref-for-map-exists①②">exists</a>, throw a <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#exceptiondef-rangeerror" id="ref-for-exceptiondef-rangeerror⑦">RangeError</a></code> exception.</p> <p class="note" role="note">This is to allow us to add new potential types in the future, without backward-compatibility concerns. </p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#initialize-writable-stream" id="ref-for-initialize-writable-stream">InitializeWritableStream</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑦④">this</a>).</p> <li data-md> <p>Let <var>sizeAlgorithm</var> be ! <a data-link-type="abstract-op" href="#make-size-algorithm-from-size-function" id="ref-for-make-size-algorithm-from-size-function①">ExtractSizeAlgorithm</a>(<var>strategy</var>).</p> <li data-md> <p>Let <var>highWaterMark</var> be ? <a data-link-type="abstract-op" href="#validate-and-normalize-high-water-mark" id="ref-for-validate-and-normalize-high-water-mark②">ExtractHighWaterMark</a>(<var>strategy</var>, 1).</p> <li data-md> <p>Perform ? <a data-link-type="abstract-op" href="#set-up-writable-stream-default-controller-from-underlying-sink" id="ref-for-set-up-writable-stream-default-controller-from-underlying-sink">SetUpWritableStreamDefaultControllerFromUnderlyingSink</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑦⑤">this</a>, <var>underlyingSink</var>, <var>underlyingSinkDict</var>, <var>highWaterMark</var>, <var>sizeAlgorithm</var>).</p> </ol> </div> <div class="algorithm" data-algorithm="locked" data-algorithm-for="WritableStream"> The <dfn class="dfn-paneled idl-code" data-dfn-for="WritableStream" data-dfn-type="attribute" data-export id="ws-locked"><code>locked</code></dfn> getter steps are: <ol> <li data-md> <p>Return ! <a data-link-type="abstract-op" href="#is-writable-stream-locked" id="ref-for-is-writable-stream-locked③">IsWritableStreamLocked</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑦⑥">this</a>).</p> </ol> </div> <div class="algorithm" data-algorithm="abort(reason)" data-algorithm-for="WritableStream"> The <dfn class="dfn-paneled idl-code" data-dfn-for="WritableStream" data-dfn-type="method" data-export data-lt="abort(reason)|abort()" id="ws-abort"><code>abort(<var>reason</var>)</code></dfn> method steps are: <ol> <li data-md> <p>If ! <a data-link-type="abstract-op" href="#is-writable-stream-locked" id="ref-for-is-writable-stream-locked④">IsWritableStreamLocked</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑦⑦">this</a>) is true, return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-rejected-with" id="ref-for-a-promise-rejected-with①⑧">a promise rejected with</a> a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror⑤⓪">TypeError</a></code> exception.</p> <li data-md> <p>Return ! <a data-link-type="abstract-op" href="#writable-stream-abort" id="ref-for-writable-stream-abort⑤">WritableStreamAbort</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑦⑧">this</a>, <var>reason</var>).</p> </ol> </div> <div class="algorithm" data-algorithm="close()" data-algorithm-for="WritableStream"> The <dfn class="dfn-paneled idl-code" data-dfn-for="WritableStream" data-dfn-type="method" data-export id="ws-close"><code>close()</code></dfn> method steps are: <ol> <li data-md> <p>If ! <a data-link-type="abstract-op" href="#is-writable-stream-locked" id="ref-for-is-writable-stream-locked⑤">IsWritableStreamLocked</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑦⑨">this</a>) is true, return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-rejected-with" id="ref-for-a-promise-rejected-with①⑨">a promise rejected with</a> a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror⑤①">TypeError</a></code> exception.</p> <li data-md> <p>If ! <a data-link-type="abstract-op" href="#writable-stream-close-queued-or-in-flight" id="ref-for-writable-stream-close-queued-or-in-flight③">WritableStreamCloseQueuedOrInFlight</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑧⓪">this</a>) is true, return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-rejected-with" id="ref-for-a-promise-rejected-with②⓪">a promise rejected with</a> a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror⑤②">TypeError</a></code> exception.</p> <li data-md> <p>Return ! <a data-link-type="abstract-op" href="#writable-stream-close" id="ref-for-writable-stream-close">WritableStreamClose</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑧①">this</a>).</p> </ol> </div> <div class="algorithm" data-algorithm="getWriter()" data-algorithm-for="WritableStream"> The <dfn class="dfn-paneled idl-code" data-dfn-for="WritableStream" data-dfn-type="method" data-export id="ws-get-writer"><code>getWriter()</code></dfn> method steps are: <ol> <li data-md> <p>Return ? <a data-link-type="abstract-op" href="#acquire-writable-stream-default-writer" id="ref-for-acquire-writable-stream-default-writer①">AcquireWritableStreamDefaultWriter</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑧②">this</a>).</p> </ol> </div> <h4 class="heading settled" data-level="5.2.5" id="ws-transfer"><span class="secno">5.2.5. </span><span class="content">Transfer via <code>postMessage()</code></span><a class="self-link" href="#ws-transfer"></a></h4> <dl class="domintro"> <dt><code>destination.postMessage(ws, { transfer: [ws] });</code> <dd> <p>Sends a <code class="idl"><a data-link-type="idl" href="#writablestream" id="ref-for-writablestream①④">WritableStream</a></code> to another frame, window, or worker. </p> <p>The transferred stream can be used exactly like the original. The original will become <a data-link-type="dfn" href="#lock" id="ref-for-lock①⑦">locked</a> and no longer directly usable. </p> </dl> <div class="algorithm" data-algorithm="WritableStream transfer steps"> <code class="idl"><a data-link-type="idl" href="#writablestream" id="ref-for-writablestream①⑤">WritableStream</a></code> objects are <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/structured-data.html#transferable-objects" id="ref-for-transferable-objects②">transferable objects</a>. Their <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/structured-data.html#transfer-steps" id="ref-for-transfer-steps①">transfer steps</a>, given <var>value</var> and <var>dataHolder</var>, are: <ol> <li data-md> <p>If ! <a data-link-type="abstract-op" href="#is-writable-stream-locked" id="ref-for-is-writable-stream-locked⑥">IsWritableStreamLocked</a>(<var>value</var>) is true, throw a "<code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#datacloneerror" id="ref-for-datacloneerror①">DataCloneError</a></code>" <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#idl-DOMException" id="ref-for-idl-DOMException①">DOMException</a></code>.</p> <li data-md> <p>Let <var>port1</var> be a <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#new" id="ref-for-new①②">new</a> <code class="idl"><a data-link-type="idl" href="https://html.spec.whatwg.org/multipage/web-messaging.html#messageport" id="ref-for-messageport②">MessagePort</a></code> in <a data-link-type="dfn" href="https://tc39.es/ecma262/#current-realm" id="ref-for-current-realm④">the current Realm</a>.</p> <li data-md> <p>Let <var>port2</var> be a <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#new" id="ref-for-new①③">new</a> <code class="idl"><a data-link-type="idl" href="https://html.spec.whatwg.org/multipage/web-messaging.html#messageport" id="ref-for-messageport③">MessagePort</a></code> in <a data-link-type="dfn" href="https://tc39.es/ecma262/#current-realm" id="ref-for-current-realm⑤">the current Realm</a>.</p> <li data-md> <p><a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/web-messaging.html#entangle" id="ref-for-entangle①">Entangle</a> <var>port1</var> and <var>port2</var>.</p> <li data-md> <p>Let <var>readable</var> be a <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#new" id="ref-for-new①④">new</a> <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream④⑦">ReadableStream</a></code> in <a data-link-type="dfn" href="https://tc39.es/ecma262/#current-realm" id="ref-for-current-realm⑥">the current Realm</a>.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#abstract-opdef-setupcrossrealmtransformreadable" id="ref-for-abstract-opdef-setupcrossrealmtransformreadable①">SetUpCrossRealmTransformReadable</a>(<var>readable</var>, <var>port1</var>).</p> <li data-md> <p>Let <var>promise</var> be ! <a data-link-type="abstract-op" href="#readable-stream-pipe-to" id="ref-for-readable-stream-pipe-to③">ReadableStreamPipeTo</a>(<var>readable</var>, <var>value</var>, false, false, false).</p> <li data-md> <p>Set <var>promise</var>.[[PromiseIsHandled]] to true.</p> <li data-md> <p>Set <var>dataHolder</var>.[[port]] to ! <a data-link-type="abstract-op" href="https://html.spec.whatwg.org/multipage/structured-data.html#structuredserializewithtransfer" id="ref-for-structuredserializewithtransfer①">StructuredSerializeWithTransfer</a>(<var>port2</var>, « <var>port2</var> »).</p> </ol> </div> <div class="algorithm" data-algorithm="WritableStream transfer-receiving steps"> Their <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/structured-data.html#transfer-receiving-steps" id="ref-for-transfer-receiving-steps①">transfer-receiving steps</a>, given <var>dataHolder</var> and <var>value</var>, are: <ol> <li data-md> <p>Let <var>deserializedRecord</var> be ! <a data-link-type="abstract-op" href="https://html.spec.whatwg.org/multipage/structured-data.html#structureddeserializewithtransfer" id="ref-for-structureddeserializewithtransfer①">StructuredDeserializeWithTransfer</a>(<var>dataHolder</var>.[[port]], <a data-link-type="dfn" href="https://tc39.es/ecma262/#current-realm" id="ref-for-current-realm⑦">the current Realm</a>).</p> <li data-md> <p>Let <var>port</var> be a <var>deserializedRecord</var>.[[Deserialized]].</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#abstract-opdef-setupcrossrealmtransformwritable" id="ref-for-abstract-opdef-setupcrossrealmtransformwritable①">SetUpCrossRealmTransformWritable</a>(<var>value</var>, <var>port</var>).</p> </ol> </div> <h3 class="heading settled" data-level="5.3" id="default-writer-class"><span class="secno">5.3. </span><span class="content">The <code class="idl"><a data-link-type="idl" href="#writablestreamdefaultwriter" id="ref-for-writablestreamdefaultwriter⑤">WritableStreamDefaultWriter</a></code> class</span><a class="self-link" href="#default-writer-class"></a></h3> <p>The <code class="idl"><a data-link-type="idl" href="#writablestreamdefaultwriter" id="ref-for-writablestreamdefaultwriter⑥">WritableStreamDefaultWriter</a></code> class represents a <a data-link-type="dfn" href="#writer" id="ref-for-writer④">writable stream writer</a> designed to be vended by a <code class="idl"><a data-link-type="idl" href="#writablestream" id="ref-for-writablestream①⑥">WritableStream</a></code> instance.</p> <h4 class="heading settled" data-level="5.3.1" id="default-writer-class-definition"><span class="secno">5.3.1. </span><span class="content">Interface definition</span><a class="self-link" href="#default-writer-class-definition"></a></h4> <p>The Web IDL definition for the <code class="idl"><a data-link-type="idl" href="#writablestreamdefaultwriter" id="ref-for-writablestreamdefaultwriter⑦">WritableStreamDefaultWriter</a></code> class is given as follows:</p> <pre class="idl highlight def">[Exposed=*] <c- b>interface</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="interface" data-export id="writablestreamdefaultwriter"><code><c- g>WritableStreamDefaultWriter</c-></code></dfn> { <a class="idl-code" data-link-type="constructor" href="#default-writer-constructor" id="ref-for-default-writer-constructor"><c- g>constructor</c-></a>(<a data-link-type="idl-name" href="#writablestream" id="ref-for-writablestream①⑦"><c- n>WritableStream</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="WritableStreamDefaultWriter/WritableStreamDefaultWriter(stream), WritableStreamDefaultWriter/constructor(stream)" data-dfn-type="argument" data-export id="dom-writablestreamdefaultwriter-writablestreamdefaultwriter-stream-stream"><code><c- g>stream</c-></code></dfn>); <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise" id="ref-for-idl-promise①③"><c- b>Promise</c-></a><<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined" id="ref-for-idl-undefined②①"><c- b>undefined</c-></a>> <a class="idl-code" data-link-type="attribute" data-readonly data-type="Promise<undefined>" href="#default-writer-closed" id="ref-for-default-writer-closed"><c- g>closed</c-></a>; <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-unrestricted-double" id="ref-for-idl-unrestricted-double③"><c- b>unrestricted</c-> <c- b>double</c-></a>? <a class="idl-code" data-link-type="attribute" data-readonly data-type="unrestricted double?" href="#default-writer-desired-size" id="ref-for-default-writer-desired-size⑤"><c- g>desiredSize</c-></a>; <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise" id="ref-for-idl-promise①④"><c- b>Promise</c-></a><<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined" id="ref-for-idl-undefined②②"><c- b>undefined</c-></a>> <a class="idl-code" data-link-type="attribute" data-readonly data-type="Promise<undefined>" href="#default-writer-ready" id="ref-for-default-writer-ready⑦"><c- g>ready</c-></a>; <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise" id="ref-for-idl-promise①⑤"><c- b>Promise</c-></a><<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined" id="ref-for-idl-undefined②③"><c- b>undefined</c-></a>> <a class="idl-code" data-link-type="method" href="#default-writer-abort" id="ref-for-default-writer-abort③"><c- g>abort</c-></a>(<c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any" id="ref-for-idl-any①⑥"><c- b>any</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="WritableStreamDefaultWriter/abort(reason), WritableStreamDefaultWriter/abort()" data-dfn-type="argument" data-export id="dom-writablestreamdefaultwriter-abort-reason-reason"><code><c- g>reason</c-></code></dfn>); <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise" id="ref-for-idl-promise①⑥"><c- b>Promise</c-></a><<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined" id="ref-for-idl-undefined②④"><c- b>undefined</c-></a>> <a class="idl-code" data-link-type="method" href="#default-writer-close" id="ref-for-default-writer-close⑥"><c- g>close</c-></a>(); <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined" id="ref-for-idl-undefined②⑤"><c- b>undefined</c-></a> <a class="idl-code" data-link-type="method" href="#default-writer-release-lock" id="ref-for-default-writer-release-lock①"><c- g>releaseLock</c-></a>(); <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise" id="ref-for-idl-promise①⑦"><c- b>Promise</c-></a><<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined" id="ref-for-idl-undefined②⑥"><c- b>undefined</c-></a>> <a class="idl-code" data-link-type="method" href="#default-writer-write" id="ref-for-default-writer-write①⓪"><c- g>write</c-></a>(<c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any" id="ref-for-idl-any①⑦"><c- b>any</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="WritableStreamDefaultWriter/write(chunk), WritableStreamDefaultWriter/write()" data-dfn-type="argument" data-export id="dom-writablestreamdefaultwriter-write-chunk-chunk"><code><c- g>chunk</c-></code></dfn>); }; </pre> <h4 class="heading settled" data-level="5.3.2" id="default-writer-internal-slots"><span class="secno">5.3.2. </span><span class="content">Internal slots</span><a class="self-link" href="#default-writer-internal-slots"></a></h4> <p>Instances of <code class="idl"><a data-link-type="idl" href="#writablestreamdefaultwriter" id="ref-for-writablestreamdefaultwriter⑧">WritableStreamDefaultWriter</a></code> are created with the internal slots described in the following table:</p> <table> <thead> <tr> <th>Internal Slot <th>Description (<em>non-normative</em>) <tbody> <tr> <td><dfn class="dfn-paneled" data-dfn-for="WritableStreamDefaultWriter" data-dfn-type="dfn" data-noexport id="writablestreamdefaultwriter-closedpromise">[[closedPromise]]</dfn> <td class="non-normative">A promise returned by the writer’s <code class="idl"><a data-link-type="idl" href="#default-writer-closed" id="ref-for-default-writer-closed①">closed</a></code> getter <tr> <td><dfn class="dfn-paneled" data-dfn-for="WritableStreamDefaultWriter" data-dfn-type="dfn" data-noexport id="writablestreamdefaultwriter-readypromise">[[readyPromise]]</dfn> <td class="non-normative">A promise returned by the writer’s <code class="idl"><a data-link-type="idl" href="#default-writer-ready" id="ref-for-default-writer-ready⑧">ready</a></code> getter <tr> <td><dfn class="dfn-paneled" data-dfn-for="WritableStreamDefaultWriter" data-dfn-type="dfn" data-noexport id="writablestreamdefaultwriter-stream">[[stream]]</dfn> <td class="non-normative">A <code class="idl"><a data-link-type="idl" href="#writablestream" id="ref-for-writablestream①⑧">WritableStream</a></code> instance that owns this reader </table> <h4 class="heading settled" data-level="5.3.3" id="default-writer-prototype"><span class="secno">5.3.3. </span><span class="content">Constructor, methods, and properties</span><a class="self-link" href="#default-writer-prototype"></a></h4> <dl class="domintro non-normative"> <dt><code><var>writer</var> = new <code class="idl"><a data-link-type="idl" href="#default-writer-constructor" id="ref-for-default-writer-constructor①">WritableStreamDefaultWriter</a></code>(<var>stream</var>)</code> <dd> <p>This is equivalent to calling <code><var>stream</var>.<code class="idl"><a data-link-type="idl" href="#ws-get-writer" id="ref-for-ws-get-writer②">getWriter()</a></code></code>. </p> <dt><code>await <var>writer</var>.<code class="idl"><a data-link-type="idl" href="#default-writer-closed" id="ref-for-default-writer-closed②">closed</a></code></code> <dd> <p>Returns a promise that will be fulfilled when the stream becomes closed, or rejected if the stream ever errors or the writer’s lock is <a data-link-type="dfn" href="#release-a-lock" id="ref-for-release-a-lock⑧">released</a> before the stream finishes closing. </p> <dt><code><var>desiredSize</var> = <var>writer</var>.<code class="idl"><a data-link-type="idl" href="#default-writer-desired-size" id="ref-for-default-writer-desired-size⑥">desiredSize</a></code></code> <dd> <p>Returns the <a data-link-type="dfn" href="#desired-size-to-fill-a-streams-internal-queue" id="ref-for-desired-size-to-fill-a-streams-internal-queue⑥">desired size to fill the stream’s internal queue</a>. It can be negative, if the queue is over-full. A <a data-link-type="dfn" href="#producer" id="ref-for-producer⑦">producer</a> can use this information to determine the right amount of data to write. </p> <p>It will be null if the stream cannot be successfully written to (due to either being errored, or having an abort queued up). It will return zero if the stream is closed. And the getter will throw an exception if invoked when the writer’s lock is <a data-link-type="dfn" href="#release-a-lock" id="ref-for-release-a-lock⑨">released</a>. </p> <dt><code>await <var>writer</var>.<code class="idl"><a data-link-type="idl" href="#default-writer-ready" id="ref-for-default-writer-ready⑨">ready</a></code></code> <dd> <p>Returns a promise that will be fulfilled when the <a data-link-type="dfn" href="#desired-size-to-fill-a-streams-internal-queue" id="ref-for-desired-size-to-fill-a-streams-internal-queue⑦">desired size to fill the stream’s internal queue</a> transitions from non-positive to positive, signaling that it is no longer applying <a data-link-type="dfn" href="#backpressure" id="ref-for-backpressure①②">backpressure</a>. Once the <a data-link-type="dfn" href="#desired-size-to-fill-a-streams-internal-queue" id="ref-for-desired-size-to-fill-a-streams-internal-queue⑧">desired size</a> dips back to zero or below, the getter will return a new promise that stays pending until the next transition. </p> <p>If the stream becomes errored or aborted, or the writer’s lock is <a data-link-type="dfn" href="#release-a-lock" id="ref-for-release-a-lock①⓪">released</a>, the returned promise will become rejected. </p> <dt><code>await <var>writer</var>.<code class="idl"><a data-link-type="idl" href="#default-writer-abort" id="ref-for-default-writer-abort④">abort</a></code>([ <var>reason</var> ])</code> <dd> <p>If the reader is <a data-link-type="dfn" href="#active" id="ref-for-active④">active</a>, behaves the same as <code><var>stream</var>.<code class="idl"><a data-link-type="idl" href="#ws-abort" id="ref-for-ws-abort④">abort</a></code>(<var>reason</var>)</code>. </p> <dt><code>await <var>writer</var>.<code class="idl"><a data-link-type="idl" href="#default-writer-close" id="ref-for-default-writer-close⑦">close</a></code>()</code> <dd> <p>If the reader is <a data-link-type="dfn" href="#active" id="ref-for-active⑤">active</a>, behaves the same as <code><var>stream</var>.<code class="idl"><a data-link-type="idl" href="#ws-close" id="ref-for-ws-close②">close</a></code>()</code>. </p> <dt><code><var>writer</var>.<code class="idl"><a data-link-type="idl" href="#default-writer-release-lock" id="ref-for-default-writer-release-lock②">releaseLock</a></code>()</code> <dd> <p><a data-link-type="dfn" href="#release-a-lock" id="ref-for-release-a-lock①①">Releases the writer’s lock</a> on the corresponding stream. After the lock is released, the writer is no longer <a data-link-type="dfn" href="#active" id="ref-for-active⑥">active</a>. If the associated stream is errored when the lock is released, the writer will appear errored in the same way from now on; otherwise, the writer will appear closed. </p> <p>Note that the lock can still be released even if some ongoing writes have not yet finished (i.e. even if the promises returned from previous calls to <code class="idl"><a data-link-type="idl" href="#default-writer-write" id="ref-for-default-writer-write①①">write()</a></code> have not yet settled). It’s not necessary to hold the lock on the writer for the duration of the write; the lock instead simply prevents other <a data-link-type="dfn" href="#producer" id="ref-for-producer⑧">producers</a> from writing in an interleaved manner. </p> <dt><code>await <var>writer</var>.<code class="idl"><a data-link-type="idl" href="#default-writer-write" id="ref-for-default-writer-write①②">write</a></code>(<var>chunk</var>)</code> <dd> <p>Writes the given <a data-link-type="dfn" href="#chunk" id="ref-for-chunk⑤⑥">chunk</a> to the writable stream, by waiting until any previous writes have finished successfully, and then sending the <a data-link-type="dfn" href="#chunk" id="ref-for-chunk⑤⑦">chunk</a> to the <a data-link-type="dfn" href="#underlying-sink" id="ref-for-underlying-sink②⓪">underlying sink</a>'s <code class="idl"><a data-link-type="idl" href="#dom-underlyingsink-write" id="ref-for-dom-underlyingsink-write③">write()</a></code> method. It will return a promise that fulfills with undefined upon a successful write, or rejects if the write fails or stream becomes errored before the writing process is initiated. </p> <p>Note that what "success" means is up to the <a data-link-type="dfn" href="#underlying-sink" id="ref-for-underlying-sink②①">underlying sink</a>; it might indicate simply that the <a data-link-type="dfn" href="#chunk" id="ref-for-chunk⑤⑧">chunk</a> has been accepted, and not necessarily that it is safely saved to its ultimate destination. </p> <p id="write-mutable-chunks">If <var>chunk</var> is mutable, <a data-link-type="dfn" href="#producer" id="ref-for-producer⑨">producers</a> are advised to avoid mutating it after passing it to <code class="idl"><a data-link-type="idl" href="#default-writer-write" id="ref-for-default-writer-write①③">write()</a></code>, until after the promise returned by <code class="idl"><a data-link-type="idl" href="#default-writer-write" id="ref-for-default-writer-write①④">write()</a></code> settles. This ensures that the <a data-link-type="dfn" href="#underlying-sink" id="ref-for-underlying-sink②②">underlying sink</a> receives and processes the same value that was passed in. </p> </dl> <div class="algorithm" data-algorithm="WritableStreamDefaultWriter(stream)" data-algorithm-for="WritableStreamDefaultWriter"> The <dfn class="dfn-paneled idl-code" data-dfn-for="WritableStreamDefaultWriter" data-dfn-type="constructor" data-export data-lt="WritableStreamDefaultWriter(stream)|constructor(stream)" id="default-writer-constructor"><code>new WritableStreamDefaultWriter(<var>stream</var>)</code></dfn> constructor steps are: <ol> <li data-md> <p>Perform ? <a data-link-type="abstract-op" href="#set-up-writable-stream-default-writer" id="ref-for-set-up-writable-stream-default-writer">SetUpWritableStreamDefaultWriter</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑧③">this</a>, <var>stream</var>).</p> </ol> </div> <div class="algorithm" data-algorithm="closed" data-algorithm-for="WritableStreamDefaultWriter"> The <dfn class="dfn-paneled idl-code" data-dfn-for="WritableStreamDefaultWriter" data-dfn-type="attribute" data-export id="default-writer-closed"><code>closed</code></dfn> getter steps are: <ol> <li data-md> <p>Return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑧④">this</a>.<a data-link-type="dfn" href="#writablestreamdefaultwriter-closedpromise" id="ref-for-writablestreamdefaultwriter-closedpromise">[[closedPromise]]</a>.</p> </ol> </div> <div class="algorithm" data-algorithm="desiredSize" data-algorithm-for="WritableStreamDefaultWriter"> The <dfn class="dfn-paneled idl-code" data-dfn-for="WritableStreamDefaultWriter" data-dfn-type="attribute" data-export id="default-writer-desired-size"><code>desiredSize</code></dfn> getter steps are: <ol> <li data-md> <p>If <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑧⑤">this</a>.<a data-link-type="dfn" href="#writablestreamdefaultwriter-stream" id="ref-for-writablestreamdefaultwriter-stream">[[stream]]</a> is undefined, throw a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror⑤③">TypeError</a></code> exception.</p> <li data-md> <p>Return ! <a data-link-type="abstract-op" href="#writable-stream-default-writer-get-desired-size" id="ref-for-writable-stream-default-writer-get-desired-size②">WritableStreamDefaultWriterGetDesiredSize</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑧⑥">this</a>).</p> </ol> </div> <div class="algorithm" data-algorithm="ready" data-algorithm-for="WritableStreamDefaultWriter"> The <dfn class="dfn-paneled idl-code" data-dfn-for="WritableStreamDefaultWriter" data-dfn-type="attribute" data-export id="default-writer-ready"><code>ready</code></dfn> getter steps are: <ol> <li data-md> <p>Return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑧⑦">this</a>.<a data-link-type="dfn" href="#writablestreamdefaultwriter-readypromise" id="ref-for-writablestreamdefaultwriter-readypromise">[[readyPromise]]</a>.</p> </ol> </div> <div class="algorithm" data-algorithm="abort(reason)" data-algorithm-for="WritableStreamDefaultWriter"> The <dfn class="dfn-paneled idl-code" data-dfn-for="WritableStreamDefaultWriter" data-dfn-type="method" data-export data-lt="abort(reason)|abort()" id="default-writer-abort"><code>abort(<var>reason</var>)</code></dfn> method steps are: <ol> <li data-md> <p>If <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑧⑧">this</a>.<a data-link-type="dfn" href="#writablestreamdefaultwriter-stream" id="ref-for-writablestreamdefaultwriter-stream①">[[stream]]</a> is undefined, return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-rejected-with" id="ref-for-a-promise-rejected-with②①">a promise rejected with</a> a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror⑤④">TypeError</a></code> exception.</p> <li data-md> <p>Return ! <a data-link-type="abstract-op" href="#writable-stream-default-writer-abort" id="ref-for-writable-stream-default-writer-abort">WritableStreamDefaultWriterAbort</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑧⑨">this</a>, <var>reason</var>).</p> </ol> </div> <div class="algorithm" data-algorithm="close()" data-algorithm-for="WritableStreamDefaultWriter"> The <dfn class="dfn-paneled idl-code" data-dfn-for="WritableStreamDefaultWriter" data-dfn-type="method" data-export id="default-writer-close"><code>close()</code></dfn> method steps are: <ol> <li data-md> <p>Let <var>stream</var> be <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑨⓪">this</a>.<a data-link-type="dfn" href="#writablestreamdefaultwriter-stream" id="ref-for-writablestreamdefaultwriter-stream②">[[stream]]</a>.</p> <li data-md> <p>If <var>stream</var> is undefined, return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-rejected-with" id="ref-for-a-promise-rejected-with②②">a promise rejected with</a> a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror⑤⑤">TypeError</a></code> exception.</p> <li data-md> <p>If ! <a data-link-type="abstract-op" href="#writable-stream-close-queued-or-in-flight" id="ref-for-writable-stream-close-queued-or-in-flight④">WritableStreamCloseQueuedOrInFlight</a>(<var>stream</var>) is true, return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-rejected-with" id="ref-for-a-promise-rejected-with②③">a promise rejected with</a> a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror⑤⑥">TypeError</a></code> exception.</p> <li data-md> <p>Return ! <a data-link-type="abstract-op" href="#writable-stream-default-writer-close" id="ref-for-writable-stream-default-writer-close">WritableStreamDefaultWriterClose</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑨①">this</a>).</p> </ol> </div> <div class="algorithm" data-algorithm="releaseLock()" data-algorithm-for="WritableStreamDefaultWriter"> The <dfn class="dfn-paneled idl-code" data-dfn-for="WritableStreamDefaultWriter" data-dfn-type="method" data-export id="default-writer-release-lock"><code>releaseLock()</code></dfn> method steps are: <ol> <li data-md> <p>Let <var>stream</var> be <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑨②">this</a>.<a data-link-type="dfn" href="#writablestreamdefaultwriter-stream" id="ref-for-writablestreamdefaultwriter-stream③">[[stream]]</a>.</p> <li data-md> <p>If <var>stream</var> is undefined, return.</p> <li data-md> <p class="assertion">Assert: <var>stream</var>.<a data-link-type="dfn" href="#writablestream-writer" id="ref-for-writablestream-writer">[[writer]]</a> is not undefined.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#writable-stream-default-writer-release" id="ref-for-writable-stream-default-writer-release①">WritableStreamDefaultWriterRelease</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑨③">this</a>).</p> </ol> </div> <div class="algorithm" data-algorithm="write(chunk)" data-algorithm-for="WritableStreamDefaultWriter"> The <dfn class="dfn-paneled idl-code" data-dfn-for="WritableStreamDefaultWriter" data-dfn-type="method" data-export data-lt="write(chunk)|write()" id="default-writer-write"><code>write(<var>chunk</var>)</code></dfn> method steps are: <ol> <li data-md> <p>If <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑨④">this</a>.<a data-link-type="dfn" href="#writablestreamdefaultwriter-stream" id="ref-for-writablestreamdefaultwriter-stream④">[[stream]]</a> is undefined, return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-rejected-with" id="ref-for-a-promise-rejected-with②④">a promise rejected with</a> a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror⑤⑦">TypeError</a></code> exception.</p> <li data-md> <p>Return ! <a data-link-type="abstract-op" href="#writable-stream-default-writer-write" id="ref-for-writable-stream-default-writer-write">WritableStreamDefaultWriterWrite</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑨⑤">this</a>, <var>chunk</var>).</p> </ol> </div> <h3 class="heading settled" data-level="5.4" id="ws-default-controller-class"><span class="secno">5.4. </span><span class="content">The <code class="idl"><a data-link-type="idl" href="#writablestreamdefaultcontroller" id="ref-for-writablestreamdefaultcontroller④">WritableStreamDefaultController</a></code> class</span><a class="self-link" href="#ws-default-controller-class"></a></h3> <p>The <code class="idl"><a data-link-type="idl" href="#writablestreamdefaultcontroller" id="ref-for-writablestreamdefaultcontroller⑤">WritableStreamDefaultController</a></code> class has methods that allow control of a <code class="idl"><a data-link-type="idl" href="#writablestream" id="ref-for-writablestream①⑨">WritableStream</a></code>'s state. When constructing a <code class="idl"><a data-link-type="idl" href="#writablestream" id="ref-for-writablestream②⓪">WritableStream</a></code>, the <a data-link-type="dfn" href="#underlying-sink" id="ref-for-underlying-sink②③">underlying sink</a> is given a corresponding <code class="idl"><a data-link-type="idl" href="#writablestreamdefaultcontroller" id="ref-for-writablestreamdefaultcontroller⑥">WritableStreamDefaultController</a></code> instance to manipulate.</p> <h4 class="heading settled" data-level="5.4.1" id="ws-default-controller-class-definition"><span class="secno">5.4.1. </span><span class="content">Interface definition</span><a class="self-link" href="#ws-default-controller-class-definition"></a></h4> <p>The Web IDL definition for the <code class="idl"><a data-link-type="idl" href="#writablestreamdefaultcontroller" id="ref-for-writablestreamdefaultcontroller⑦">WritableStreamDefaultController</a></code> class is given as follows:</p> <pre class="idl highlight def">[Exposed=*] <c- b>interface</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="interface" data-export id="writablestreamdefaultcontroller"><code><c- g>WritableStreamDefaultController</c-></code></dfn> { <c- b>readonly</c-> <c- b>attribute</c-> <a data-link-type="idl-name" href="https://dom.spec.whatwg.org/#abortsignal" id="ref-for-abortsignal④"><c- n>AbortSignal</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="AbortSignal" href="#ws-default-controller-signal" id="ref-for-ws-default-controller-signal"><c- g>signal</c-></a>; <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined" id="ref-for-idl-undefined②⑦"><c- b>undefined</c-></a> <a class="idl-code" data-link-type="method" href="#ws-default-controller-error" id="ref-for-ws-default-controller-error"><c- g>error</c-></a>(<c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any" id="ref-for-idl-any①⑧"><c- b>any</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="WritableStreamDefaultController/error(e), WritableStreamDefaultController/error()" data-dfn-type="argument" data-export id="dom-writablestreamdefaultcontroller-error-e-e"><code><c- g>e</c-></code></dfn>); }; </pre> <h4 class="heading settled" data-level="5.4.2" id="ws-default-controller-internal-slots"><span class="secno">5.4.2. </span><span class="content">Internal slots</span><a class="self-link" href="#ws-default-controller-internal-slots"></a></h4> <p>Instances of <code class="idl"><a data-link-type="idl" href="#writablestreamdefaultcontroller" id="ref-for-writablestreamdefaultcontroller⑧">WritableStreamDefaultController</a></code> are created with the internal slots described in the following table:</p> <table> <thead> <tr> <th>Internal Slot <th>Description (<em>non-normative</em>) <tbody> <tr> <td><dfn class="dfn-paneled" data-dfn-for="WritableStreamDefaultController" data-dfn-type="dfn" data-noexport id="writablestreamdefaultcontroller-abortalgorithm">[[abortAlgorithm]]</dfn> <td class="non-normative">A promise-returning algorithm, taking one argument (the abort reason), which communicates a requested abort to the <a data-link-type="dfn" href="#underlying-sink" id="ref-for-underlying-sink②④">underlying sink</a> <tr> <td><dfn class="dfn-paneled" data-dfn-for="WritableStreamDefaultController" data-dfn-type="dfn" data-noexport id="writablestreamdefaultcontroller-abortcontroller">[[abortController]]</dfn> <td class="non-normative">An <code class="idl"><a data-link-type="idl" href="https://dom.spec.whatwg.org/#abortcontroller" id="ref-for-abortcontroller①">AbortController</a></code> that can be used to abort the pending write or close operation when the stream is <a data-link-type="dfn" href="#abort-a-writable-stream" id="ref-for-abort-a-writable-stream⑤">aborted</a>. <tr> <td><dfn class="dfn-paneled" data-dfn-for="WritableStreamDefaultController" data-dfn-type="dfn" data-noexport id="writablestreamdefaultcontroller-closealgorithm">[[closeAlgorithm]]</dfn> <td class="non-normative">A promise-returning algorithm which communicates a requested close to the <a data-link-type="dfn" href="#underlying-sink" id="ref-for-underlying-sink②⑤">underlying sink</a> <tr> <td><dfn class="dfn-paneled" data-dfn-for="WritableStreamDefaultController" data-dfn-type="dfn" data-noexport id="writablestreamdefaultcontroller-queue">[[queue]]</dfn> <td class="non-normative">A <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list" id="ref-for-list①⑦">list</a> representing the stream’s internal queue of <a data-link-type="dfn" href="#chunk" id="ref-for-chunk⑤⑨">chunks</a> <tr> <td><dfn class="dfn-paneled" data-dfn-for="WritableStreamDefaultController" data-dfn-type="dfn" data-noexport id="writablestreamdefaultcontroller-queuetotalsize">[[queueTotalSize]]</dfn> <td class="non-normative">The total size of all the chunks stored in <a data-link-type="dfn" href="#writablestreamdefaultcontroller-queue" id="ref-for-writablestreamdefaultcontroller-queue">[[queue]]</a> (see <a href="#queue-with-sizes">§ 8.1 Queue-with-sizes</a>) <tr> <td><dfn class="dfn-paneled" data-dfn-for="WritableStreamDefaultController" data-dfn-type="dfn" data-noexport id="writablestreamdefaultcontroller-started">[[started]]</dfn> <td class="non-normative">A boolean flag indicating whether the <a data-link-type="dfn" href="#underlying-sink" id="ref-for-underlying-sink②⑥">underlying sink</a> has finished starting <tr> <td><dfn class="dfn-paneled" data-dfn-for="WritableStreamDefaultController" data-dfn-type="dfn" data-noexport id="writablestreamdefaultcontroller-strategyhwm">[[strategyHWM]]</dfn> <td class="non-normative">A number supplied by the creator of the stream as part of the stream’s <a data-link-type="dfn" href="#queuing-strategy" id="ref-for-queuing-strategy⑤">queuing strategy</a>, indicating the point at which the stream will apply <a data-link-type="dfn" href="#backpressure" id="ref-for-backpressure①③">backpressure</a> to its <a data-link-type="dfn" href="#underlying-sink" id="ref-for-underlying-sink②⑦">underlying sink</a> <tr> <td><dfn class="dfn-paneled" data-dfn-for="WritableStreamDefaultController" data-dfn-type="dfn" data-noexport id="writablestreamdefaultcontroller-strategysizealgorithm">[[strategySizeAlgorithm]]</dfn> <td class="non-normative">An algorithm to calculate the size of enqueued <a data-link-type="dfn" href="#chunk" id="ref-for-chunk⑥⓪">chunks</a>, as part of the stream’s <a data-link-type="dfn" href="#queuing-strategy" id="ref-for-queuing-strategy⑥">queuing strategy</a> <tr> <td><dfn class="dfn-paneled" data-dfn-for="WritableStreamDefaultController" data-dfn-type="dfn" data-noexport id="writablestreamdefaultcontroller-stream">[[stream]]</dfn> <td class="non-normative">The <code class="idl"><a data-link-type="idl" href="#writablestream" id="ref-for-writablestream②①">WritableStream</a></code> instance controlled <tr> <td><dfn class="dfn-paneled" data-dfn-for="WritableStreamDefaultController" data-dfn-type="dfn" data-noexport id="writablestreamdefaultcontroller-writealgorithm">[[writeAlgorithm]]</dfn> <td class="non-normative">A promise-returning algorithm, taking one argument (the <a data-link-type="dfn" href="#chunk" id="ref-for-chunk⑥①">chunk</a> to write), which writes data to the <a data-link-type="dfn" href="#underlying-sink" id="ref-for-underlying-sink②⑧">underlying sink</a> </table> <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="close-sentinel">close sentinel</dfn> is a unique value enqueued into <a data-link-type="dfn" href="#writablestreamdefaultcontroller-queue" id="ref-for-writablestreamdefaultcontroller-queue①">[[queue]]</a>, in lieu of a <a data-link-type="dfn" href="#chunk" id="ref-for-chunk⑥②">chunk</a>, to signal that the stream is closed. It is only used internally, and is never exposed to web developers.</p> <h4 class="heading settled" data-level="5.4.3" id="ws-default-controller-prototype"><span class="secno">5.4.3. </span><span class="content">Methods and properties</span><a class="self-link" href="#ws-default-controller-prototype"></a></h4> <dl class="domintro non-normative"> <dt><code><var>controller</var>.<code class="idl"><a data-link-type="idl" href="#ws-default-controller-signal" id="ref-for-ws-default-controller-signal①">signal</a></code></code> <dd> <p>An AbortSignal that can be used to abort the pending write or close operation when the stream is <a data-link-type="dfn" href="#abort-a-writable-stream" id="ref-for-abort-a-writable-stream⑥">aborted</a>. </p> <dt><code><var>controller</var>.<code class="idl"><a data-link-type="idl" href="#ws-default-controller-error" id="ref-for-ws-default-controller-error①">error</a></code>(<var>e</var>)</code> <dd> <p>Closes the controlled writable stream, making all future interactions with it fail with the given error <var>e</var>. </p> <p>This method is rarely used, since usually it suffices to return a rejected promise from one of the <a data-link-type="dfn" href="#underlying-sink" id="ref-for-underlying-sink②⑨">underlying sink</a>'s methods. However, it can be useful for suddenly shutting down a stream in response to an event outside the normal lifecycle of interactions with the <a data-link-type="dfn" href="#underlying-sink" id="ref-for-underlying-sink③⓪">underlying sink</a>. </p> </dl> <div class="algorithm" data-algorithm="signal" data-algorithm-for="WritableStreamDefaultController"> The <dfn class="dfn-paneled idl-code" data-dfn-for="WritableStreamDefaultController" data-dfn-type="attribute" data-export id="ws-default-controller-signal"><code>signal</code></dfn> getter steps are: <ol> <li data-md> <p>Return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑨⑥">this</a>.<a data-link-type="dfn" href="#writablestreamdefaultcontroller-abortcontroller" id="ref-for-writablestreamdefaultcontroller-abortcontroller">[[abortController]]</a>'s <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#abortcontroller-signal" id="ref-for-abortcontroller-signal">signal</a>.</p> </ol> </div> <div class="algorithm" data-algorithm="error(e)" data-algorithm-for="WritableStreamDefaultController"> The <dfn class="dfn-paneled idl-code" data-dfn-for="WritableStreamDefaultController" data-dfn-type="method" data-export data-lt="error(e)|error()" id="ws-default-controller-error"><code>error(<var>e</var>)</code></dfn> method steps are: <ol> <li data-md> <p>Let <var>state</var> be <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑨⑦">this</a>.<a data-link-type="dfn" href="#writablestreamdefaultcontroller-stream" id="ref-for-writablestreamdefaultcontroller-stream">[[stream]]</a>.<a data-link-type="dfn" href="#writablestream-state" id="ref-for-writablestream-state⑤">[[state]]</a>.</p> <li data-md> <p>If <var>state</var> is not "<code>writable</code>", return.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#writable-stream-default-controller-error" id="ref-for-writable-stream-default-controller-error">WritableStreamDefaultControllerError</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑨⑧">this</a>, <var>e</var>).</p> </ol> </div> <h4 class="heading settled" data-level="5.4.4" id="ws-default-controller-internal-methods"><span class="secno">5.4.4. </span><span class="content">Internal methods</span><a class="self-link" href="#ws-default-controller-internal-methods"></a></h4> <p>The following are internal methods implemented by each <code class="idl"><a data-link-type="idl" href="#writablestreamdefaultcontroller" id="ref-for-writablestreamdefaultcontroller⑨">WritableStreamDefaultController</a></code> instance. The writable stream implementation will call into these.</p> <p class="note" role="note">The reason these are in method form, instead of as abstract operations, is to make it clear that the writable stream implementation is decoupled from the controller implementation, and could in the future be expanded with other controllers, as long as those controllers implemented such internal methods. A similar scenario is seen for readable streams (see <a href="#rs-abstract-ops-used-by-controllers">§ 4.9.2 Interfacing with controllers</a>), where there actually are multiple controller types and as such the counterpart internal methods are used polymorphically. </p> <div class="algorithm" data-algorithm="[[AbortSteps]]" data-algorithm-for="WritableStreamDefaultController"> <dfn class="dfn-paneled" data-dfn-for="WritableStreamDefaultController" data-dfn-type="abstract-op" data-export data-lt="[[AbortSteps]]" id="ws-default-controller-private-abort">[[AbortSteps]](<var>reason</var>)<span id="writable-stream-default-controller-abort"></span></dfn> implements the <a data-link-type="abstract-op" href="#abstract-opdef-writablestreamcontroller-abortsteps" id="ref-for-abstract-opdef-writablestreamcontroller-abortsteps">[[AbortSteps]]</a> contract. It performs the following steps: <ol> <li data-md> <p>Let <var>result</var> be the result of performing <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑨⑨">this</a>.<a data-link-type="dfn" href="#writablestreamdefaultcontroller-abortalgorithm" id="ref-for-writablestreamdefaultcontroller-abortalgorithm">[[abortAlgorithm]]</a>, passing <var>reason</var>.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#writable-stream-default-controller-clear-algorithms" id="ref-for-writable-stream-default-controller-clear-algorithms">WritableStreamDefaultControllerClearAlgorithms</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this①⓪⓪">this</a>).</p> <li data-md> <p>Return <var>result</var>.</p> </ol> </div> <div class="algorithm" data-algorithm="[[ErrorSteps]]" data-algorithm-for="WritableStreamDefaultController"> <dfn class="dfn-paneled" data-dfn-for="WritableStreamDefaultController" data-dfn-type="abstract-op" data-export data-lt="[[ErrorSteps]]" id="ws-default-controller-private-error">[[ErrorSteps]]()</dfn> implements the <a data-link-type="abstract-op" href="#abstract-opdef-writablestreamcontroller-errorsteps" id="ref-for-abstract-opdef-writablestreamcontroller-errorsteps">[[ErrorSteps]]</a> contract. It performs the following steps: <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#reset-queue" id="ref-for-reset-queue⑥">ResetQueue</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this①⓪①">this</a>).</p> </ol> </div> <h3 class="heading settled" data-level="5.5" id="ws-all-abstract-ops"><span class="secno">5.5. </span><span class="content">Abstract operations</span><a class="self-link" href="#ws-all-abstract-ops"></a></h3> <h4 class="heading settled" data-level="5.5.1" id="ws-abstract-ops"><span class="secno">5.5.1. </span><span class="content">Working with writable streams</span><a class="self-link" href="#ws-abstract-ops"></a></h4> <p>The following abstract operations operate on <code class="idl"><a data-link-type="idl" href="#writablestream" id="ref-for-writablestream②②">WritableStream</a></code> instances at a higher level.</p> <div class="algorithm" data-algorithm="AcquireWritableStreamDefaultWriter"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="AcquireWritableStreamDefaultWriter" id="acquire-writable-stream-default-writer">AcquireWritableStreamDefaultWriter(<var>stream</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>writer</var> be a <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#new" id="ref-for-new①⑤">new</a> <code class="idl"><a data-link-type="idl" href="#writablestreamdefaultwriter" id="ref-for-writablestreamdefaultwriter⑨">WritableStreamDefaultWriter</a></code>.</p> <li data-md> <p>Perform ? <a data-link-type="abstract-op" href="#set-up-writable-stream-default-writer" id="ref-for-set-up-writable-stream-default-writer①">SetUpWritableStreamDefaultWriter</a>(<var>writer</var>, <var>stream</var>).</p> <li data-md> <p>Return <var>writer</var>.</p> </ol> </div> <div class="algorithm" data-algorithm="CreateWritableStream"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="CreateWritableStream" id="create-writable-stream">CreateWritableStream(<var>startAlgorithm</var>, <var>writeAlgorithm</var>, <var>closeAlgorithm</var>, <var>abortAlgorithm</var>, <var>highWaterMark</var>, <var>sizeAlgorithm</var>)</dfn> performs the following steps: <ol> <li data-md> <p class="assertion">Assert: ! <a data-link-type="abstract-op" href="#is-non-negative-number" id="ref-for-is-non-negative-number①">IsNonNegativeNumber</a>(<var>highWaterMark</var>) is true.</p> <li data-md> <p>Let <var>stream</var> be a <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#new" id="ref-for-new①⑥">new</a> <code class="idl"><a data-link-type="idl" href="#writablestream" id="ref-for-writablestream②③">WritableStream</a></code>.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#initialize-writable-stream" id="ref-for-initialize-writable-stream①">InitializeWritableStream</a>(<var>stream</var>).</p> <li data-md> <p>Let <var>controller</var> be a <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#new" id="ref-for-new①⑦">new</a> <code class="idl"><a data-link-type="idl" href="#writablestreamdefaultcontroller" id="ref-for-writablestreamdefaultcontroller①⓪">WritableStreamDefaultController</a></code>.</p> <li data-md> <p>Perform ? <a data-link-type="abstract-op" href="#set-up-writable-stream-default-controller" id="ref-for-set-up-writable-stream-default-controller">SetUpWritableStreamDefaultController</a>(<var>stream</var>, <var>controller</var>, <var>startAlgorithm</var>, <var>writeAlgorithm</var>, <var>closeAlgorithm</var>, <var>abortAlgorithm</var>, <var>highWaterMark</var>, <var>sizeAlgorithm</var>).</p> <li data-md> <p>Return <var>stream</var>.</p> </ol> <p class="note" role="note">This abstract operation will throw an exception if and only if the supplied <var>startAlgorithm</var> throws. </p> </div> <div class="algorithm" data-algorithm="InitializeWritableStream"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="InitializeWritableStream" id="initialize-writable-stream">InitializeWritableStream(<var>stream</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Set <var>stream</var>.<a data-link-type="dfn" href="#writablestream-state" id="ref-for-writablestream-state⑥">[[state]]</a> to "<code>writable</code>".</p> <li data-md> <p>Set <var>stream</var>.<a data-link-type="dfn" href="#writablestream-storederror" id="ref-for-writablestream-storederror③">[[storedError]]</a>, <var>stream</var>.<a data-link-type="dfn" href="#writablestream-writer" id="ref-for-writablestream-writer①">[[writer]]</a>, <var>stream</var>.<a data-link-type="dfn" href="#writablestream-controller" id="ref-for-writablestream-controller">[[controller]]</a>, <var>stream</var>.<a data-link-type="dfn" href="#writablestream-inflightwriterequest" id="ref-for-writablestream-inflightwriterequest①">[[inFlightWriteRequest]]</a>, <var>stream</var>.<a data-link-type="dfn" href="#writablestream-closerequest" id="ref-for-writablestream-closerequest①">[[closeRequest]]</a>, <var>stream</var>.<a data-link-type="dfn" href="#writablestream-inflightcloserequest" id="ref-for-writablestream-inflightcloserequest①">[[inFlightCloseRequest]]</a>, and <var>stream</var>.<a data-link-type="dfn" href="#writablestream-pendingabortrequest" id="ref-for-writablestream-pendingabortrequest">[[pendingAbortRequest]]</a> to undefined.</p> <li data-md> <p>Set <var>stream</var>.<a data-link-type="dfn" href="#writablestream-writerequests" id="ref-for-writablestream-writerequests①">[[writeRequests]]</a> to a new empty <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list" id="ref-for-list①⑧">list</a>.</p> <li data-md> <p>Set <var>stream</var>.<a data-link-type="dfn" href="#writablestream-backpressure" id="ref-for-writablestream-backpressure">[[backpressure]]</a> to false.</p> </ol> </div> <div class="algorithm" data-algorithm="IsWritableStreamLocked"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="IsWritableStreamLocked" id="is-writable-stream-locked">IsWritableStreamLocked(<var>stream</var>)</dfn> performs the following steps: <ol> <li data-md> <p>If <var>stream</var>.<a data-link-type="dfn" href="#writablestream-writer" id="ref-for-writablestream-writer②">[[writer]]</a> is undefined, return false.</p> <li data-md> <p>Return true.</p> </ol> </div> <div class="algorithm" data-algorithm="SetUpWritableStreamDefaultWriter"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="SetUpWritableStreamDefaultWriter" id="set-up-writable-stream-default-writer">SetUpWritableStreamDefaultWriter(<var>writer</var>, <var>stream</var>)</dfn> performs the following steps: <ol> <li data-md> <p>If ! <a data-link-type="abstract-op" href="#is-writable-stream-locked" id="ref-for-is-writable-stream-locked⑦">IsWritableStreamLocked</a>(<var>stream</var>) is true, throw a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror⑤⑧">TypeError</a></code> exception.</p> <li data-md> <p>Set <var>writer</var>.<a data-link-type="dfn" href="#writablestreamdefaultwriter-stream" id="ref-for-writablestreamdefaultwriter-stream⑤">[[stream]]</a> to <var>stream</var>.</p> <li data-md> <p>Set <var>stream</var>.<a data-link-type="dfn" href="#writablestream-writer" id="ref-for-writablestream-writer③">[[writer]]</a> to <var>writer</var>.</p> <li data-md> <p>Let <var>state</var> be <var>stream</var>.<a data-link-type="dfn" href="#writablestream-state" id="ref-for-writablestream-state⑦">[[state]]</a>.</p> <li data-md> <p>If <var>state</var> is "<code>writable</code>",</p> <ol> <li data-md> <p>If ! <a data-link-type="abstract-op" href="#writable-stream-close-queued-or-in-flight" id="ref-for-writable-stream-close-queued-or-in-flight⑤">WritableStreamCloseQueuedOrInFlight</a>(<var>stream</var>) is false and <var>stream</var>.<a data-link-type="dfn" href="#writablestream-backpressure" id="ref-for-writablestream-backpressure①">[[backpressure]]</a> is true, set <var>writer</var>.<a data-link-type="dfn" href="#writablestreamdefaultwriter-readypromise" id="ref-for-writablestreamdefaultwriter-readypromise①">[[readyPromise]]</a> to <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-new-promise" id="ref-for-a-new-promise⑦">a new promise</a>.</p> <li data-md> <p>Otherwise, set <var>writer</var>.<a data-link-type="dfn" href="#writablestreamdefaultwriter-readypromise" id="ref-for-writablestreamdefaultwriter-readypromise②">[[readyPromise]]</a> to <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-resolved-with" id="ref-for-a-promise-resolved-with②⓪">a promise resolved with</a> undefined.</p> <li data-md> <p>Set <var>writer</var>.<a data-link-type="dfn" href="#writablestreamdefaultwriter-closedpromise" id="ref-for-writablestreamdefaultwriter-closedpromise①">[[closedPromise]]</a> to <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-new-promise" id="ref-for-a-new-promise⑧">a new promise</a>.</p> </ol> <li data-md> <p>Otherwise, if <var>state</var> is "<code>erroring</code>",</p> <ol> <li data-md> <p>Set <var>writer</var>.<a data-link-type="dfn" href="#writablestreamdefaultwriter-readypromise" id="ref-for-writablestreamdefaultwriter-readypromise③">[[readyPromise]]</a> to <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-rejected-with" id="ref-for-a-promise-rejected-with②⑤">a promise rejected with</a> <var>stream</var>.<a data-link-type="dfn" href="#writablestream-storederror" id="ref-for-writablestream-storederror④">[[storedError]]</a>.</p> <li data-md> <p>Set <var>writer</var>.<a data-link-type="dfn" href="#writablestreamdefaultwriter-readypromise" id="ref-for-writablestreamdefaultwriter-readypromise④">[[readyPromise]]</a>.[[PromiseIsHandled]] to true.</p> <li data-md> <p>Set <var>writer</var>.<a data-link-type="dfn" href="#writablestreamdefaultwriter-closedpromise" id="ref-for-writablestreamdefaultwriter-closedpromise②">[[closedPromise]]</a> to <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-new-promise" id="ref-for-a-new-promise⑨">a new promise</a>.</p> </ol> <li data-md> <p>Otherwise, if <var>state</var> is "<code>closed</code>",</p> <ol> <li data-md> <p>Set <var>writer</var>.<a data-link-type="dfn" href="#writablestreamdefaultwriter-readypromise" id="ref-for-writablestreamdefaultwriter-readypromise⑤">[[readyPromise]]</a> to <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-resolved-with" id="ref-for-a-promise-resolved-with②①">a promise resolved with</a> undefined.</p> <li data-md> <p>Set <var>writer</var>.<a data-link-type="dfn" href="#writablestreamdefaultwriter-closedpromise" id="ref-for-writablestreamdefaultwriter-closedpromise③">[[closedPromise]]</a> to <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-resolved-with" id="ref-for-a-promise-resolved-with②②">a promise resolved with</a> undefined.</p> </ol> <li data-md> <p>Otherwise,</p> <ol> <li data-md> <p class="assertion">Assert: <var>state</var> is "<code>errored</code>".</p> <li data-md> <p>Let <var>storedError</var> be <var>stream</var>.<a data-link-type="dfn" href="#writablestream-storederror" id="ref-for-writablestream-storederror⑤">[[storedError]]</a>.</p> <li data-md> <p>Set <var>writer</var>.<a data-link-type="dfn" href="#writablestreamdefaultwriter-readypromise" id="ref-for-writablestreamdefaultwriter-readypromise⑥">[[readyPromise]]</a> to <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-rejected-with" id="ref-for-a-promise-rejected-with②⑥">a promise rejected with</a> <var>storedError</var>.</p> <li data-md> <p>Set <var>writer</var>.<a data-link-type="dfn" href="#writablestreamdefaultwriter-readypromise" id="ref-for-writablestreamdefaultwriter-readypromise⑦">[[readyPromise]]</a>.[[PromiseIsHandled]] to true.</p> <li data-md> <p>Set <var>writer</var>.<a data-link-type="dfn" href="#writablestreamdefaultwriter-closedpromise" id="ref-for-writablestreamdefaultwriter-closedpromise④">[[closedPromise]]</a> to <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-rejected-with" id="ref-for-a-promise-rejected-with②⑦">a promise rejected with</a> <var>storedError</var>.</p> <li data-md> <p>Set <var>writer</var>.<a data-link-type="dfn" href="#writablestreamdefaultwriter-closedpromise" id="ref-for-writablestreamdefaultwriter-closedpromise⑤">[[closedPromise]]</a>.[[PromiseIsHandled]] to true.</p> </ol> </ol> </div> <div class="algorithm" data-algorithm="WritableStreamAbort"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="WritableStreamAbort" id="writable-stream-abort">WritableStreamAbort(<var>stream</var>, <var>reason</var>)</dfn> performs the following steps: <ol> <li data-md> <p>If <var>stream</var>.<a data-link-type="dfn" href="#writablestream-state" id="ref-for-writablestream-state⑧">[[state]]</a> is "<code>closed</code>" or "<code>errored</code>", return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-resolved-with" id="ref-for-a-promise-resolved-with②③">a promise resolved with</a> undefined.</p> <li data-md> <p><a data-link-type="dfn" href="https://dom.spec.whatwg.org/#abortcontroller-signal-abort" id="ref-for-abortcontroller-signal-abort">Signal abort</a> on <var>stream</var>.<a data-link-type="dfn" href="#writablestream-controller" id="ref-for-writablestream-controller①">[[controller]]</a>.<a data-link-type="dfn" href="#writablestreamdefaultcontroller-abortcontroller" id="ref-for-writablestreamdefaultcontroller-abortcontroller①">[[abortController]]</a> with <var>reason</var>.</p> <li data-md> <p>Let <var>state</var> be <var>stream</var>.<a data-link-type="dfn" href="#writablestream-state" id="ref-for-writablestream-state⑨">[[state]]</a>.</p> <li data-md> <p>If <var>state</var> is "<code>closed</code>" or "<code>errored</code>", return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-resolved-with" id="ref-for-a-promise-resolved-with②④">a promise resolved with</a> undefined.</p> <p class="note" role="note">We re-check the state because <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#abortcontroller-signal-abort" id="ref-for-abortcontroller-signal-abort①">signaling abort</a> runs author code and that might have changed the state. </p> <li data-md> <p>If <var>stream</var>.<a data-link-type="dfn" href="#writablestream-pendingabortrequest" id="ref-for-writablestream-pendingabortrequest①">[[pendingAbortRequest]]</a> is not undefined, return <var>stream</var>.<a data-link-type="dfn" href="#writablestream-pendingabortrequest" id="ref-for-writablestream-pendingabortrequest②">[[pendingAbortRequest]]</a>'s <a data-link-type="dfn" href="#pending-abort-request-promise" id="ref-for-pending-abort-request-promise">promise</a>.</p> <li data-md> <p class="assertion">Assert: <var>state</var> is "<code>writable</code>" or "<code>erroring</code>".</p> <li data-md> <p>Let <var>wasAlreadyErroring</var> be false.</p> <li data-md> <p>If <var>state</var> is "<code>erroring</code>",</p> <ol> <li data-md> <p>Set <var>wasAlreadyErroring</var> to true.</p> <li data-md> <p>Set <var>reason</var> to undefined.</p> </ol> <li data-md> <p>Let <var>promise</var> be <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-new-promise" id="ref-for-a-new-promise①⓪">a new promise</a>.</p> <li data-md> <p>Set <var>stream</var>.<a data-link-type="dfn" href="#writablestream-pendingabortrequest" id="ref-for-writablestream-pendingabortrequest③">[[pendingAbortRequest]]</a> to a new <a data-link-type="dfn" href="#pending-abort-request" id="ref-for-pending-abort-request①">pending abort request</a> whose <a data-link-type="dfn" href="#pending-abort-request-promise" id="ref-for-pending-abort-request-promise①">promise</a> is <var>promise</var>, <a data-link-type="dfn" href="#pending-abort-request-reason" id="ref-for-pending-abort-request-reason">reason</a> is <var>reason</var>, and <a data-link-type="dfn" href="#pending-abort-request-was-already-erroring" id="ref-for-pending-abort-request-was-already-erroring">was already erroring</a> is <var>wasAlreadyErroring</var>.</p> <li data-md> <p>If <var>wasAlreadyErroring</var> is false, perform ! <a data-link-type="abstract-op" href="#writable-stream-start-erroring" id="ref-for-writable-stream-start-erroring">WritableStreamStartErroring</a>(<var>stream</var>, <var>reason</var>).</p> <li data-md> <p>Return <var>promise</var>.</p> </ol> </div> <div class="algorithm" data-algorithm="WritableStreamClose"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="WritableStreamClose" id="writable-stream-close">WritableStreamClose(<var>stream</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>state</var> be <var>stream</var>.<a data-link-type="dfn" href="#writablestream-state" id="ref-for-writablestream-state①⓪">[[state]]</a>.</p> <li data-md> <p>If <var>state</var> is "<code>closed</code>" or "<code>errored</code>", return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-rejected-with" id="ref-for-a-promise-rejected-with②⑧">a promise rejected with</a> a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror⑤⑨">TypeError</a></code> exception.</p> <li data-md> <p class="assertion">Assert: <var>state</var> is "<code>writable</code>" or "<code>erroring</code>".</p> <li data-md> <p class="assertion">Assert: ! <a data-link-type="abstract-op" href="#writable-stream-close-queued-or-in-flight" id="ref-for-writable-stream-close-queued-or-in-flight⑥">WritableStreamCloseQueuedOrInFlight</a>(<var>stream</var>) is false.</p> <li data-md> <p>Let <var>promise</var> be <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-new-promise" id="ref-for-a-new-promise①①">a new promise</a>.</p> <li data-md> <p>Set <var>stream</var>.<a data-link-type="dfn" href="#writablestream-closerequest" id="ref-for-writablestream-closerequest②">[[closeRequest]]</a> to <var>promise</var>.</p> <li data-md> <p>Let <var>writer</var> be <var>stream</var>.<a data-link-type="dfn" href="#writablestream-writer" id="ref-for-writablestream-writer④">[[writer]]</a>.</p> <li data-md> <p>If <var>writer</var> is not undefined, and <var>stream</var>.<a data-link-type="dfn" href="#writablestream-backpressure" id="ref-for-writablestream-backpressure②">[[backpressure]]</a> is true, and <var>state</var> is "<code>writable</code>", <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#resolve" id="ref-for-resolve②⓪">resolve</a> <var>writer</var>.<a data-link-type="dfn" href="#writablestreamdefaultwriter-readypromise" id="ref-for-writablestreamdefaultwriter-readypromise⑧">[[readyPromise]]</a> with undefined.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#writable-stream-default-controller-close" id="ref-for-writable-stream-default-controller-close">WritableStreamDefaultControllerClose</a>(<var>stream</var>.<a data-link-type="dfn" href="#writablestream-controller" id="ref-for-writablestream-controller②">[[controller]]</a>).</p> <li data-md> <p>Return <var>promise</var>.</p> </ol> </div> <h4 class="heading settled" data-level="5.5.2" id="ws-abstract-ops-used-by-controllers"><span class="secno">5.5.2. </span><span class="content">Interfacing with controllers</span><a class="self-link" href="#ws-abstract-ops-used-by-controllers"></a></h4> <p>To allow future flexibility to add different writable stream behaviors (similar to the distinction between default readable streams and <a data-link-type="dfn" href="#readable-byte-stream" id="ref-for-readable-byte-stream①④">readable byte streams</a>), much of the internal state of a <a data-link-type="dfn" href="#writable-stream" id="ref-for-writable-stream⑦">writable stream</a> is encapsulated by the <code class="idl"><a data-link-type="idl" href="#writablestreamdefaultcontroller" id="ref-for-writablestreamdefaultcontroller①①">WritableStreamDefaultController</a></code> class.</p> <p>Each controller class defines two internal methods, which are called by the <code class="idl"><a data-link-type="idl" href="#writablestream" id="ref-for-writablestream②④">WritableStream</a></code> algorithms:</p> <dl> <dt><dfn class="dfn-paneled" data-dfn-for="WritableStreamController" data-dfn-type="abstract-op" data-export data-lt="[[AbortSteps]]" id="abstract-opdef-writablestreamcontroller-abortsteps">[[AbortSteps]](<var>reason</var>)</dfn> <dd>The controller’s steps that run in reaction to the stream being <a data-link-type="dfn" href="#abort-a-writable-stream" id="ref-for-abort-a-writable-stream⑦">aborted</a>, used to clean up the state stored in the controller and inform the <a data-link-type="dfn" href="#underlying-sink" id="ref-for-underlying-sink③①">underlying sink</a>. <dt><dfn class="dfn-paneled" data-dfn-for="WritableStreamController" data-dfn-type="abstract-op" data-export data-lt="[[ErrorSteps]]" id="abstract-opdef-writablestreamcontroller-errorsteps">[[ErrorSteps]]()</dfn> <dd>The controller’s steps that run in reaction to the stream being errored, used to clean up the state stored in the controller. </dl> <p>(These are defined as internal methods, instead of as abstract operations, so that they can be called polymorphically by the <code class="idl"><a data-link-type="idl" href="#writablestream" id="ref-for-writablestream②⑤">WritableStream</a></code> algorithms, without having to branch on which type of controller is present. This is a bit theoretical for now, given that only <code class="idl"><a data-link-type="idl" href="#writablestreamdefaultcontroller" id="ref-for-writablestreamdefaultcontroller①②">WritableStreamDefaultController</a></code> exists so far.)</p> <p>The rest of this section concerns abstract operations that go in the other direction: they are used by the controller implementation to affect its associated <code class="idl"><a data-link-type="idl" href="#writablestream" id="ref-for-writablestream②⑥">WritableStream</a></code> object. This translates internal state changes of the controllerinto developer-facing results visible through the <code class="idl"><a data-link-type="idl" href="#writablestream" id="ref-for-writablestream②⑦">WritableStream</a></code>'s public API.</p> <div class="algorithm" data-algorithm="WritableStreamAddWriteRequest"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="WritableStreamAddWriteRequest" id="writable-stream-add-write-request">WritableStreamAddWriteRequest(<var>stream</var>)</dfn> performs the following steps: <ol> <li data-md> <p class="assertion">Assert: ! <a data-link-type="abstract-op" href="#is-writable-stream-locked" id="ref-for-is-writable-stream-locked⑧">IsWritableStreamLocked</a>(<var>stream</var>) is true.</p> <li data-md> <p class="assertion">Assert: <var>stream</var>.<a data-link-type="dfn" href="#writablestream-state" id="ref-for-writablestream-state①①">[[state]]</a> is "<code>writable</code>".</p> <li data-md> <p>Let <var>promise</var> be <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-new-promise" id="ref-for-a-new-promise①②">a new promise</a>.</p> <li data-md> <p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-append" id="ref-for-list-append⑧">Append</a> <var>promise</var> to <var>stream</var>.<a data-link-type="dfn" href="#writablestream-writerequests" id="ref-for-writablestream-writerequests②">[[writeRequests]]</a>.</p> <li data-md> <p>Return <var>promise</var>.</p> </ol> </div> <div class="algorithm" data-algorithm="WritableStreamCloseQueuedOrInFlight"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="WritableStreamCloseQueuedOrInFlight" id="writable-stream-close-queued-or-in-flight">WritableStreamCloseQueuedOrInFlight(<var>stream</var>)</dfn> performs the following steps: <ol> <li data-md> <p>If <var>stream</var>.<a data-link-type="dfn" href="#writablestream-closerequest" id="ref-for-writablestream-closerequest③">[[closeRequest]]</a> is undefined and <var>stream</var>.<a data-link-type="dfn" href="#writablestream-inflightcloserequest" id="ref-for-writablestream-inflightcloserequest②">[[inFlightCloseRequest]]</a> is undefined, return false.</p> <li data-md> <p>Return true.</p> </ol> </div> <div class="algorithm" data-algorithm="WritableStreamDealWithRejection"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="WritableStreamDealWithRejection" id="writable-stream-deal-with-rejection">WritableStreamDealWithRejection(<var>stream</var>, <var>error</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>state</var> be <var>stream</var>.<a data-link-type="dfn" href="#writablestream-state" id="ref-for-writablestream-state①②">[[state]]</a>.</p> <li data-md> <p>If <var>state</var> is "<code>writable</code>",</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#writable-stream-start-erroring" id="ref-for-writable-stream-start-erroring①">WritableStreamStartErroring</a>(<var>stream</var>, <var>error</var>).</p> <li data-md> <p>Return.</p> </ol> <li data-md> <p class="assertion">Assert: <var>state</var> is "<code>erroring</code>".</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#writable-stream-finish-erroring" id="ref-for-writable-stream-finish-erroring">WritableStreamFinishErroring</a>(<var>stream</var>).</p> </ol> </div> <div class="algorithm" data-algorithm="WritableStreamFinishErroring"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="WritableStreamFinishErroring" id="writable-stream-finish-erroring">WritableStreamFinishErroring(<var>stream</var>)</dfn> performs the following steps: <ol> <li data-md> <p class="assertion">Assert: <var>stream</var>.<a data-link-type="dfn" href="#writablestream-state" id="ref-for-writablestream-state①③">[[state]]</a> is "<code>erroring</code>".</p> <li data-md> <p class="assertion">Assert: ! <a data-link-type="abstract-op" href="#writable-stream-has-operation-marked-in-flight" id="ref-for-writable-stream-has-operation-marked-in-flight">WritableStreamHasOperationMarkedInFlight</a>(<var>stream</var>) is false.</p> <li data-md> <p>Set <var>stream</var>.<a data-link-type="dfn" href="#writablestream-state" id="ref-for-writablestream-state①④">[[state]]</a> to "<code>errored</code>".</p> <li data-md> <p>Perform ! <var>stream</var>.<a data-link-type="dfn" href="#writablestream-controller" id="ref-for-writablestream-controller③">[[controller]]</a>.<a data-link-type="abstract-op" href="#abstract-opdef-writablestreamcontroller-errorsteps" id="ref-for-abstract-opdef-writablestreamcontroller-errorsteps①">[[ErrorSteps]]</a>().</p> <li data-md> <p>Let <var>storedError</var> be <var>stream</var>.<a data-link-type="dfn" href="#writablestream-storederror" id="ref-for-writablestream-storederror⑥">[[storedError]]</a>.</p> <li data-md> <p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-iterate" id="ref-for-list-iterate⑧">For each</a> <var>writeRequest</var> of <var>stream</var>.<a data-link-type="dfn" href="#writablestream-writerequests" id="ref-for-writablestream-writerequests③">[[writeRequests]]</a>:</p> <ol> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#reject" id="ref-for-reject⑥">Reject</a> <var>writeRequest</var> with <var>storedError</var>.</p> </ol> <li data-md> <p>Set <var>stream</var>.<a data-link-type="dfn" href="#writablestream-writerequests" id="ref-for-writablestream-writerequests④">[[writeRequests]]</a> to an empty <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list" id="ref-for-list①⑨">list</a>.</p> <li data-md> <p>If <var>stream</var>.<a data-link-type="dfn" href="#writablestream-pendingabortrequest" id="ref-for-writablestream-pendingabortrequest④">[[pendingAbortRequest]]</a> is undefined,</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#writable-stream-reject-close-and-closed-promise-if-needed" id="ref-for-writable-stream-reject-close-and-closed-promise-if-needed">WritableStreamRejectCloseAndClosedPromiseIfNeeded</a>(<var>stream</var>).</p> <li data-md> <p>Return.</p> </ol> <li data-md> <p>Let <var>abortRequest</var> be <var>stream</var>.<a data-link-type="dfn" href="#writablestream-pendingabortrequest" id="ref-for-writablestream-pendingabortrequest⑤">[[pendingAbortRequest]]</a>.</p> <li data-md> <p>Set <var>stream</var>.<a data-link-type="dfn" href="#writablestream-pendingabortrequest" id="ref-for-writablestream-pendingabortrequest⑥">[[pendingAbortRequest]]</a> to undefined.</p> <li data-md> <p>If <var>abortRequest</var>’s <a data-link-type="dfn" href="#pending-abort-request-was-already-erroring" id="ref-for-pending-abort-request-was-already-erroring①">was already erroring</a> is true,</p> <ol> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#reject" id="ref-for-reject⑦">Reject</a> <var>abortRequest</var>’s <a data-link-type="dfn" href="#pending-abort-request-promise" id="ref-for-pending-abort-request-promise②">promise</a> with <var>storedError</var>.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#writable-stream-reject-close-and-closed-promise-if-needed" id="ref-for-writable-stream-reject-close-and-closed-promise-if-needed①">WritableStreamRejectCloseAndClosedPromiseIfNeeded</a>(<var>stream</var>).</p> <li data-md> <p>Return.</p> </ol> <li data-md> <p>Let <var>promise</var> be ! <var>stream</var>.<a data-link-type="dfn" href="#writablestream-controller" id="ref-for-writablestream-controller④">[[controller]]</a>.<a data-link-type="abstract-op" href="#abstract-opdef-writablestreamcontroller-abortsteps" id="ref-for-abstract-opdef-writablestreamcontroller-abortsteps①">[[AbortSteps]]</a>(<var>abortRequest</var>’s <a data-link-type="dfn" href="#pending-abort-request-reason" id="ref-for-pending-abort-request-reason①">reason</a>).</p> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#upon-fulfillment" id="ref-for-upon-fulfillment⑤">Upon fulfillment</a> of <var>promise</var>,</p> <ol> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#resolve" id="ref-for-resolve②①">Resolve</a> <var>abortRequest</var>’s <a data-link-type="dfn" href="#pending-abort-request-promise" id="ref-for-pending-abort-request-promise③">promise</a> with undefined.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#writable-stream-reject-close-and-closed-promise-if-needed" id="ref-for-writable-stream-reject-close-and-closed-promise-if-needed②">WritableStreamRejectCloseAndClosedPromiseIfNeeded</a>(<var>stream</var>).</p> </ol> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#upon-rejection" id="ref-for-upon-rejection⑦">Upon rejection</a> of <var>promise</var> with reason <var>reason</var>,</p> <ol> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#reject" id="ref-for-reject⑧">Reject</a> <var>abortRequest</var>’s <a data-link-type="dfn" href="#pending-abort-request-promise" id="ref-for-pending-abort-request-promise④">promise</a> with <var>reason</var>.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#writable-stream-reject-close-and-closed-promise-if-needed" id="ref-for-writable-stream-reject-close-and-closed-promise-if-needed③">WritableStreamRejectCloseAndClosedPromiseIfNeeded</a>(<var>stream</var>).</p> </ol> </ol> </div> <div class="algorithm" data-algorithm="WritableStreamFinishInFlightClose"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="WritableStreamFinishInFlightClose" id="writable-stream-finish-in-flight-close">WritableStreamFinishInFlightClose(<var>stream</var>)</dfn> performs the following steps: <ol> <li data-md> <p class="assertion">Assert: <var>stream</var>.<a data-link-type="dfn" href="#writablestream-inflightcloserequest" id="ref-for-writablestream-inflightcloserequest③">[[inFlightCloseRequest]]</a> is not undefined.</p> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#resolve" id="ref-for-resolve②②">Resolve</a> <var>stream</var>.<a data-link-type="dfn" href="#writablestream-inflightcloserequest" id="ref-for-writablestream-inflightcloserequest④">[[inFlightCloseRequest]]</a> with undefined.</p> <li data-md> <p>Set <var>stream</var>.<a data-link-type="dfn" href="#writablestream-inflightcloserequest" id="ref-for-writablestream-inflightcloserequest⑤">[[inFlightCloseRequest]]</a> to undefined.</p> <li data-md> <p>Let <var>state</var> be <var>stream</var>.<a data-link-type="dfn" href="#writablestream-state" id="ref-for-writablestream-state①⑤">[[state]]</a>.</p> <li data-md> <p class="assertion">Assert: <var>stream</var>.<a data-link-type="dfn" href="#writablestream-state" id="ref-for-writablestream-state①⑥">[[state]]</a> is "<code>writable</code>" or "<code>erroring</code>".</p> <li data-md> <p>If <var>state</var> is "<code>erroring</code>",</p> <ol> <li data-md> <p>Set <var>stream</var>.<a data-link-type="dfn" href="#writablestream-storederror" id="ref-for-writablestream-storederror⑦">[[storedError]]</a> to undefined.</p> <li data-md> <p>If <var>stream</var>.<a data-link-type="dfn" href="#writablestream-pendingabortrequest" id="ref-for-writablestream-pendingabortrequest⑦">[[pendingAbortRequest]]</a> is not undefined,</p> <ol> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#resolve" id="ref-for-resolve②③">Resolve</a> <var>stream</var>.<a data-link-type="dfn" href="#writablestream-pendingabortrequest" id="ref-for-writablestream-pendingabortrequest⑧">[[pendingAbortRequest]]</a>'s <a data-link-type="dfn" href="#pending-abort-request-promise" id="ref-for-pending-abort-request-promise⑤">promise</a> with undefined.</p> <li data-md> <p>Set <var>stream</var>.<a data-link-type="dfn" href="#writablestream-pendingabortrequest" id="ref-for-writablestream-pendingabortrequest⑨">[[pendingAbortRequest]]</a> to undefined.</p> </ol> </ol> <li data-md> <p>Set <var>stream</var>.<a data-link-type="dfn" href="#writablestream-state" id="ref-for-writablestream-state①⑦">[[state]]</a> to "<code>closed</code>".</p> <li data-md> <p>Let <var>writer</var> be <var>stream</var>.<a data-link-type="dfn" href="#writablestream-writer" id="ref-for-writablestream-writer⑤">[[writer]]</a>.</p> <li data-md> <p>If <var>writer</var> is not undefined, <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#resolve" id="ref-for-resolve②④">resolve</a> <var>writer</var>.<a data-link-type="dfn" href="#writablestreamdefaultwriter-closedpromise" id="ref-for-writablestreamdefaultwriter-closedpromise⑥">[[closedPromise]]</a> with undefined.</p> <li data-md> <p class="assertion">Assert: <var>stream</var>.<a data-link-type="dfn" href="#writablestream-pendingabortrequest" id="ref-for-writablestream-pendingabortrequest①⓪">[[pendingAbortRequest]]</a> is undefined.</p> <li data-md> <p class="assertion">Assert: <var>stream</var>.<a data-link-type="dfn" href="#writablestream-storederror" id="ref-for-writablestream-storederror⑧">[[storedError]]</a> is undefined.</p> </ol> </div> <div class="algorithm" data-algorithm="WritableStreamFinishInFlightCloseWithError"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="WritableStreamFinishInFlightCloseWithError" id="writable-stream-finish-in-flight-close-with-error">WritableStreamFinishInFlightCloseWithError(<var>stream</var>, <var>error</var>)</dfn> performs the following steps: <ol> <li data-md> <p class="assertion">Assert: <var>stream</var>.<a data-link-type="dfn" href="#writablestream-inflightcloserequest" id="ref-for-writablestream-inflightcloserequest⑥">[[inFlightCloseRequest]]</a> is not undefined.</p> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#reject" id="ref-for-reject⑨">Reject</a> <var>stream</var>.<a data-link-type="dfn" href="#writablestream-inflightcloserequest" id="ref-for-writablestream-inflightcloserequest⑦">[[inFlightCloseRequest]]</a> with <var>error</var>.</p> <li data-md> <p>Set <var>stream</var>.<a data-link-type="dfn" href="#writablestream-inflightcloserequest" id="ref-for-writablestream-inflightcloserequest⑧">[[inFlightCloseRequest]]</a> to undefined.</p> <li data-md> <p class="assertion">Assert: <var>stream</var>.<a data-link-type="dfn" href="#writablestream-state" id="ref-for-writablestream-state①⑧">[[state]]</a> is "<code>writable</code>" or "<code>erroring</code>".</p> <li data-md> <p>If <var>stream</var>.<a data-link-type="dfn" href="#writablestream-pendingabortrequest" id="ref-for-writablestream-pendingabortrequest①①">[[pendingAbortRequest]]</a> is not undefined,</p> <ol> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#reject" id="ref-for-reject①⓪">Reject</a> <var>stream</var>.<a data-link-type="dfn" href="#writablestream-pendingabortrequest" id="ref-for-writablestream-pendingabortrequest①②">[[pendingAbortRequest]]</a>'s <a data-link-type="dfn" href="#pending-abort-request-promise" id="ref-for-pending-abort-request-promise⑥">promise</a> with <var>error</var>.</p> <li data-md> <p>Set <var>stream</var>.<a data-link-type="dfn" href="#writablestream-pendingabortrequest" id="ref-for-writablestream-pendingabortrequest①③">[[pendingAbortRequest]]</a> to undefined.</p> </ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#writable-stream-deal-with-rejection" id="ref-for-writable-stream-deal-with-rejection">WritableStreamDealWithRejection</a>(<var>stream</var>, <var>error</var>).</p> </ol> </div> <div class="algorithm" data-algorithm="WritableStreamFinishInFlightWrite"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="WritableStreamFinishInFlightWrite" id="writable-stream-finish-in-flight-write">WritableStreamFinishInFlightWrite(<var>stream</var>)</dfn> performs the following steps: <ol> <li data-md> <p class="assertion">Assert: <var>stream</var>.<a data-link-type="dfn" href="#writablestream-inflightwriterequest" id="ref-for-writablestream-inflightwriterequest②">[[inFlightWriteRequest]]</a> is not undefined.</p> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#resolve" id="ref-for-resolve②⑤">Resolve</a> <var>stream</var>.<a data-link-type="dfn" href="#writablestream-inflightwriterequest" id="ref-for-writablestream-inflightwriterequest③">[[inFlightWriteRequest]]</a> with undefined.</p> <li data-md> <p>Set <var>stream</var>.<a data-link-type="dfn" href="#writablestream-inflightwriterequest" id="ref-for-writablestream-inflightwriterequest④">[[inFlightWriteRequest]]</a> to undefined.</p> </ol> </div> <div class="algorithm" data-algorithm="WritableStreamFinishInFlightWriteWithError"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="WritableStreamFinishInFlightWriteWithError" id="writable-stream-finish-in-flight-write-with-error">WritableStreamFinishInFlightWriteWithError(<var>stream</var>, <var>error</var>)</dfn> performs the following steps: <ol> <li data-md> <p class="assertion">Assert: <var>stream</var>.<a data-link-type="dfn" href="#writablestream-inflightwriterequest" id="ref-for-writablestream-inflightwriterequest⑤">[[inFlightWriteRequest]]</a> is not undefined.</p> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#reject" id="ref-for-reject①①">Reject</a> <var>stream</var>.<a data-link-type="dfn" href="#writablestream-inflightwriterequest" id="ref-for-writablestream-inflightwriterequest⑥">[[inFlightWriteRequest]]</a> with <var>error</var>.</p> <li data-md> <p>Set <var>stream</var>.<a data-link-type="dfn" href="#writablestream-inflightwriterequest" id="ref-for-writablestream-inflightwriterequest⑦">[[inFlightWriteRequest]]</a> to undefined.</p> <li data-md> <p class="assertion">Assert: <var>stream</var>.<a data-link-type="dfn" href="#writablestream-state" id="ref-for-writablestream-state①⑨">[[state]]</a> is "<code>writable</code>" or "<code>erroring</code>".</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#writable-stream-deal-with-rejection" id="ref-for-writable-stream-deal-with-rejection①">WritableStreamDealWithRejection</a>(<var>stream</var>, <var>error</var>).</p> </ol> </div> <div class="algorithm" data-algorithm="WritableStreamHasOperationMarkedInFlight"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="WritableStreamHasOperationMarkedInFlight" id="writable-stream-has-operation-marked-in-flight">WritableStreamHasOperationMarkedInFlight(<var>stream</var>)</dfn> performs the following steps: <ol> <li data-md> <p>If <var>stream</var>.<a data-link-type="dfn" href="#writablestream-inflightwriterequest" id="ref-for-writablestream-inflightwriterequest⑧">[[inFlightWriteRequest]]</a> is undefined and <var>stream</var>.<a data-link-type="dfn" href="#writablestream-inflightcloserequest" id="ref-for-writablestream-inflightcloserequest⑨">[[inFlightCloseRequest]]</a> is undefined, return false.</p> <li data-md> <p>Return true.</p> </ol> </div> <div class="algorithm" data-algorithm="WritableStreamMarkCloseRequestInFlight"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="WritableStreamMarkCloseRequestInFlight" id="writable-stream-mark-close-request-in-flight">WritableStreamMarkCloseRequestInFlight(<var>stream</var>)</dfn> performs the following steps: <ol> <li data-md> <p class="assertion">Assert: <var>stream</var>.<a data-link-type="dfn" href="#writablestream-inflightcloserequest" id="ref-for-writablestream-inflightcloserequest①⓪">[[inFlightCloseRequest]]</a> is undefined.</p> <li data-md> <p class="assertion">Assert: <var>stream</var>.<a data-link-type="dfn" href="#writablestream-closerequest" id="ref-for-writablestream-closerequest④">[[closeRequest]]</a> is not undefined.</p> <li data-md> <p>Set <var>stream</var>.<a data-link-type="dfn" href="#writablestream-inflightcloserequest" id="ref-for-writablestream-inflightcloserequest①①">[[inFlightCloseRequest]]</a> to <var>stream</var>.<a data-link-type="dfn" href="#writablestream-closerequest" id="ref-for-writablestream-closerequest⑤">[[closeRequest]]</a>.</p> <li data-md> <p>Set <var>stream</var>.<a data-link-type="dfn" href="#writablestream-closerequest" id="ref-for-writablestream-closerequest⑥">[[closeRequest]]</a> to undefined.</p> </ol> </div> <div class="algorithm" data-algorithm="WritableStreamMarkFirstWriteRequestInFlight"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="WritableStreamMarkFirstWriteRequestInFlight" id="writable-stream-mark-first-write-request-in-flight">WritableStreamMarkFirstWriteRequestInFlight(<var>stream</var>)</dfn> performs the following steps: <ol> <li data-md> <p class="assertion">Assert: <var>stream</var>.<a data-link-type="dfn" href="#writablestream-inflightwriterequest" id="ref-for-writablestream-inflightwriterequest⑨">[[inFlightWriteRequest]]</a> is undefined.</p> <li data-md> <p class="assertion">Assert: <var>stream</var>.<a data-link-type="dfn" href="#writablestream-writerequests" id="ref-for-writablestream-writerequests⑤">[[writeRequests]]</a> is not empty.</p> <li data-md> <p>Let <var>writeRequest</var> be <var>stream</var>.<a data-link-type="dfn" href="#writablestream-writerequests" id="ref-for-writablestream-writerequests⑥">[[writeRequests]]</a>[0].</p> <li data-md> <p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-remove" id="ref-for-list-remove⑥">Remove</a> <var>writeRequest</var> from <var>stream</var>.<a data-link-type="dfn" href="#writablestream-writerequests" id="ref-for-writablestream-writerequests⑦">[[writeRequests]]</a>.</p> <li data-md> <p>Set <var>stream</var>.<a data-link-type="dfn" href="#writablestream-inflightwriterequest" id="ref-for-writablestream-inflightwriterequest①⓪">[[inFlightWriteRequest]]</a> to <var>writeRequest</var>.</p> </ol> </div> <div class="algorithm" data-algorithm="WritableStreamRejectCloseAndClosedPromiseIfNeeded"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="WritableStreamRejectCloseAndClosedPromiseIfNeeded" id="writable-stream-reject-close-and-closed-promise-if-needed">WritableStreamRejectCloseAndClosedPromiseIfNeeded(<var>stream</var>)</dfn> performs the following steps: <ol> <li data-md> <p class="assertion">Assert: <var>stream</var>.<a data-link-type="dfn" href="#writablestream-state" id="ref-for-writablestream-state②⓪">[[state]]</a> is "<code>errored</code>".</p> <li data-md> <p>If <var>stream</var>.<a data-link-type="dfn" href="#writablestream-closerequest" id="ref-for-writablestream-closerequest⑦">[[closeRequest]]</a> is not undefined,</p> <ol> <li data-md> <p class="assertion">Assert: <var>stream</var>.<a data-link-type="dfn" href="#writablestream-inflightcloserequest" id="ref-for-writablestream-inflightcloserequest①②">[[inFlightCloseRequest]]</a> is undefined.</p> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#reject" id="ref-for-reject①②">Reject</a> <var>stream</var>.<a data-link-type="dfn" href="#writablestream-closerequest" id="ref-for-writablestream-closerequest⑧">[[closeRequest]]</a> with <var>stream</var>.<a data-link-type="dfn" href="#writablestream-storederror" id="ref-for-writablestream-storederror⑨">[[storedError]]</a>.</p> <li data-md> <p>Set <var>stream</var>.<a data-link-type="dfn" href="#writablestream-closerequest" id="ref-for-writablestream-closerequest⑨">[[closeRequest]]</a> to undefined.</p> </ol> <li data-md> <p>Let <var>writer</var> be <var>stream</var>.<a data-link-type="dfn" href="#writablestream-writer" id="ref-for-writablestream-writer⑥">[[writer]]</a>.</p> <li data-md> <p>If <var>writer</var> is not undefined,</p> <ol> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#reject" id="ref-for-reject①③">Reject</a> <var>writer</var>.<a data-link-type="dfn" href="#writablestreamdefaultwriter-closedpromise" id="ref-for-writablestreamdefaultwriter-closedpromise⑦">[[closedPromise]]</a> with <var>stream</var>.<a data-link-type="dfn" href="#writablestream-storederror" id="ref-for-writablestream-storederror①⓪">[[storedError]]</a>.</p> <li data-md> <p>Set <var>writer</var>.<a data-link-type="dfn" href="#writablestreamdefaultwriter-closedpromise" id="ref-for-writablestreamdefaultwriter-closedpromise⑧">[[closedPromise]]</a>.[[PromiseIsHandled]] to true.</p> </ol> </ol> </div> <div class="algorithm" data-algorithm="WritableStreamStartErroring"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="WritableStreamStartErroring" id="writable-stream-start-erroring">WritableStreamStartErroring(<var>stream</var>, <var>reason</var>)</dfn> performs the following steps: <ol> <li data-md> <p class="assertion">Assert: <var>stream</var>.<a data-link-type="dfn" href="#writablestream-storederror" id="ref-for-writablestream-storederror①①">[[storedError]]</a> is undefined.</p> <li data-md> <p class="assertion">Assert: <var>stream</var>.<a data-link-type="dfn" href="#writablestream-state" id="ref-for-writablestream-state②①">[[state]]</a> is "<code>writable</code>".</p> <li data-md> <p>Let <var>controller</var> be <var>stream</var>.<a data-link-type="dfn" href="#writablestream-controller" id="ref-for-writablestream-controller⑤">[[controller]]</a>.</p> <li data-md> <p class="assertion">Assert: <var>controller</var> is not undefined.</p> <li data-md> <p>Set <var>stream</var>.<a data-link-type="dfn" href="#writablestream-state" id="ref-for-writablestream-state②②">[[state]]</a> to "<code>erroring</code>".</p> <li data-md> <p>Set <var>stream</var>.<a data-link-type="dfn" href="#writablestream-storederror" id="ref-for-writablestream-storederror①②">[[storedError]]</a> to <var>reason</var>.</p> <li data-md> <p>Let <var>writer</var> be <var>stream</var>.<a data-link-type="dfn" href="#writablestream-writer" id="ref-for-writablestream-writer⑦">[[writer]]</a>.</p> <li data-md> <p>If <var>writer</var> is not undefined, perform ! <a data-link-type="abstract-op" href="#writable-stream-default-writer-ensure-ready-promise-rejected" id="ref-for-writable-stream-default-writer-ensure-ready-promise-rejected">WritableStreamDefaultWriterEnsureReadyPromiseRejected</a>(<var>writer</var>, <var>reason</var>).</p> <li data-md> <p>If ! <a data-link-type="abstract-op" href="#writable-stream-has-operation-marked-in-flight" id="ref-for-writable-stream-has-operation-marked-in-flight①">WritableStreamHasOperationMarkedInFlight</a>(<var>stream</var>) is false and <var>controller</var>.<a data-link-type="dfn" href="#writablestreamdefaultcontroller-started" id="ref-for-writablestreamdefaultcontroller-started">[[started]]</a> is true, perform ! <a data-link-type="abstract-op" href="#writable-stream-finish-erroring" id="ref-for-writable-stream-finish-erroring①">WritableStreamFinishErroring</a>(<var>stream</var>).</p> </ol> </div> <div class="algorithm" data-algorithm="WritableStreamUpdateBackpressure"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="WritableStreamUpdateBackpressure" id="writable-stream-update-backpressure">WritableStreamUpdateBackpressure(<var>stream</var>, <var>backpressure</var>)</dfn> performs the following steps: <ol> <li data-md> <p class="assertion">Assert: <var>stream</var>.<a data-link-type="dfn" href="#writablestream-state" id="ref-for-writablestream-state②③">[[state]]</a> is "<code>writable</code>".</p> <li data-md> <p class="assertion">Assert: ! <a data-link-type="abstract-op" href="#writable-stream-close-queued-or-in-flight" id="ref-for-writable-stream-close-queued-or-in-flight⑦">WritableStreamCloseQueuedOrInFlight</a>(<var>stream</var>) is false.</p> <li data-md> <p>Let <var>writer</var> be <var>stream</var>.<a data-link-type="dfn" href="#writablestream-writer" id="ref-for-writablestream-writer⑧">[[writer]]</a>.</p> <li data-md> <p>If <var>writer</var> is not undefined and <var>backpressure</var> is not <var>stream</var>.<a data-link-type="dfn" href="#writablestream-backpressure" id="ref-for-writablestream-backpressure③">[[backpressure]]</a>,</p> <ol> <li data-md> <p>If <var>backpressure</var> is true, set <var>writer</var>.<a data-link-type="dfn" href="#writablestreamdefaultwriter-readypromise" id="ref-for-writablestreamdefaultwriter-readypromise⑨">[[readyPromise]]</a> to <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-new-promise" id="ref-for-a-new-promise①③">a new promise</a>.</p> <li data-md> <p>Otherwise,</p> <ol> <li data-md> <p class="assertion">Assert: <var>backpressure</var> is false.</p> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#resolve" id="ref-for-resolve②⑥">Resolve</a> <var>writer</var>.<a data-link-type="dfn" href="#writablestreamdefaultwriter-readypromise" id="ref-for-writablestreamdefaultwriter-readypromise①⓪">[[readyPromise]]</a> with undefined.</p> </ol> </ol> <li data-md> <p>Set <var>stream</var>.<a data-link-type="dfn" href="#writablestream-backpressure" id="ref-for-writablestream-backpressure④">[[backpressure]]</a> to <var>backpressure</var>.</p> </ol> </div> <h4 class="heading settled" data-level="5.5.3" id="ws-writer-abstract-ops"><span class="secno">5.5.3. </span><span class="content">Writers</span><a class="self-link" href="#ws-writer-abstract-ops"></a></h4> <p>The following abstract operations support the implementation and manipulation of <code class="idl"><a data-link-type="idl" href="#writablestreamdefaultwriter" id="ref-for-writablestreamdefaultwriter①⓪">WritableStreamDefaultWriter</a></code> instances.</p> <div class="algorithm" data-algorithm="WritableStreamDefaultWriterAbort"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="WritableStreamDefaultWriterAbort" id="writable-stream-default-writer-abort">WritableStreamDefaultWriterAbort(<var>writer</var>, <var>reason</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>stream</var> be <var>writer</var>.<a data-link-type="dfn" href="#writablestreamdefaultwriter-stream" id="ref-for-writablestreamdefaultwriter-stream⑥">[[stream]]</a>.</p> <li data-md> <p class="assertion">Assert: <var>stream</var> is not undefined.</p> <li data-md> <p>Return ! <a data-link-type="abstract-op" href="#writable-stream-abort" id="ref-for-writable-stream-abort⑥">WritableStreamAbort</a>(<var>stream</var>, <var>reason</var>).</p> </ol> </div> <div class="algorithm" data-algorithm="WritableStreamDefaultWriterClose"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="WritableStreamDefaultWriterClose" id="writable-stream-default-writer-close">WritableStreamDefaultWriterClose(<var>writer</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>stream</var> be <var>writer</var>.<a data-link-type="dfn" href="#writablestreamdefaultwriter-stream" id="ref-for-writablestreamdefaultwriter-stream⑦">[[stream]]</a>.</p> <li data-md> <p class="assertion">Assert: <var>stream</var> is not undefined.</p> <li data-md> <p>Return ! <a data-link-type="abstract-op" href="#writable-stream-close" id="ref-for-writable-stream-close①">WritableStreamClose</a>(<var>stream</var>).</p> </ol> </div> <div class="algorithm" data-algorithm="WritableStreamDefaultWriterCloseWithErrorPropagation"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="WritableStreamDefaultWriterCloseWithErrorPropagation" id="writable-stream-default-writer-close-with-error-propagation">WritableStreamDefaultWriterCloseWithErrorPropagation(<var>writer</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>stream</var> be <var>writer</var>.<a data-link-type="dfn" href="#writablestreamdefaultwriter-stream" id="ref-for-writablestreamdefaultwriter-stream⑧">[[stream]]</a>.</p> <li data-md> <p class="assertion">Assert: <var>stream</var> is not undefined.</p> <li data-md> <p>Let <var>state</var> be <var>stream</var>.<a data-link-type="dfn" href="#writablestream-state" id="ref-for-writablestream-state②④">[[state]]</a>.</p> <li data-md> <p>If ! <a data-link-type="abstract-op" href="#writable-stream-close-queued-or-in-flight" id="ref-for-writable-stream-close-queued-or-in-flight⑧">WritableStreamCloseQueuedOrInFlight</a>(<var>stream</var>) is true or <var>state</var> is "<code>closed</code>", return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-resolved-with" id="ref-for-a-promise-resolved-with②⑤">a promise resolved with</a> undefined.</p> <li data-md> <p>If <var>state</var> is "<code>errored</code>", return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-rejected-with" id="ref-for-a-promise-rejected-with②⑨">a promise rejected with</a> <var>stream</var>.<a data-link-type="dfn" href="#writablestream-storederror" id="ref-for-writablestream-storederror①③">[[storedError]]</a>.</p> <li data-md> <p class="assertion">Assert: <var>state</var> is "<code>writable</code>" or "<code>erroring</code>".</p> <li data-md> <p>Return ! <a data-link-type="abstract-op" href="#writable-stream-default-writer-close" id="ref-for-writable-stream-default-writer-close①">WritableStreamDefaultWriterClose</a>(<var>writer</var>).</p> </ol> <p class="note" role="note">This abstract operation helps implement the error propagation semantics of <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream④⑧">ReadableStream</a></code>'s <code class="idl"><a data-link-type="idl" href="#rs-pipe-to" id="ref-for-rs-pipe-to⑦">pipeTo()</a></code>. </p> </div> <div class="algorithm" data-algorithm="WritableStreamDefaultWriterEnsureClosedPromiseRejected"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="WritableStreamDefaultWriterEnsureClosedPromiseRejected" id="writable-stream-default-writer-ensure-closed-promise-rejected">WritableStreamDefaultWriterEnsureClosedPromiseRejected(<var>writer</var>, <var>error</var>)</dfn> performs the following steps: <ol> <li data-md> <p>If <var>writer</var>.<a data-link-type="dfn" href="#writablestreamdefaultwriter-closedpromise" id="ref-for-writablestreamdefaultwriter-closedpromise⑨">[[closedPromise]]</a>.[[PromiseState]] is "<code>pending</code>", <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#reject" id="ref-for-reject①④">reject</a> <var>writer</var>.<a data-link-type="dfn" href="#writablestreamdefaultwriter-closedpromise" id="ref-for-writablestreamdefaultwriter-closedpromise①⓪">[[closedPromise]]</a> with <var>error</var>.</p> <li data-md> <p>Otherwise, set <var>writer</var>.<a data-link-type="dfn" href="#writablestreamdefaultwriter-closedpromise" id="ref-for-writablestreamdefaultwriter-closedpromise①①">[[closedPromise]]</a> to <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-rejected-with" id="ref-for-a-promise-rejected-with③⓪">a promise rejected with</a> <var>error</var>.</p> <li data-md> <p>Set <var>writer</var>.<a data-link-type="dfn" href="#writablestreamdefaultwriter-closedpromise" id="ref-for-writablestreamdefaultwriter-closedpromise①②">[[closedPromise]]</a>.[[PromiseIsHandled]] to true.</p> </ol> </div> <div class="algorithm" data-algorithm="WritableStreamDefaultWriterEnsureReadyPromiseRejected"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="WritableStreamDefaultWriterEnsureReadyPromiseRejected" id="writable-stream-default-writer-ensure-ready-promise-rejected">WritableStreamDefaultWriterEnsureReadyPromiseRejected(<var>writer</var>, <var>error</var>)</dfn> performs the following steps: <ol> <li data-md> <p>If <var>writer</var>.<a data-link-type="dfn" href="#writablestreamdefaultwriter-readypromise" id="ref-for-writablestreamdefaultwriter-readypromise①①">[[readyPromise]]</a>.[[PromiseState]] is "<code>pending</code>", <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#reject" id="ref-for-reject①⑤">reject</a> <var>writer</var>.<a data-link-type="dfn" href="#writablestreamdefaultwriter-readypromise" id="ref-for-writablestreamdefaultwriter-readypromise①②">[[readyPromise]]</a> with <var>error</var>.</p> <li data-md> <p>Otherwise, set <var>writer</var>.<a data-link-type="dfn" href="#writablestreamdefaultwriter-readypromise" id="ref-for-writablestreamdefaultwriter-readypromise①③">[[readyPromise]]</a> to <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-rejected-with" id="ref-for-a-promise-rejected-with③①">a promise rejected with</a> <var>error</var>.</p> <li data-md> <p>Set <var>writer</var>.<a data-link-type="dfn" href="#writablestreamdefaultwriter-readypromise" id="ref-for-writablestreamdefaultwriter-readypromise①④">[[readyPromise]]</a>.[[PromiseIsHandled]] to true.</p> </ol> </div> <div class="algorithm" data-algorithm="WritableStreamDefaultWriterGetDesiredSize"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="WritableStreamDefaultWriterGetDesiredSize" id="writable-stream-default-writer-get-desired-size">WritableStreamDefaultWriterGetDesiredSize(<var>writer</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>stream</var> be <var>writer</var>.<a data-link-type="dfn" href="#writablestreamdefaultwriter-stream" id="ref-for-writablestreamdefaultwriter-stream⑨">[[stream]]</a>.</p> <li data-md> <p>Let <var>state</var> be <var>stream</var>.<a data-link-type="dfn" href="#writablestream-state" id="ref-for-writablestream-state②⑤">[[state]]</a>.</p> <li data-md> <p>If <var>state</var> is "<code>errored</code>" or "<code>erroring</code>", return null.</p> <li data-md> <p>If <var>state</var> is "<code>closed</code>", return 0.</p> <li data-md> <p>Return ! <a data-link-type="abstract-op" href="#writable-stream-default-controller-get-desired-size" id="ref-for-writable-stream-default-controller-get-desired-size">WritableStreamDefaultControllerGetDesiredSize</a>(<var>stream</var>.<a data-link-type="dfn" href="#writablestream-controller" id="ref-for-writablestream-controller⑥">[[controller]]</a>).</p> </ol> </div> <div class="algorithm" data-algorithm="WritableStreamDefaultWriterRelease"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="WritableStreamDefaultWriterRelease" id="writable-stream-default-writer-release">WritableStreamDefaultWriterRelease(<var>writer</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>stream</var> be <var>writer</var>.<a data-link-type="dfn" href="#writablestreamdefaultwriter-stream" id="ref-for-writablestreamdefaultwriter-stream①⓪">[[stream]]</a>.</p> <li data-md> <p class="assertion">Assert: <var>stream</var> is not undefined.</p> <li data-md> <p class="assertion">Assert: <var>stream</var>.<a data-link-type="dfn" href="#writablestream-writer" id="ref-for-writablestream-writer⑨">[[writer]]</a> is <var>writer</var>.</p> <li data-md> <p>Let <var>releasedError</var> be a new <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror⑥⓪">TypeError</a></code>.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#writable-stream-default-writer-ensure-ready-promise-rejected" id="ref-for-writable-stream-default-writer-ensure-ready-promise-rejected①">WritableStreamDefaultWriterEnsureReadyPromiseRejected</a>(<var>writer</var>, <var>releasedError</var>).</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#writable-stream-default-writer-ensure-closed-promise-rejected" id="ref-for-writable-stream-default-writer-ensure-closed-promise-rejected">WritableStreamDefaultWriterEnsureClosedPromiseRejected</a>(<var>writer</var>, <var>releasedError</var>).</p> <li data-md> <p>Set <var>stream</var>.<a data-link-type="dfn" href="#writablestream-writer" id="ref-for-writablestream-writer①⓪">[[writer]]</a> to undefined.</p> <li data-md> <p>Set <var>writer</var>.<a data-link-type="dfn" href="#writablestreamdefaultwriter-stream" id="ref-for-writablestreamdefaultwriter-stream①①">[[stream]]</a> to undefined.</p> </ol> </div> <div class="algorithm" data-algorithm="WritableStreamDefaultWriterWrite"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="WritableStreamDefaultWriterWrite" id="writable-stream-default-writer-write">WritableStreamDefaultWriterWrite(<var>writer</var>, <var>chunk</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>stream</var> be <var>writer</var>.<a data-link-type="dfn" href="#writablestreamdefaultwriter-stream" id="ref-for-writablestreamdefaultwriter-stream①②">[[stream]]</a>.</p> <li data-md> <p class="assertion">Assert: <var>stream</var> is not undefined.</p> <li data-md> <p>Let <var>controller</var> be <var>stream</var>.<a data-link-type="dfn" href="#writablestream-controller" id="ref-for-writablestream-controller⑦">[[controller]]</a>.</p> <li data-md> <p>Let <var>chunkSize</var> be ! <a data-link-type="abstract-op" href="#writable-stream-default-controller-get-chunk-size" id="ref-for-writable-stream-default-controller-get-chunk-size">WritableStreamDefaultControllerGetChunkSize</a>(<var>controller</var>, <var>chunk</var>).</p> <li data-md> <p>If <var>stream</var> is not equal to <var>writer</var>.<a data-link-type="dfn" href="#writablestreamdefaultwriter-stream" id="ref-for-writablestreamdefaultwriter-stream①③">[[stream]]</a>, return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-rejected-with" id="ref-for-a-promise-rejected-with③②">a promise rejected with</a> a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror⑥①">TypeError</a></code> exception.</p> <li data-md> <p>Let <var>state</var> be <var>stream</var>.<a data-link-type="dfn" href="#writablestream-state" id="ref-for-writablestream-state②⑥">[[state]]</a>.</p> <li data-md> <p>If <var>state</var> is "<code>errored</code>", return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-rejected-with" id="ref-for-a-promise-rejected-with③③">a promise rejected with</a> <var>stream</var>.<a data-link-type="dfn" href="#writablestream-storederror" id="ref-for-writablestream-storederror①④">[[storedError]]</a>.</p> <li data-md> <p>If ! <a data-link-type="abstract-op" href="#writable-stream-close-queued-or-in-flight" id="ref-for-writable-stream-close-queued-or-in-flight⑨">WritableStreamCloseQueuedOrInFlight</a>(<var>stream</var>) is true or <var>state</var> is "<code>closed</code>", return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-rejected-with" id="ref-for-a-promise-rejected-with③④">a promise rejected with</a> a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror⑥②">TypeError</a></code> exception indicating that the stream is closing or closed.</p> <li data-md> <p>If <var>state</var> is "<code>erroring</code>", return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-rejected-with" id="ref-for-a-promise-rejected-with③⑤">a promise rejected with</a> <var>stream</var>.<a data-link-type="dfn" href="#writablestream-storederror" id="ref-for-writablestream-storederror①⑤">[[storedError]]</a>.</p> <li data-md> <p class="assertion">Assert: <var>state</var> is "<code>writable</code>".</p> <li data-md> <p>Let <var>promise</var> be ! <a data-link-type="abstract-op" href="#writable-stream-add-write-request" id="ref-for-writable-stream-add-write-request">WritableStreamAddWriteRequest</a>(<var>stream</var>).</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#writable-stream-default-controller-write" id="ref-for-writable-stream-default-controller-write">WritableStreamDefaultControllerWrite</a>(<var>controller</var>, <var>chunk</var>, <var>chunkSize</var>).</p> <li data-md> <p>Return <var>promise</var>.</p> </ol> </div> <h4 class="heading settled" data-level="5.5.4" id="ws-default-controller-abstract-ops"><span class="secno">5.5.4. </span><span class="content">Default controllers</span><a class="self-link" href="#ws-default-controller-abstract-ops"></a></h4> <p>The following abstract operations support the implementation of the <code class="idl"><a data-link-type="idl" href="#writablestreamdefaultcontroller" id="ref-for-writablestreamdefaultcontroller①③">WritableStreamDefaultController</a></code> class.</p> <div class="algorithm" data-algorithm="SetUpWritableStreamDefaultController"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="SetUpWritableStreamDefaultController" id="set-up-writable-stream-default-controller">SetUpWritableStreamDefaultController(<var>stream</var>, <var>controller</var>, <var>startAlgorithm</var>, <var>writeAlgorithm</var>, <var>closeAlgorithm</var>, <var>abortAlgorithm</var>, <var>highWaterMark</var>, <var>sizeAlgorithm</var>)</dfn> performs the following steps: <ol> <li data-md> <p class="assertion">Assert: <var>stream</var> <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#implements" id="ref-for-implements②②">implements</a> <code class="idl"><a data-link-type="idl" href="#writablestream" id="ref-for-writablestream②⑧">WritableStream</a></code>.</p> <li data-md> <p class="assertion">Assert: <var>stream</var>.<a data-link-type="dfn" href="#writablestream-controller" id="ref-for-writablestream-controller⑧">[[controller]]</a> is undefined.</p> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#writablestreamdefaultcontroller-stream" id="ref-for-writablestreamdefaultcontroller-stream①">[[stream]]</a> to <var>stream</var>.</p> <li data-md> <p>Set <var>stream</var>.<a data-link-type="dfn" href="#writablestream-controller" id="ref-for-writablestream-controller⑨">[[controller]]</a> to <var>controller</var>.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#reset-queue" id="ref-for-reset-queue⑦">ResetQueue</a>(<var>controller</var>).</p> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#writablestreamdefaultcontroller-abortcontroller" id="ref-for-writablestreamdefaultcontroller-abortcontroller②">[[abortController]]</a> to a new <code class="idl"><a data-link-type="idl" href="https://dom.spec.whatwg.org/#abortcontroller" id="ref-for-abortcontroller②">AbortController</a></code>.</p> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#writablestreamdefaultcontroller-started" id="ref-for-writablestreamdefaultcontroller-started①">[[started]]</a> to false.</p> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#writablestreamdefaultcontroller-strategysizealgorithm" id="ref-for-writablestreamdefaultcontroller-strategysizealgorithm">[[strategySizeAlgorithm]]</a> to <var>sizeAlgorithm</var>.</p> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#writablestreamdefaultcontroller-strategyhwm" id="ref-for-writablestreamdefaultcontroller-strategyhwm">[[strategyHWM]]</a> to <var>highWaterMark</var>.</p> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#writablestreamdefaultcontroller-writealgorithm" id="ref-for-writablestreamdefaultcontroller-writealgorithm">[[writeAlgorithm]]</a> to <var>writeAlgorithm</var>.</p> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#writablestreamdefaultcontroller-closealgorithm" id="ref-for-writablestreamdefaultcontroller-closealgorithm">[[closeAlgorithm]]</a> to <var>closeAlgorithm</var>.</p> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#writablestreamdefaultcontroller-abortalgorithm" id="ref-for-writablestreamdefaultcontroller-abortalgorithm①">[[abortAlgorithm]]</a> to <var>abortAlgorithm</var>.</p> <li data-md> <p>Let <var>backpressure</var> be ! <a data-link-type="abstract-op" href="#writable-stream-default-controller-get-backpressure" id="ref-for-writable-stream-default-controller-get-backpressure">WritableStreamDefaultControllerGetBackpressure</a>(<var>controller</var>).</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#writable-stream-update-backpressure" id="ref-for-writable-stream-update-backpressure">WritableStreamUpdateBackpressure</a>(<var>stream</var>, <var>backpressure</var>).</p> <li data-md> <p>Let <var>startResult</var> be the result of performing <var>startAlgorithm</var>. (This may throw an exception.)</p> <li data-md> <p>Let <var>startPromise</var> be <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-resolved-with" id="ref-for-a-promise-resolved-with②⑥">a promise resolved with</a> <var>startResult</var>.</p> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#upon-fulfillment" id="ref-for-upon-fulfillment⑥">Upon fulfillment</a> of <var>startPromise</var>,</p> <ol> <li data-md> <p class="assertion">Assert: <var>stream</var>.<a data-link-type="dfn" href="#writablestream-state" id="ref-for-writablestream-state②⑦">[[state]]</a> is "<code>writable</code>" or "<code>erroring</code>".</p> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#writablestreamdefaultcontroller-started" id="ref-for-writablestreamdefaultcontroller-started②">[[started]]</a> to true.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#writable-stream-default-controller-advance-queue-if-needed" id="ref-for-writable-stream-default-controller-advance-queue-if-needed">WritableStreamDefaultControllerAdvanceQueueIfNeeded</a>(<var>controller</var>).</p> </ol> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#upon-rejection" id="ref-for-upon-rejection⑧">Upon rejection</a> of <var>startPromise</var> with reason <var>r</var>,</p> <ol> <li data-md> <p class="assertion">Assert: <var>stream</var>.<a data-link-type="dfn" href="#writablestream-state" id="ref-for-writablestream-state②⑧">[[state]]</a> is "<code>writable</code>" or "<code>erroring</code>".</p> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#writablestreamdefaultcontroller-started" id="ref-for-writablestreamdefaultcontroller-started③">[[started]]</a> to true.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#writable-stream-deal-with-rejection" id="ref-for-writable-stream-deal-with-rejection②">WritableStreamDealWithRejection</a>(<var>stream</var>, <var>r</var>).</p> </ol> </ol> </div> <div class="algorithm" data-algorithm="SetUpWritableStreamDefaultControllerFromUnderlyingSink"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="SetUpWritableStreamDefaultControllerFromUnderlyingSink" id="set-up-writable-stream-default-controller-from-underlying-sink">SetUpWritableStreamDefaultControllerFromUnderlyingSink(<var>stream</var>, <var>underlyingSink</var>, <var>underlyingSinkDict</var>, <var>highWaterMark</var>, <var>sizeAlgorithm</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>controller</var> be a <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#new" id="ref-for-new①⑧">new</a> <code class="idl"><a data-link-type="idl" href="#writablestreamdefaultcontroller" id="ref-for-writablestreamdefaultcontroller①④">WritableStreamDefaultController</a></code>.</p> <li data-md> <p>Let <var>startAlgorithm</var> be an algorithm that returns undefined.</p> <li data-md> <p>Let <var>writeAlgorithm</var> be an algorithm that returns <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-resolved-with" id="ref-for-a-promise-resolved-with②⑦">a promise resolved with</a> undefined.</p> <li data-md> <p>Let <var>closeAlgorithm</var> be an algorithm that returns <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-resolved-with" id="ref-for-a-promise-resolved-with②⑧">a promise resolved with</a> undefined.</p> <li data-md> <p>Let <var>abortAlgorithm</var> be an algorithm that returns <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-resolved-with" id="ref-for-a-promise-resolved-with②⑨">a promise resolved with</a> undefined.</p> <li data-md> <p>If <var>underlyingSinkDict</var>["<code class="idl"><a data-link-type="idl" href="#dom-underlyingsink-start" id="ref-for-dom-underlyingsink-start③">start</a></code>"] <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#map-exists" id="ref-for-map-exists①③">exists</a>, then set <var>startAlgorithm</var> to an algorithm which returns the result of <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#invoke-a-callback-function" id="ref-for-invoke-a-callback-function⑧">invoking</a> <var>underlyingSinkDict</var>["<code class="idl"><a data-link-type="idl" href="#dom-underlyingsink-start" id="ref-for-dom-underlyingsink-start④">start</a></code>"] with argument list « <var>controller</var> », exception behavior "<code>rethrow</code>", and <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-callback-this-value" id="ref-for-dfn-callback-this-value⑥">callback this value</a> <var>underlyingSink</var>.</p> <li data-md> <p>If <var>underlyingSinkDict</var>["<code class="idl"><a data-link-type="idl" href="#dom-underlyingsink-write" id="ref-for-dom-underlyingsink-write④">write</a></code>"] <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#map-exists" id="ref-for-map-exists①④">exists</a>, then set <var>writeAlgorithm</var> to an algorithm which takes an argument <var>chunk</var> and returns the result of <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#invoke-a-callback-function" id="ref-for-invoke-a-callback-function⑨">invoking</a> <var>underlyingSinkDict</var>["<code class="idl"><a data-link-type="idl" href="#dom-underlyingsink-write" id="ref-for-dom-underlyingsink-write⑤">write</a></code>"] with argument list « <var>chunk</var>, <var>controller</var> » and <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-callback-this-value" id="ref-for-dfn-callback-this-value⑦">callback this value</a> <var>underlyingSink</var>.</p> <li data-md> <p>If <var>underlyingSinkDict</var>["<code class="idl"><a data-link-type="idl" href="#dom-underlyingsink-close" id="ref-for-dom-underlyingsink-close④">close</a></code>"] <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#map-exists" id="ref-for-map-exists①⑤">exists</a>, then set <var>closeAlgorithm</var> to an algorithm which returns the result of <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#invoke-a-callback-function" id="ref-for-invoke-a-callback-function①⓪">invoking</a> <var>underlyingSinkDict</var>["<code class="idl"><a data-link-type="idl" href="#dom-underlyingsink-close" id="ref-for-dom-underlyingsink-close⑤">close</a></code>"] with argument list «» and <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-callback-this-value" id="ref-for-dfn-callback-this-value⑧">callback this value</a> <var>underlyingSink</var>.</p> <li data-md> <p>If <var>underlyingSinkDict</var>["<code class="idl"><a data-link-type="idl" href="#dom-underlyingsink-abort" id="ref-for-dom-underlyingsink-abort③">abort</a></code>"] <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#map-exists" id="ref-for-map-exists①⑥">exists</a>, then set <var>abortAlgorithm</var> to an algorithm which takes an argument <var>reason</var> and returns the result of <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#invoke-a-callback-function" id="ref-for-invoke-a-callback-function①①">invoking</a> <var>underlyingSinkDict</var>["<code class="idl"><a data-link-type="idl" href="#dom-underlyingsink-abort" id="ref-for-dom-underlyingsink-abort④">abort</a></code>"] with argument list « <var>reason</var> » and <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-callback-this-value" id="ref-for-dfn-callback-this-value⑨">callback this value</a> <var>underlyingSink</var>.</p> <li data-md> <p>Perform ? <a data-link-type="abstract-op" href="#set-up-writable-stream-default-controller" id="ref-for-set-up-writable-stream-default-controller①">SetUpWritableStreamDefaultController</a>(<var>stream</var>, <var>controller</var>, <var>startAlgorithm</var>, <var>writeAlgorithm</var>, <var>closeAlgorithm</var>, <var>abortAlgorithm</var>, <var>highWaterMark</var>, <var>sizeAlgorithm</var>).</p> </ol> </div> <div class="algorithm" data-algorithm="WritableStreamDefaultControllerAdvanceQueueIfNeeded"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="WritableStreamDefaultControllerAdvanceQueueIfNeeded" id="writable-stream-default-controller-advance-queue-if-needed">WritableStreamDefaultControllerAdvanceQueueIfNeeded(<var>controller</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>stream</var> be <var>controller</var>.<a data-link-type="dfn" href="#writablestreamdefaultcontroller-stream" id="ref-for-writablestreamdefaultcontroller-stream②">[[stream]]</a>.</p> <li data-md> <p>If <var>controller</var>.<a data-link-type="dfn" href="#writablestreamdefaultcontroller-started" id="ref-for-writablestreamdefaultcontroller-started④">[[started]]</a> is false, return.</p> <li data-md> <p>If <var>stream</var>.<a data-link-type="dfn" href="#writablestream-inflightwriterequest" id="ref-for-writablestream-inflightwriterequest①①">[[inFlightWriteRequest]]</a> is not undefined, return.</p> <li data-md> <p>Let <var>state</var> be <var>stream</var>.<a data-link-type="dfn" href="#writablestream-state" id="ref-for-writablestream-state②⑨">[[state]]</a>.</p> <li data-md> <p class="assertion">Assert: <var>state</var> is not "<code>closed</code>" or "<code>errored</code>".</p> <li data-md> <p>If <var>state</var> is "<code>erroring</code>",</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#writable-stream-finish-erroring" id="ref-for-writable-stream-finish-erroring②">WritableStreamFinishErroring</a>(<var>stream</var>).</p> <li data-md> <p>Return.</p> </ol> <li data-md> <p>If <var>controller</var>.<a data-link-type="dfn" href="#writablestreamdefaultcontroller-queue" id="ref-for-writablestreamdefaultcontroller-queue②">[[queue]]</a> is empty, return.</p> <li data-md> <p>Let <var>value</var> be ! <a data-link-type="abstract-op" href="#peek-queue-value" id="ref-for-peek-queue-value">PeekQueueValue</a>(<var>controller</var>).</p> <li data-md> <p>If <var>value</var> is the <a data-link-type="dfn" href="#close-sentinel" id="ref-for-close-sentinel">close sentinel</a>, perform ! <a data-link-type="abstract-op" href="#writable-stream-default-controller-process-close" id="ref-for-writable-stream-default-controller-process-close">WritableStreamDefaultControllerProcessClose</a>(<var>controller</var>).</p> <li data-md> <p>Otherwise, perform ! <a data-link-type="abstract-op" href="#writable-stream-default-controller-process-write" id="ref-for-writable-stream-default-controller-process-write">WritableStreamDefaultControllerProcessWrite</a>(<var>controller</var>, <var>value</var>).</p> </ol> </div> <div class="algorithm" data-algorithm="WritableStreamDefaultControllerClearAlgorithms"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="WritableStreamDefaultControllerClearAlgorithms" id="writable-stream-default-controller-clear-algorithms">WritableStreamDefaultControllerClearAlgorithms(<var>controller</var>)</dfn> is called once the stream is closed or errored and the algorithms will not be executed any more. By removing the algorithm references it permits the <a data-link-type="dfn" href="#underlying-sink" id="ref-for-underlying-sink③②">underlying sink</a> object to be garbage collected even if the <code class="idl"><a data-link-type="idl" href="#writablestream" id="ref-for-writablestream②⑨">WritableStream</a></code> itself is still referenced. <p class="note" role="note">This is observable using <a href="https://github.com/tc39/proposal-weakrefs/">weak references</a>. See <a href="https://github.com/tc39/proposal-weakrefs/issues/31">tc39/proposal-weakrefs#31</a> for more detail. </p> <p>It performs the following steps:</p> <ol> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#writablestreamdefaultcontroller-writealgorithm" id="ref-for-writablestreamdefaultcontroller-writealgorithm①">[[writeAlgorithm]]</a> to undefined.</p> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#writablestreamdefaultcontroller-closealgorithm" id="ref-for-writablestreamdefaultcontroller-closealgorithm①">[[closeAlgorithm]]</a> to undefined.</p> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#writablestreamdefaultcontroller-abortalgorithm" id="ref-for-writablestreamdefaultcontroller-abortalgorithm②">[[abortAlgorithm]]</a> to undefined.</p> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#writablestreamdefaultcontroller-strategysizealgorithm" id="ref-for-writablestreamdefaultcontroller-strategysizealgorithm①">[[strategySizeAlgorithm]]</a> to undefined.</p> </ol> <p class="note" role="note">This algorithm will be performed multiple times in some edge cases. After the first time it will do nothing. </p> </div> <div class="algorithm" data-algorithm="WritableStreamDefaultControllerClose"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="WritableStreamDefaultControllerClose" id="writable-stream-default-controller-close">WritableStreamDefaultControllerClose(<var>controller</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#enqueue-value-with-size" id="ref-for-enqueue-value-with-size①">EnqueueValueWithSize</a>(<var>controller</var>, <a data-link-type="dfn" href="#close-sentinel" id="ref-for-close-sentinel①">close sentinel</a>, 0).</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#writable-stream-default-controller-advance-queue-if-needed" id="ref-for-writable-stream-default-controller-advance-queue-if-needed①">WritableStreamDefaultControllerAdvanceQueueIfNeeded</a>(<var>controller</var>).</p> </ol> </div> <div class="algorithm" data-algorithm="WritableStreamDefaultControllerError"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="WritableStreamDefaultControllerError" id="writable-stream-default-controller-error">WritableStreamDefaultControllerError(<var>controller</var>, <var>error</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>stream</var> be <var>controller</var>.<a data-link-type="dfn" href="#writablestreamdefaultcontroller-stream" id="ref-for-writablestreamdefaultcontroller-stream③">[[stream]]</a>.</p> <li data-md> <p class="assertion">Assert: <var>stream</var>.<a data-link-type="dfn" href="#writablestream-state" id="ref-for-writablestream-state③⓪">[[state]]</a> is "<code>writable</code>".</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#writable-stream-default-controller-clear-algorithms" id="ref-for-writable-stream-default-controller-clear-algorithms①">WritableStreamDefaultControllerClearAlgorithms</a>(<var>controller</var>).</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#writable-stream-start-erroring" id="ref-for-writable-stream-start-erroring②">WritableStreamStartErroring</a>(<var>stream</var>, <var>error</var>).</p> </ol> </div> <div class="algorithm" data-algorithm="WritableStreamDefaultControllerErrorIfNeeded"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="WritableStreamDefaultControllerErrorIfNeeded" id="writable-stream-default-controller-error-if-needed">WritableStreamDefaultControllerErrorIfNeeded(<var>controller</var>, <var>error</var>)</dfn> performs the following steps: <ol> <li data-md> <p>If <var>controller</var>.<a data-link-type="dfn" href="#writablestreamdefaultcontroller-stream" id="ref-for-writablestreamdefaultcontroller-stream④">[[stream]]</a>.<a data-link-type="dfn" href="#writablestream-state" id="ref-for-writablestream-state③①">[[state]]</a> is "<code>writable</code>", perform ! <a data-link-type="abstract-op" href="#writable-stream-default-controller-error" id="ref-for-writable-stream-default-controller-error①">WritableStreamDefaultControllerError</a>(<var>controller</var>, <var>error</var>).</p> </ol> </div> <div class="algorithm" data-algorithm="WritableStreamDefaultControllerGetBackpressure"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="WritableStreamDefaultControllerGetBackpressure" id="writable-stream-default-controller-get-backpressure">WritableStreamDefaultControllerGetBackpressure(<var>controller</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>desiredSize</var> be ! <a data-link-type="abstract-op" href="#writable-stream-default-controller-get-desired-size" id="ref-for-writable-stream-default-controller-get-desired-size①">WritableStreamDefaultControllerGetDesiredSize</a>(<var>controller</var>).</p> <li data-md> <p>Return true if <var>desiredSize</var> ≤ 0, or false otherwise.</p> </ol> </div> <div class="algorithm" data-algorithm="WritableStreamDefaultControllerGetChunkSize"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="WritableStreamDefaultControllerGetChunkSize" id="writable-stream-default-controller-get-chunk-size">WritableStreamDefaultControllerGetChunkSize(<var>controller</var>, <var>chunk</var>)</dfn> performs the following steps: <ol> <li data-md> <p>If <var>controller</var>.<a data-link-type="dfn" href="#writablestreamdefaultcontroller-strategysizealgorithm" id="ref-for-writablestreamdefaultcontroller-strategysizealgorithm②">[[strategySizeAlgorithm]]</a> is undefined, then:</p> <ol> <li data-md> <p class="assertion">Assert: <var>controller</var>.<a data-link-type="dfn" href="#writablestreamdefaultcontroller-stream" id="ref-for-writablestreamdefaultcontroller-stream⑤">[[stream]]</a>.<a data-link-type="dfn" href="#writablestream-state" id="ref-for-writablestream-state③②">[[state]]</a> is "<code>erroring</code>" or "<code>errored</code>".</p> <li data-md> <p>Return 1.</p> </ol> <li data-md> <p>Let <var>returnValue</var> be the result of performing <var>controller</var>.<a data-link-type="dfn" href="#writablestreamdefaultcontroller-strategysizealgorithm" id="ref-for-writablestreamdefaultcontroller-strategysizealgorithm③">[[strategySizeAlgorithm]]</a>, passing in <var>chunk</var>, and interpreting the result as a <a data-link-type="dfn" href="https://tc39.es/ecma262/multipage/ecmascript-data-types-and-values.html#sec-completion-record-specification-type" id="ref-for-sec-completion-record-specification-type②">completion record</a>.</p> <li data-md> <p>If <var>returnValue</var> is an abrupt completion,</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#writable-stream-default-controller-error-if-needed" id="ref-for-writable-stream-default-controller-error-if-needed">WritableStreamDefaultControllerErrorIfNeeded</a>(<var>controller</var>, <var>returnValue</var>.[[Value]]).</p> <li data-md> <p>Return 1.</p> </ol> <li data-md> <p>Return <var>returnValue</var>.[[Value]].</p> </ol> </div> <div class="algorithm" data-algorithm="WritableStreamDefaultControllerGetDesiredSize"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="WritableStreamDefaultControllerGetDesiredSize" id="writable-stream-default-controller-get-desired-size">WritableStreamDefaultControllerGetDesiredSize(<var>controller</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Return <var>controller</var>.<a data-link-type="dfn" href="#writablestreamdefaultcontroller-strategyhwm" id="ref-for-writablestreamdefaultcontroller-strategyhwm①">[[strategyHWM]]</a> − <var>controller</var>.<a data-link-type="dfn" href="#writablestreamdefaultcontroller-queuetotalsize" id="ref-for-writablestreamdefaultcontroller-queuetotalsize">[[queueTotalSize]]</a>.</p> </ol> </div> <div class="algorithm" data-algorithm="WritableStreamDefaultControllerProcessClose"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="WritableStreamDefaultControllerProcessClose" id="writable-stream-default-controller-process-close">WritableStreamDefaultControllerProcessClose(<var>controller</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>stream</var> be <var>controller</var>.<a data-link-type="dfn" href="#writablestreamdefaultcontroller-stream" id="ref-for-writablestreamdefaultcontroller-stream⑥">[[stream]]</a>.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#writable-stream-mark-close-request-in-flight" id="ref-for-writable-stream-mark-close-request-in-flight">WritableStreamMarkCloseRequestInFlight</a>(<var>stream</var>).</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#dequeue-value" id="ref-for-dequeue-value①">DequeueValue</a>(<var>controller</var>).</p> <li data-md> <p class="assertion">Assert: <var>controller</var>.<a data-link-type="dfn" href="#writablestreamdefaultcontroller-queue" id="ref-for-writablestreamdefaultcontroller-queue③">[[queue]]</a> is empty.</p> <li data-md> <p>Let <var>sinkClosePromise</var> be the result of performing <var>controller</var>.<a data-link-type="dfn" href="#writablestreamdefaultcontroller-closealgorithm" id="ref-for-writablestreamdefaultcontroller-closealgorithm②">[[closeAlgorithm]]</a>.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#writable-stream-default-controller-clear-algorithms" id="ref-for-writable-stream-default-controller-clear-algorithms②">WritableStreamDefaultControllerClearAlgorithms</a>(<var>controller</var>).</p> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#upon-fulfillment" id="ref-for-upon-fulfillment⑦">Upon fulfillment</a> of <var>sinkClosePromise</var>,</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#writable-stream-finish-in-flight-close" id="ref-for-writable-stream-finish-in-flight-close">WritableStreamFinishInFlightClose</a>(<var>stream</var>).</p> </ol> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#upon-rejection" id="ref-for-upon-rejection⑨">Upon rejection</a> of <var>sinkClosePromise</var> with reason <var>reason</var>,</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#writable-stream-finish-in-flight-close-with-error" id="ref-for-writable-stream-finish-in-flight-close-with-error">WritableStreamFinishInFlightCloseWithError</a>(<var>stream</var>, <var>reason</var>).</p> </ol> </ol> </div> <div class="algorithm" data-algorithm="WritableStreamDefaultControllerProcessWrite"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="WritableStreamDefaultControllerProcessWrite" id="writable-stream-default-controller-process-write">WritableStreamDefaultControllerProcessWrite(<var>controller</var>, <var>chunk</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>stream</var> be <var>controller</var>.<a data-link-type="dfn" href="#writablestreamdefaultcontroller-stream" id="ref-for-writablestreamdefaultcontroller-stream⑦">[[stream]]</a>.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#writable-stream-mark-first-write-request-in-flight" id="ref-for-writable-stream-mark-first-write-request-in-flight">WritableStreamMarkFirstWriteRequestInFlight</a>(<var>stream</var>).</p> <li data-md> <p>Let <var>sinkWritePromise</var> be the result of performing <var>controller</var>.<a data-link-type="dfn" href="#writablestreamdefaultcontroller-writealgorithm" id="ref-for-writablestreamdefaultcontroller-writealgorithm②">[[writeAlgorithm]]</a>, passing in <var>chunk</var>.</p> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#upon-fulfillment" id="ref-for-upon-fulfillment⑧">Upon fulfillment</a> of <var>sinkWritePromise</var>,</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#writable-stream-finish-in-flight-write" id="ref-for-writable-stream-finish-in-flight-write">WritableStreamFinishInFlightWrite</a>(<var>stream</var>).</p> <li data-md> <p>Let <var>state</var> be <var>stream</var>.<a data-link-type="dfn" href="#writablestream-state" id="ref-for-writablestream-state③③">[[state]]</a>.</p> <li data-md> <p class="assertion">Assert: <var>state</var> is "<code>writable</code>" or "<code>erroring</code>".</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#dequeue-value" id="ref-for-dequeue-value②">DequeueValue</a>(<var>controller</var>).</p> <li data-md> <p>If ! <a data-link-type="abstract-op" href="#writable-stream-close-queued-or-in-flight" id="ref-for-writable-stream-close-queued-or-in-flight①⓪">WritableStreamCloseQueuedOrInFlight</a>(<var>stream</var>) is false and <var>state</var> is "<code>writable</code>",</p> <ol> <li data-md> <p>Let <var>backpressure</var> be ! <a data-link-type="abstract-op" href="#writable-stream-default-controller-get-backpressure" id="ref-for-writable-stream-default-controller-get-backpressure①">WritableStreamDefaultControllerGetBackpressure</a>(<var>controller</var>).</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#writable-stream-update-backpressure" id="ref-for-writable-stream-update-backpressure①">WritableStreamUpdateBackpressure</a>(<var>stream</var>, <var>backpressure</var>).</p> </ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#writable-stream-default-controller-advance-queue-if-needed" id="ref-for-writable-stream-default-controller-advance-queue-if-needed②">WritableStreamDefaultControllerAdvanceQueueIfNeeded</a>(<var>controller</var>).</p> </ol> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#upon-rejection" id="ref-for-upon-rejection①⓪">Upon rejection</a> of <var>sinkWritePromise</var> with <var>reason</var>,</p> <ol> <li data-md> <p>If <var>stream</var>.<a data-link-type="dfn" href="#writablestream-state" id="ref-for-writablestream-state③④">[[state]]</a> is "<code>writable</code>", perform ! <a data-link-type="abstract-op" href="#writable-stream-default-controller-clear-algorithms" id="ref-for-writable-stream-default-controller-clear-algorithms③">WritableStreamDefaultControllerClearAlgorithms</a>(<var>controller</var>).</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#writable-stream-finish-in-flight-write-with-error" id="ref-for-writable-stream-finish-in-flight-write-with-error">WritableStreamFinishInFlightWriteWithError</a>(<var>stream</var>, <var>reason</var>).</p> </ol> </ol> </div> <div class="algorithm" data-algorithm="WritableStreamDefaultControllerWrite"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="WritableStreamDefaultControllerWrite" id="writable-stream-default-controller-write">WritableStreamDefaultControllerWrite(<var>controller</var>, <var>chunk</var>, <var>chunkSize</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>enqueueResult</var> be <a data-link-type="abstract-op" href="#enqueue-value-with-size" id="ref-for-enqueue-value-with-size②">EnqueueValueWithSize</a>(<var>controller</var>, <var>chunk</var>, <var>chunkSize</var>).</p> <li data-md> <p>If <var>enqueueResult</var> is an abrupt completion,</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#writable-stream-default-controller-error-if-needed" id="ref-for-writable-stream-default-controller-error-if-needed①">WritableStreamDefaultControllerErrorIfNeeded</a>(<var>controller</var>, <var>enqueueResult</var>.[[Value]]).</p> <li data-md> <p>Return.</p> </ol> <li data-md> <p>Let <var>stream</var> be <var>controller</var>.<a data-link-type="dfn" href="#writablestreamdefaultcontroller-stream" id="ref-for-writablestreamdefaultcontroller-stream⑧">[[stream]]</a>.</p> <li data-md> <p>If ! <a data-link-type="abstract-op" href="#writable-stream-close-queued-or-in-flight" id="ref-for-writable-stream-close-queued-or-in-flight①①">WritableStreamCloseQueuedOrInFlight</a>(<var>stream</var>) is false and <var>stream</var>.<a data-link-type="dfn" href="#writablestream-state" id="ref-for-writablestream-state③⑤">[[state]]</a> is "<code>writable</code>",</p> <ol> <li data-md> <p>Let <var>backpressure</var> be ! <a data-link-type="abstract-op" href="#writable-stream-default-controller-get-backpressure" id="ref-for-writable-stream-default-controller-get-backpressure②">WritableStreamDefaultControllerGetBackpressure</a>(<var>controller</var>).</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#writable-stream-update-backpressure" id="ref-for-writable-stream-update-backpressure②">WritableStreamUpdateBackpressure</a>(<var>stream</var>, <var>backpressure</var>).</p> </ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#writable-stream-default-controller-advance-queue-if-needed" id="ref-for-writable-stream-default-controller-advance-queue-if-needed③">WritableStreamDefaultControllerAdvanceQueueIfNeeded</a>(<var>controller</var>).</p> </ol> </div> <h2 class="heading settled" data-level="6" id="ts"><span class="secno">6. </span><span class="content">Transform streams</span><a class="self-link" href="#ts"></a></h2> <h3 class="heading settled" data-level="6.1" id="ts-intro"><span class="secno">6.1. </span><span class="content">Using transform streams</span><a class="self-link" href="#ts-intro"></a></h3> <div class="example" id="example-basic-pipe-through"> <a class="self-link" href="#example-basic-pipe-through"></a> The natural way to use a transform stream is to place it in a <a data-link-type="dfn" href="#piping" id="ref-for-piping①⓪">pipe</a> between a <a data-link-type="dfn" href="#readable-stream" id="ref-for-readable-stream①⑤">readable stream</a> and a <a data-link-type="dfn" href="#writable-stream" id="ref-for-writable-stream⑧">writable stream</a>. <a data-link-type="dfn" href="#chunk" id="ref-for-chunk⑥③">Chunks</a> that travel from the <a data-link-type="dfn" href="#readable-stream" id="ref-for-readable-stream①⑥">readable stream</a> to the <a data-link-type="dfn" href="#writable-stream" id="ref-for-writable-stream⑨">writable stream</a> will be transformed as they pass through the transform stream. <a data-link-type="dfn" href="#backpressure" id="ref-for-backpressure①④">Backpressure</a> is respected, so data will not be read faster than it can be transformed and consumed. <pre class="highlight">readableStream <c- p>.</c->pipeThrough<c- p>(</c->transformStream<c- p>)</c-> <c- p>.</c->pipeTo<c- p>(</c->writableStream<c- p>)</c-> <c- p>.</c->then<c- p>(()</c-> <c- p>=></c-> console<c- p>.</c->log<c- p>(</c-><c- u>"All data successfully transformed!"</c-><c- p>))</c-> <c- p>.</c-><c- k>catch</c-><c- p>(</c->e <c- p>=></c-> console<c- p>.</c->error<c- p>(</c-><c- u>"Something went wrong!"</c-><c- p>,</c-> e<c- p>));</c-> </pre> </div> <div class="example" id="example-transform-stream-properties"> <a class="self-link" href="#example-transform-stream-properties"></a> You can also use the <code class="idl"><a data-link-type="idl" href="#ts-readable" id="ref-for-ts-readable">readable</a></code> and <code class="idl"><a data-link-type="idl" href="#ts-writable" id="ref-for-ts-writable">writable</a></code> properties of a transform stream directly to access the usual interfaces of a <a data-link-type="dfn" href="#readable-stream" id="ref-for-readable-stream①⑦">readable stream</a> and <a data-link-type="dfn" href="#writable-stream" id="ref-for-writable-stream①⓪">writable stream</a>. In this example we supply data to the <a data-link-type="dfn" href="#writable-side" id="ref-for-writable-side①">writable side</a> of the stream using its <a data-link-type="dfn" href="#writer" id="ref-for-writer⑤">writer</a> interface. The <a data-link-type="dfn" href="#readable-side" id="ref-for-readable-side①">readable side</a> is then piped to <code>anotherWritableStream</code>. <pre class="highlight"><c- a>const</c-> writer <c- o>=</c-> transformStream<c- p>.</c->writable<c- p>.</c->getWriter<c- p>();</c-> writer<c- p>.</c->write<c- p>(</c-><c- u>"input chunk"</c-><c- p>);</c-> transformStream<c- p>.</c->readable<c- p>.</c->pipeTo<c- p>(</c->anotherWritableStream<c- p>);</c-> </pre> </div> <div class="example" id="example-transform-identity"> <a class="self-link" href="#example-transform-identity"></a> One use of <a data-link-type="dfn" href="#identity-transform-stream" id="ref-for-identity-transform-stream">identity transform streams</a> is to easily convert between readable and writable streams. For example, the <code class="idl"><a data-link-type="idl" href="https://fetch.spec.whatwg.org/#dom-global-fetch" id="ref-for-dom-global-fetch">fetch()</a></code> API accepts a readable stream <a data-link-type="dfn" href="https://fetch.spec.whatwg.org/#concept-request-body" id="ref-for-concept-request-body">request body</a>, but it can be more convenient to write data for uploading via a writable stream interface. Using an identity transform stream addresses this: <pre class="highlight"><c- a>const</c-> <c- p>{</c-> writable<c- p>,</c-> readable <c- p>}</c-> <c- o>=</c-> <c- ow>new</c-> TransformStream<c- p>();</c-> fetch<c- p>(</c-><c- u>"..."</c-><c- p>,</c-> <c- p>{</c-> body<c- o>:</c-> readable <c- p>}).</c->then<c- p>(</c->response <c- p>=></c-> <c- d>/* ... */</c-><c- p>);</c-> <c- a>const</c-> writer <c- o>=</c-> writable<c- p>.</c->getWriter<c- p>();</c-> writer<c- p>.</c->write<c- p>(</c-><c- ow>new</c-> Uint8Array<c- p>([</c-><c- mh>0x73</c-><c- p>,</c-> <c- mh>0x74</c-><c- p>,</c-> <c- mh>0x72</c-><c- p>,</c-> <c- mh>0x65</c-><c- p>,</c-> <c- mh>0x61</c-><c- p>,</c-> <c- mh>0x6D</c-><c- p>,</c-> <c- mh>0x73</c-><c- p>,</c-> <c- mh>0x21</c-><c- p>]));</c-> writer<c- p>.</c->close<c- p>();</c-> </pre> <p>Another use of identity transform streams is to add additional buffering to a <a data-link-type="dfn" href="#readablestream-pipe" id="ref-for-readablestream-pipe①">pipe</a>. In this example we add extra buffering between <code>readableStream</code> and <code>writableStream</code>.</p> <pre class="highlight"><c- a>const</c-> writableStrategy <c- o>=</c-> <c- ow>new</c-> ByteLengthQueuingStrategy<c- p>({</c-> highWaterMark<c- o>:</c-> <c- mf>1024</c-> <c- o>*</c-> <c- mf>1024</c-> <c- p>});</c-> readableStream <c- p>.</c->pipeThrough<c- p>(</c-><c- ow>new</c-> TransformStream<c- p>(</c-><c- kc>undefined</c-><c- p>,</c-> writableStrategy<c- p>))</c-> <c- p>.</c->pipeTo<c- p>(</c->writableStream<c- p>);</c-> </pre> </div> <h3 class="heading settled" data-level="6.2" id="ts-class"><span class="secno">6.2. </span><span class="content">The <code class="idl"><a data-link-type="idl" href="#transformstream" id="ref-for-transformstream③">TransformStream</a></code> class</span><a class="self-link" href="#ts-class"></a></h3> <p>The <code class="idl"><a data-link-type="idl" href="#transformstream" id="ref-for-transformstream④">TransformStream</a></code> class is a concrete instance of the general <a data-link-type="dfn" href="#transform-stream" id="ref-for-transform-stream②">transform stream</a> concept.</p> <h4 class="heading settled" data-level="6.2.1" id="ts-class-definition"><span class="secno">6.2.1. </span><span class="content">Interface definition</span><a class="self-link" href="#ts-class-definition"></a></h4> <p>The Web IDL definition for the <code class="idl"><a data-link-type="idl" href="#transformstream" id="ref-for-transformstream⑤">TransformStream</a></code> class is given as follows:</p> <pre class="idl highlight def">[Exposed=*, <a class="idl-code" data-link-type="extended-attribute" href="https://html.spec.whatwg.org/multipage/structured-data.html#transferable" id="ref-for-transferable②"><c- g>Transferable</c-></a>] <c- b>interface</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="interface" data-export id="transformstream"><code><c- g>TransformStream</c-></code></dfn> { <a class="idl-code" data-link-type="constructor" href="#ts-constructor" id="ref-for-ts-constructor①"><c- g>constructor</c-></a>(<c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-object" id="ref-for-idl-object②"><c- b>object</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="TransformStream/TransformStream(transformer, writableStrategy, readableStrategy), TransformStream/constructor(transformer, writableStrategy, readableStrategy), TransformStream/TransformStream(transformer, writableStrategy), TransformStream/constructor(transformer, writableStrategy), TransformStream/TransformStream(transformer), TransformStream/constructor(transformer), TransformStream/TransformStream(), TransformStream/constructor()" data-dfn-type="argument" data-export id="dom-transformstream-transformstream-transformer-writablestrategy-readablestrategy-transformer"><code><c- g>transformer</c-></code></dfn>, <c- b>optional</c-> <a data-link-type="idl-name" href="#dictdef-queuingstrategy" id="ref-for-dictdef-queuingstrategy②"><c- n>QueuingStrategy</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="TransformStream/TransformStream(transformer, writableStrategy, readableStrategy), TransformStream/constructor(transformer, writableStrategy, readableStrategy), TransformStream/TransformStream(transformer, writableStrategy), TransformStream/constructor(transformer, writableStrategy), TransformStream/TransformStream(transformer), TransformStream/constructor(transformer), TransformStream/TransformStream(), TransformStream/constructor()" data-dfn-type="argument" data-export id="dom-transformstream-transformstream-transformer-writablestrategy-readablestrategy-writablestrategy"><code><c- g>writableStrategy</c-></code></dfn> = {}, <c- b>optional</c-> <a data-link-type="idl-name" href="#dictdef-queuingstrategy" id="ref-for-dictdef-queuingstrategy③"><c- n>QueuingStrategy</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="TransformStream/TransformStream(transformer, writableStrategy, readableStrategy), TransformStream/constructor(transformer, writableStrategy, readableStrategy), TransformStream/TransformStream(transformer, writableStrategy), TransformStream/constructor(transformer, writableStrategy), TransformStream/TransformStream(transformer), TransformStream/constructor(transformer), TransformStream/TransformStream(), TransformStream/constructor()" data-dfn-type="argument" data-export id="dom-transformstream-transformstream-transformer-writablestrategy-readablestrategy-readablestrategy"><code><c- g>readableStrategy</c-></code></dfn> = {}); <c- b>readonly</c-> <c- b>attribute</c-> <a data-link-type="idl-name" href="#readablestream" id="ref-for-readablestream④⑨"><c- n>ReadableStream</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="ReadableStream" href="#ts-readable" id="ref-for-ts-readable①"><c- g>readable</c-></a>; <c- b>readonly</c-> <c- b>attribute</c-> <a data-link-type="idl-name" href="#writablestream" id="ref-for-writablestream③⓪"><c- n>WritableStream</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="WritableStream" href="#ts-writable" id="ref-for-ts-writable①"><c- g>writable</c-></a>; }; </pre> <h4 class="heading settled" data-level="6.2.2" id="ts-internal-slots"><span class="secno">6.2.2. </span><span class="content">Internal slots</span><a class="self-link" href="#ts-internal-slots"></a></h4> <p>Instances of <code class="idl"><a data-link-type="idl" href="#transformstream" id="ref-for-transformstream⑥">TransformStream</a></code> are created with the internal slots described in the following table:</p> <table> <thead> <tr> <th>Internal Slot <th>Description (<em>non-normative</em>) <tbody> <tr> <td><dfn class="dfn-paneled" data-dfn-for="TransformStream" data-dfn-type="dfn" data-noexport id="transformstream-backpressure">[[backpressure]]</dfn> <td class="non-normative">Whether there was backpressure on <a data-link-type="dfn" href="#transformstream-readable" id="ref-for-transformstream-readable">[[readable]]</a> the last time it was observed <tr> <td><dfn class="dfn-paneled" data-dfn-for="TransformStream" data-dfn-type="dfn" data-noexport id="transformstream-backpressurechangepromise">[[backpressureChangePromise]]</dfn> <td class="non-normative">A promise which is fulfilled and replaced every time the value of <a data-link-type="dfn" href="#transformstream-backpressure" id="ref-for-transformstream-backpressure">[[backpressure]]</a> changes <tr> <td><dfn class="dfn-paneled" data-dfn-for="TransformStream" data-dfn-type="dfn" data-noexport id="transformstream-controller">[[controller]]</dfn> <td class="non-normative">A <code class="idl"><a data-link-type="idl" href="#transformstreamdefaultcontroller" id="ref-for-transformstreamdefaultcontroller">TransformStreamDefaultController</a></code> created with the ability to control <a data-link-type="dfn" href="#transformstream-readable" id="ref-for-transformstream-readable①">[[readable]]</a> and <a data-link-type="dfn" href="#transformstream-writable" id="ref-for-transformstream-writable">[[writable]]</a> <tr> <td><dfn class="dfn-paneled" data-dfn-for="TransformStream" data-dfn-type="dfn" data-export id="transformstream-detached">[[Detached]]</dfn> <td class="non-normative">A boolean flag set to true when the stream is transferred <tr> <td><dfn class="dfn-paneled" data-dfn-for="TransformStream" data-dfn-type="dfn" data-noexport id="transformstream-readable">[[readable]]</dfn> <td class="non-normative">The <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream⑤⓪">ReadableStream</a></code> instance controlled by this object <tr> <td><dfn class="dfn-paneled" data-dfn-for="TransformStream" data-dfn-type="dfn" data-noexport id="transformstream-writable">[[writable]]</dfn> <td class="non-normative">The <code class="idl"><a data-link-type="idl" href="#writablestream" id="ref-for-writablestream③①">WritableStream</a></code> instance controlled by this object </table> <h4 class="heading settled" data-level="6.2.3" id="transformer-api"><span class="secno">6.2.3. </span><span class="content">The transformer API</span><a class="self-link" href="#transformer-api"></a></h4> <p>The <code class="idl"><a data-link-type="idl" href="#ts-constructor" id="ref-for-ts-constructor②">TransformStream()</a></code> constructor accepts as its first argument a JavaScript object representing the <a data-link-type="dfn" href="#transformer" id="ref-for-transformer①">transformer</a>. Such objects can contain any of the following methods:</p> <pre class="idl highlight def"><c- b>dictionary</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="dictionary" data-export id="dictdef-transformer"><code><c- g>Transformer</c-></code></dfn> { <a data-link-type="idl-name" href="#callbackdef-transformerstartcallback" id="ref-for-callbackdef-transformerstartcallback"><c- n>TransformerStartCallback</c-></a> <a class="idl-code" data-link-type="dict-member" data-type="TransformerStartCallback" href="#dom-transformer-start" id="ref-for-dom-transformer-start"><c- g>start</c-></a>; <a data-link-type="idl-name" href="#callbackdef-transformertransformcallback" id="ref-for-callbackdef-transformertransformcallback"><c- n>TransformerTransformCallback</c-></a> <a class="idl-code" data-link-type="dict-member" data-type="TransformerTransformCallback" href="#dom-transformer-transform" id="ref-for-dom-transformer-transform①"><c- g>transform</c-></a>; <a data-link-type="idl-name" href="#callbackdef-transformerflushcallback" id="ref-for-callbackdef-transformerflushcallback"><c- n>TransformerFlushCallback</c-></a> <a class="idl-code" data-link-type="dict-member" data-type="TransformerFlushCallback" href="#dom-transformer-flush" id="ref-for-dom-transformer-flush"><c- g>flush</c-></a>; <a data-link-type="idl-name" href="#callbackdef-transformercancelcallback" id="ref-for-callbackdef-transformercancelcallback"><c- n>TransformerCancelCallback</c-></a> <a class="idl-code" data-link-type="dict-member" data-type="TransformerCancelCallback" href="#dom-transformer-cancel" id="ref-for-dom-transformer-cancel"><c- g>cancel</c-></a>; <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any" id="ref-for-idl-any①⑨"><c- b>any</c-></a> <a class="idl-code" data-link-type="dict-member" data-type="any" href="#dom-transformer-readabletype" id="ref-for-dom-transformer-readabletype"><c- g>readableType</c-></a>; <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any" id="ref-for-idl-any②⓪"><c- b>any</c-></a> <a class="idl-code" data-link-type="dict-member" data-type="any" href="#dom-transformer-writabletype" id="ref-for-dom-transformer-writabletype"><c- g>writableType</c-></a>; }; <c- b>callback</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="callback" data-export id="callbackdef-transformerstartcallback"><code><c- g>TransformerStartCallback</c-></code></dfn> = <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any" id="ref-for-idl-any②①"><c- b>any</c-></a> (<a data-link-type="idl-name" href="#transformstreamdefaultcontroller" id="ref-for-transformstreamdefaultcontroller①"><c- n>TransformStreamDefaultController</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="TransformerStartCallback" data-dfn-type="argument" data-export id="dom-transformerstartcallback-controller"><code><c- g>controller</c-></code></dfn>); <c- b>callback</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="callback" data-export id="callbackdef-transformerflushcallback"><code><c- g>TransformerFlushCallback</c-></code></dfn> = <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise" id="ref-for-idl-promise①⑧"><c- b>Promise</c-></a><<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined" id="ref-for-idl-undefined②⑧"><c- b>undefined</c-></a>> (<a data-link-type="idl-name" href="#transformstreamdefaultcontroller" id="ref-for-transformstreamdefaultcontroller②"><c- n>TransformStreamDefaultController</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="TransformerFlushCallback" data-dfn-type="argument" data-export id="dom-transformerflushcallback-controller"><code><c- g>controller</c-></code></dfn>); <c- b>callback</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="callback" data-export id="callbackdef-transformertransformcallback"><code><c- g>TransformerTransformCallback</c-></code></dfn> = <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise" id="ref-for-idl-promise①⑨"><c- b>Promise</c-></a><<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined" id="ref-for-idl-undefined②⑨"><c- b>undefined</c-></a>> (<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any" id="ref-for-idl-any②②"><c- b>any</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="TransformerTransformCallback" data-dfn-type="argument" data-export id="dom-transformertransformcallback-chunk"><code><c- g>chunk</c-></code></dfn>, <a data-link-type="idl-name" href="#transformstreamdefaultcontroller" id="ref-for-transformstreamdefaultcontroller③"><c- n>TransformStreamDefaultController</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="TransformerTransformCallback" data-dfn-type="argument" data-export id="dom-transformertransformcallback-controller"><code><c- g>controller</c-></code></dfn>); <c- b>callback</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="callback" data-export id="callbackdef-transformercancelcallback"><code><c- g>TransformerCancelCallback</c-></code></dfn> = <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise" id="ref-for-idl-promise②⓪"><c- b>Promise</c-></a><<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined" id="ref-for-idl-undefined③⓪"><c- b>undefined</c-></a>> (<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any" id="ref-for-idl-any②③"><c- b>any</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="TransformerCancelCallback" data-dfn-type="argument" data-export id="dom-transformercancelcallback-reason"><code><c- g>reason</c-></code></dfn>); </pre> <dl> <dt><dfn class="dfn-paneled idl-code" data-dfn-for="Transformer" data-dfn-type="dict-member" data-export data-lt="start" id="dom-transformer-start"><code>start(<var>controller</var>)</code></dfn>, <span> of type <a data-link-type="idl-name" href="#callbackdef-transformerstartcallback" id="ref-for-callbackdef-transformerstartcallback①">TransformerStartCallback</a></span> <dd> <p>A function that is called immediately during creation of the <code class="idl"><a data-link-type="idl" href="#transformstream" id="ref-for-transformstream⑦">TransformStream</a></code>. </p> <p>Typically this is used to enqueue prefix <a data-link-type="dfn" href="#chunk" id="ref-for-chunk⑥④">chunks</a>, using <code class="idl"><a data-link-type="idl" href="#ts-default-controller-enqueue" id="ref-for-ts-default-controller-enqueue">controller.enqueue()</a></code>. Those chunks will be read from the <a data-link-type="dfn" href="#readable-side" id="ref-for-readable-side②">readable side</a> but don’t depend on any writes to the <a data-link-type="dfn" href="#writable-side" id="ref-for-writable-side②">writable side</a>. </p> <p>If this initial process is asynchronous, for example because it takes some effort to acquire the prefix chunks, the function can return a promise to signal success or failure; a rejected promise will error the stream. Any thrown exceptions will be re-thrown by the <code class="idl"><a data-link-type="idl" href="#ts-constructor" id="ref-for-ts-constructor③">TransformStream()</a></code> constructor. </p> <dt><dfn class="dfn-paneled idl-code" data-dfn-for="Transformer" data-dfn-type="dict-member" data-export data-lt="transform" id="dom-transformer-transform"><code>transform(<var>chunk</var>, <var>controller</var>)</code></dfn>, <span> of type <a data-link-type="idl-name" href="#callbackdef-transformertransformcallback" id="ref-for-callbackdef-transformertransformcallback①">TransformerTransformCallback</a></span> <dd> <p>A function called when a new <a data-link-type="dfn" href="#chunk" id="ref-for-chunk⑥⑤">chunk</a> originally written to the <a data-link-type="dfn" href="#writable-side" id="ref-for-writable-side③">writable side</a> is ready to be transformed. The stream implementation guarantees that this function will be called only after previous transforms have succeeded, and never before <code class="idl"><a data-link-type="idl" href="#dom-transformer-start" id="ref-for-dom-transformer-start①">start()</a></code> has completed or after <code class="idl"><a data-link-type="idl" href="#dom-transformer-flush" id="ref-for-dom-transformer-flush①">flush()</a></code> has been called. </p> <p>This function performs the actual transformation work of the transform stream. It can enqueue the results using <code class="idl"><a data-link-type="idl" href="#ts-default-controller-enqueue" id="ref-for-ts-default-controller-enqueue①">controller.enqueue()</a></code>. This permits a single chunk written to the writable side to result in zero or multiple chunks on the <a data-link-type="dfn" href="#readable-side" id="ref-for-readable-side③">readable side</a>, depending on how many times <code class="idl"><a data-link-type="idl" href="#ts-default-controller-enqueue" id="ref-for-ts-default-controller-enqueue②">controller.enqueue()</a></code> is called. <a href="#example-ts-lipfuzz">§ 10.9 A transform stream that replaces template tags</a> demonstrates this by sometimes enqueuing zero chunks. </p> <p>If the process of transforming is asynchronous, this function can return a promise to signal success or failure of the transformation. A rejected promise will error both the readable and writable sides of the transform stream. </p> <p>The promise potentially returned by this function is used to ensure that <a href="#write-mutable-chunks">well-behaved</a> <a data-link-type="dfn" href="#producer" id="ref-for-producer①⓪">producers</a> do not attempt to mutate the <a data-link-type="dfn" href="#chunk" id="ref-for-chunk⑥⑥">chunk</a> before it has been fully transformed. (This is not guaranteed by any specification machinery, but instead is an informal contract between <a data-link-type="dfn" href="#producer" id="ref-for-producer①①">producers</a> and the <a data-link-type="dfn" href="#transformer" id="ref-for-transformer②">transformer</a>.) </p> <p>If no <code class="idl"><a data-link-type="idl" href="#dom-transformer-transform" id="ref-for-dom-transformer-transform②">transform()</a></code> method is supplied, the identity transform is used, which enqueues chunks unchanged from the writable side to the readable side. </p> <dt><dfn class="dfn-paneled idl-code" data-dfn-for="Transformer" data-dfn-type="dict-member" data-export data-lt="flush" id="dom-transformer-flush"><code>flush(<var>controller</var>)</code></dfn>, <span> of type <a data-link-type="idl-name" href="#callbackdef-transformerflushcallback" id="ref-for-callbackdef-transformerflushcallback①">TransformerFlushCallback</a></span> <dd> <p>A function called after all <a data-link-type="dfn" href="#chunk" id="ref-for-chunk⑥⑦">chunks</a> written to the <a data-link-type="dfn" href="#writable-side" id="ref-for-writable-side④">writable side</a> have been transformed by successfully passing through <code class="idl"><a data-link-type="idl" href="#dom-transformer-transform" id="ref-for-dom-transformer-transform③">transform()</a></code>, and the writable side is about to be closed. </p> <p>Typically this is used to enqueue suffix chunks to the <a data-link-type="dfn" href="#readable-side" id="ref-for-readable-side④">readable side</a>, before that too becomes closed. An example can be seen in <a href="#example-ts-lipfuzz">§ 10.9 A transform stream that replaces template tags</a>. </p> <p>If the flushing process is asynchronous, the function can return a promise to signal success or failure; the result will be communicated to the caller of <code class="idl"><a data-link-type="idl" href="#default-writer-write" id="ref-for-default-writer-write①⑤">stream.writable.write()</a></code>. Additionally, a rejected promise will error both the readable and writable sides of the stream. Throwing an exception is treated the same as returning a rejected promise. </p> <p>(Note that there is no need to call <code class="idl"><a data-link-type="idl" href="#ts-default-controller-terminate" id="ref-for-ts-default-controller-terminate">controller.terminate()</a></code> inside <code class="idl"><a data-link-type="idl" href="#dom-transformer-flush" id="ref-for-dom-transformer-flush②">flush()</a></code>; the stream is already in the process of successfully closing down, and terminating it would be counterproductive.) </p> <dt><dfn class="dfn-paneled idl-code" data-dfn-for="Transformer" data-dfn-type="dict-member" data-export data-lt="cancel" id="dom-transformer-cancel"><code>cancel(<var>reason</var>)</code></dfn>, <span> of type <a data-link-type="idl-name" href="#callbackdef-transformercancelcallback" id="ref-for-callbackdef-transformercancelcallback①">TransformerCancelCallback</a></span> <dd> <p>A function called when the <a data-link-type="dfn" href="#readable-side" id="ref-for-readable-side⑤">readable side</a> is cancelled, or when the <a data-link-type="dfn" href="#writable-side" id="ref-for-writable-side⑤">writable side</a> is aborted. </p> <p>Typically this is used to clean up underlying transformer resources when the stream is aborted or cancelled. </p> <p>If the cancellation process is asynchronous, the function can return a promise to signal success or failure; the result will be communicated to the caller of <code class="idl"><a data-link-type="idl" href="#ws-abort" id="ref-for-ws-abort⑤">stream.writable.abort()</a></code> or <code class="idl"><a data-link-type="idl" href="#rs-cancel" id="ref-for-rs-cancel⑦">stream.readable.cancel()</a></code>. Throwing an exception is treated the same as returning a rejected promise. </p> <p>(Note that there is no need to call <code class="idl"><a data-link-type="idl" href="#ts-default-controller-terminate" id="ref-for-ts-default-controller-terminate①">controller.terminate()</a></code> inside <code class="idl"><a data-link-type="idl" href="#dom-transformer-cancel" id="ref-for-dom-transformer-cancel①">cancel()</a></code>; the stream is already in the process of cancelling/aborting, and terminating it would be counterproductive.) </p> <dt><dfn class="dfn-paneled idl-code" data-dfn-for="Transformer" data-dfn-type="dict-member" data-export id="dom-transformer-readabletype"><code>readableType</code></dfn>, <span> of type <a data-link-type="idl-name" href="https://webidl.spec.whatwg.org/#idl-any" id="ref-for-idl-any②④">any</a></span> <dd> <p>This property is reserved for future use, so any attempts to supply a value will throw an exception. </p> <dt><dfn class="dfn-paneled idl-code" data-dfn-for="Transformer" data-dfn-type="dict-member" data-export id="dom-transformer-writabletype"><code>writableType</code></dfn>, <span> of type <a data-link-type="idl-name" href="https://webidl.spec.whatwg.org/#idl-any" id="ref-for-idl-any②⑤">any</a></span> <dd> <p>This property is reserved for future use, so any attempts to supply a value will throw an exception. </p> </dl> <p>The <code>controller</code> object passed to <code class="idl"><a data-link-type="idl" href="#dom-transformer-start" id="ref-for-dom-transformer-start②">start()</a></code>, <code class="idl"><a data-link-type="idl" href="#dom-transformer-transform" id="ref-for-dom-transformer-transform④">transform()</a></code>, and <code class="idl"><a data-link-type="idl" href="#dom-transformer-flush" id="ref-for-dom-transformer-flush③">flush()</a></code> is an instance of <code class="idl"><a data-link-type="idl" href="#transformstreamdefaultcontroller" id="ref-for-transformstreamdefaultcontroller④">TransformStreamDefaultController</a></code>, and has the ability to enqueue <a data-link-type="dfn" href="#chunk" id="ref-for-chunk⑥⑧">chunks</a> to the <a data-link-type="dfn" href="#readable-side" id="ref-for-readable-side⑥">readable side</a>, or to terminate or error the stream.</p> <h4 class="heading settled" data-level="6.2.4" id="ts-prototype"><span class="secno">6.2.4. </span><span class="content">Constructor and properties</span><a class="self-link" href="#ts-prototype"></a></h4> <dl class="domintro non-normative"> <dt><code><var>stream</var> = new <code class="idl"><a data-link-type="idl" href="#ts-constructor" id="ref-for-ts-constructor④">TransformStream</a></code>([<var>transformer</var>[, <var>writableStrategy</var>[, <var>readableStrategy</var>]]])</code> <dd> <p>Creates a new <code class="idl"><a data-link-type="idl" href="#transformstream" id="ref-for-transformstream⑧">TransformStream</a></code> wrapping the provided <a data-link-type="dfn" href="#transformer" id="ref-for-transformer③">transformer</a>. See <a href="#transformer-api">§ 6.2.3 The transformer API</a> for more details on the <var>transformer</var> argument. </p> <p>If no <var>transformer</var> argument is supplied, then the result will be an <a data-link-type="dfn" href="#identity-transform-stream" id="ref-for-identity-transform-stream①">identity transform stream</a>. See <a href="#example-transform-identity">this example</a> for some cases where that can be useful. </p> <p>The <var>writableStrategy</var> and <var>readableStrategy</var> arguments are the <a data-link-type="dfn" href="#queuing-strategy" id="ref-for-queuing-strategy⑦">queuing strategy</a> objects for the <a data-link-type="dfn" href="#writable-side" id="ref-for-writable-side⑥">writable</a> and <a data-link-type="dfn" href="#readable-side" id="ref-for-readable-side⑦">readable</a> sides respectively. These are used in the construction of the <code class="idl"><a data-link-type="idl" href="#writablestream" id="ref-for-writablestream③②">WritableStream</a></code> and <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream⑤①">ReadableStream</a></code> objects and can be used to add buffering to a <code class="idl"><a data-link-type="idl" href="#transformstream" id="ref-for-transformstream⑨">TransformStream</a></code>, in order to smooth out variations in the speed of the transformation, or to increase the amount of buffering in a <a data-link-type="dfn" href="#readablestream-pipe" id="ref-for-readablestream-pipe②">pipe</a>. If they are not provided, the default behavior will be the same as a <code class="idl"><a data-link-type="idl" href="#countqueuingstrategy" id="ref-for-countqueuingstrategy③">CountQueuingStrategy</a></code>, with respective <a data-link-type="dfn" href="#high-water-mark" id="ref-for-high-water-mark⑤">high water marks</a> of 1 and 0. </p> <dt><code><var>readable</var> = <var>stream</var>.<code class="idl"><a data-link-type="idl" href="#ts-readable" id="ref-for-ts-readable②">readable</a></code></code> <dd> <p>Returns a <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream⑤②">ReadableStream</a></code> representing the <a data-link-type="dfn" href="#readable-side" id="ref-for-readable-side⑧">readable side</a> of this transform stream. </p> <dt><code><var>writable</var> = <var>stream</var>.<code class="idl"><a data-link-type="idl" href="#ts-writable" id="ref-for-ts-writable②">writable</a></code></code> <dd> <p>Returns a <code class="idl"><a data-link-type="idl" href="#writablestream" id="ref-for-writablestream③③">WritableStream</a></code> representing the <a data-link-type="dfn" href="#writable-side" id="ref-for-writable-side⑦">writable side</a> of this transform stream. </p> </dl> <div class="algorithm" data-algorithm="TransformStream(transformer, writableStrategy, readableStrategy)" data-algorithm-for="TransformStream"> The <dfn class="dfn-paneled idl-code" data-dfn-for="TransformStream" data-dfn-type="constructor" data-export data-lt="TransformStream(transformer, writableStrategy, readableStrategy)|constructor(transformer, writableStrategy, readableStrategy)|TransformStream(transformer, writableStrategy)|constructor(transformer, writableStrategy)|TransformStream(transformer)|constructor(transformer)|TransformStream()|constructor()" id="ts-constructor"><code>new TransformStream(<var>transformer</var>, <var>writableStrategy</var>, <var>readableStrategy</var>)</code></dfn> constructor steps are: <ol> <li data-md> <p>If <var>transformer</var> is missing, set it to null.</p> <li data-md> <p>Let <var>transformerDict</var> be <var>transformer</var>, <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-convert-ecmascript-to-idl-value" id="ref-for-dfn-convert-ecmascript-to-idl-value②">converted to an IDL value</a> of type <code class="idl"><a data-link-type="idl" href="#dictdef-transformer" id="ref-for-dictdef-transformer">Transformer</a></code>.</p> <p class="note" role="note">We cannot declare the <var>transformer</var> argument as having the <code class="idl"><a data-link-type="idl" href="#dictdef-transformer" id="ref-for-dictdef-transformer①">Transformer</a></code> type directly, because doing so would lose the reference to the original object. We need to retain the object so we can <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#invoke-a-callback-function" id="ref-for-invoke-a-callback-function①②">invoke</a> the various methods on it. </p> <li data-md> <p>If <var>transformerDict</var>["<code class="idl"><a data-link-type="idl" href="#dom-transformer-readabletype" id="ref-for-dom-transformer-readabletype①">readableType</a></code>"] <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#map-exists" id="ref-for-map-exists①⑦">exists</a>, throw a <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#exceptiondef-rangeerror" id="ref-for-exceptiondef-rangeerror⑧">RangeError</a></code> exception.</p> <li data-md> <p>If <var>transformerDict</var>["<code class="idl"><a data-link-type="idl" href="#dom-transformer-writabletype" id="ref-for-dom-transformer-writabletype①">writableType</a></code>"] <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#map-exists" id="ref-for-map-exists①⑧">exists</a>, throw a <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#exceptiondef-rangeerror" id="ref-for-exceptiondef-rangeerror⑨">RangeError</a></code> exception.</p> <li data-md> <p>Let <var>readableHighWaterMark</var> be ? <a data-link-type="abstract-op" href="#validate-and-normalize-high-water-mark" id="ref-for-validate-and-normalize-high-water-mark③">ExtractHighWaterMark</a>(<var>readableStrategy</var>, 0).</p> <li data-md> <p>Let <var>readableSizeAlgorithm</var> be ! <a data-link-type="abstract-op" href="#make-size-algorithm-from-size-function" id="ref-for-make-size-algorithm-from-size-function②">ExtractSizeAlgorithm</a>(<var>readableStrategy</var>).</p> <li data-md> <p>Let <var>writableHighWaterMark</var> be ? <a data-link-type="abstract-op" href="#validate-and-normalize-high-water-mark" id="ref-for-validate-and-normalize-high-water-mark④">ExtractHighWaterMark</a>(<var>writableStrategy</var>, 1).</p> <li data-md> <p>Let <var>writableSizeAlgorithm</var> be ! <a data-link-type="abstract-op" href="#make-size-algorithm-from-size-function" id="ref-for-make-size-algorithm-from-size-function③">ExtractSizeAlgorithm</a>(<var>writableStrategy</var>).</p> <li data-md> <p>Let <var>startPromise</var> be <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-new-promise" id="ref-for-a-new-promise①④">a new promise</a>.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#initialize-transform-stream" id="ref-for-initialize-transform-stream">InitializeTransformStream</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this①⓪②">this</a>, <var>startPromise</var>, <var>writableHighWaterMark</var>, <var>writableSizeAlgorithm</var>, <var>readableHighWaterMark</var>, <var>readableSizeAlgorithm</var>).</p> <li data-md> <p>Perform ? <a data-link-type="abstract-op" href="#set-up-transform-stream-default-controller-from-transformer" id="ref-for-set-up-transform-stream-default-controller-from-transformer">SetUpTransformStreamDefaultControllerFromTransformer</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this①⓪③">this</a>, <var>transformer</var>, <var>transformerDict</var>).</p> <li data-md> <p>If <var>transformerDict</var>["<code class="idl"><a data-link-type="idl" href="#dom-transformer-start" id="ref-for-dom-transformer-start③">start</a></code>"] <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#map-exists" id="ref-for-map-exists①⑨">exists</a>, then <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#resolve" id="ref-for-resolve②⑦">resolve</a> <var>startPromise</var> with the result of <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#invoke-a-callback-function" id="ref-for-invoke-a-callback-function①③">invoking</a> <var>transformerDict</var>["<code class="idl"><a data-link-type="idl" href="#dom-transformer-start" id="ref-for-dom-transformer-start④">start</a></code>"] with argument list « <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this①⓪④">this</a>.<a data-link-type="dfn" href="#transformstream-controller" id="ref-for-transformstream-controller">[[controller]]</a> » and <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-callback-this-value" id="ref-for-dfn-callback-this-value①⓪">callback this value</a> <var>transformer</var>.</p> <li data-md> <p>Otherwise, <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#resolve" id="ref-for-resolve②⑧">resolve</a> <var>startPromise</var> with undefined.</p> </ol> </div> <div class="algorithm" data-algorithm="readable" data-algorithm-for="TransformStream"> The <dfn class="dfn-paneled idl-code" data-dfn-for="TransformStream" data-dfn-type="attribute" data-export id="ts-readable"><code>readable</code></dfn> getter steps are: <ol> <li data-md> <p>Return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this①⓪⑤">this</a>.<a data-link-type="dfn" href="#transformstream-readable" id="ref-for-transformstream-readable②">[[readable]]</a>.</p> </ol> </div> <div class="algorithm" data-algorithm="writable" data-algorithm-for="TransformStream"> The <dfn class="dfn-paneled idl-code" data-dfn-for="TransformStream" data-dfn-type="attribute" data-export id="ts-writable"><code>writable</code></dfn> getter steps are: <ol> <li data-md> <p>Return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this①⓪⑥">this</a>.<a data-link-type="dfn" href="#transformstream-writable" id="ref-for-transformstream-writable①">[[writable]]</a>.</p> </ol> </div> <h4 class="heading settled" data-level="6.2.5" id="ts-transfer"><span class="secno">6.2.5. </span><span class="content">Transfer via <code>postMessage()</code></span><a class="self-link" href="#ts-transfer"></a></h4> <dl class="domintro"> <dt><code>destination.postMessage(ts, { transfer: [ts] });</code> <dd> <p>Sends a <code class="idl"><a data-link-type="idl" href="#transformstream" id="ref-for-transformstream①⓪">TransformStream</a></code> to another frame, window, or worker. </p> <p>The transferred stream can be used exactly like the original. Its <a data-link-type="dfn" href="#readable-side" id="ref-for-readable-side⑨">readable</a> and <a data-link-type="dfn" href="#writable-side" id="ref-for-writable-side⑧">writable sides</a> will become locked and no longer directly usable. </p> </dl> <div class="algorithm" data-algorithm="TransformStream transfer steps"> <code class="idl"><a data-link-type="idl" href="#transformstream" id="ref-for-transformstream①①">TransformStream</a></code> objects are <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/structured-data.html#transferable-objects" id="ref-for-transferable-objects③">transferable objects</a>. Their <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/structured-data.html#transfer-steps" id="ref-for-transfer-steps②">transfer steps</a>, given <var>value</var> and <var>dataHolder</var>, are: <ol> <li data-md> <p>Let <var>readable</var> be <var>value</var>.<a data-link-type="dfn" href="#transformstream-readable" id="ref-for-transformstream-readable③">[[readable]]</a>.</p> <li data-md> <p>Let <var>writable</var> be <var>value</var>.<a data-link-type="dfn" href="#transformstream-writable" id="ref-for-transformstream-writable②">[[writable]]</a>.</p> <li data-md> <p>If ! <a data-link-type="abstract-op" href="#is-readable-stream-locked" id="ref-for-is-readable-stream-locked①①">IsReadableStreamLocked</a>(<var>readable</var>) is true, throw a "<code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#datacloneerror" id="ref-for-datacloneerror②">DataCloneError</a></code>" <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#idl-DOMException" id="ref-for-idl-DOMException②">DOMException</a></code>.</p> <li data-md> <p>If ! <a data-link-type="abstract-op" href="#is-writable-stream-locked" id="ref-for-is-writable-stream-locked⑨">IsWritableStreamLocked</a>(<var>writable</var>) is true, throw a "<code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#datacloneerror" id="ref-for-datacloneerror③">DataCloneError</a></code>" <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#idl-DOMException" id="ref-for-idl-DOMException③">DOMException</a></code>.</p> <li data-md> <p>Set <var>dataHolder</var>.[[readable]] to ! <a data-link-type="abstract-op" href="https://html.spec.whatwg.org/multipage/structured-data.html#structuredserializewithtransfer" id="ref-for-structuredserializewithtransfer②">StructuredSerializeWithTransfer</a>(<var>readable</var>, « <var>readable</var> »).</p> <li data-md> <p>Set <var>dataHolder</var>.[[writable]] to ! <a data-link-type="abstract-op" href="https://html.spec.whatwg.org/multipage/structured-data.html#structuredserializewithtransfer" id="ref-for-structuredserializewithtransfer③">StructuredSerializeWithTransfer</a>(<var>writable</var>, « <var>writable</var> »).</p> </ol> </div> <div class="algorithm" data-algorithm="TransformStream transfer-receiving steps"> Their <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/structured-data.html#transfer-receiving-steps" id="ref-for-transfer-receiving-steps②">transfer-receiving steps</a>, given <var>dataHolder</var> and <var>value</var>, are: <ol> <li data-md> <p>Let <var>readableRecord</var> be ! <a data-link-type="abstract-op" href="https://html.spec.whatwg.org/multipage/structured-data.html#structureddeserializewithtransfer" id="ref-for-structureddeserializewithtransfer②">StructuredDeserializeWithTransfer</a>(<var>dataHolder</var>.[[readable]], <a data-link-type="dfn" href="https://tc39.es/ecma262/#current-realm" id="ref-for-current-realm⑧">the current Realm</a>).</p> <li data-md> <p>Let <var>writableRecord</var> be ! <a data-link-type="abstract-op" href="https://html.spec.whatwg.org/multipage/structured-data.html#structureddeserializewithtransfer" id="ref-for-structureddeserializewithtransfer③">StructuredDeserializeWithTransfer</a>(<var>dataHolder</var>.[[writable]], <a data-link-type="dfn" href="https://tc39.es/ecma262/#current-realm" id="ref-for-current-realm⑨">the current Realm</a>).</p> <li data-md> <p>Set <var>value</var>.<a data-link-type="dfn" href="#transformstream-readable" id="ref-for-transformstream-readable④">[[readable]]</a> to <var>readableRecord</var>.[[Deserialized]].</p> <li data-md> <p>Set <var>value</var>.<a data-link-type="dfn" href="#transformstream-writable" id="ref-for-transformstream-writable③">[[writable]]</a> to <var>writableRecord</var>.[[Deserialized]].</p> <li data-md> <p>Set <var>value</var>.<a data-link-type="dfn" href="#transformstream-backpressure" id="ref-for-transformstream-backpressure①">[[backpressure]]</a>, <var>value</var>.<a data-link-type="dfn" href="#transformstream-backpressurechangepromise" id="ref-for-transformstream-backpressurechangepromise">[[backpressureChangePromise]]</a>, and <var>value</var>.<a data-link-type="dfn" href="#transformstream-controller" id="ref-for-transformstream-controller①">[[controller]]</a> to undefined.</p> </ol> <p class="note" role="note">The <a data-link-type="dfn" href="#transformstream-backpressure" id="ref-for-transformstream-backpressure②">[[backpressure]]</a>, <a data-link-type="dfn" href="#transformstream-backpressurechangepromise" id="ref-for-transformstream-backpressurechangepromise①">[[backpressureChangePromise]]</a>, and <a data-link-type="dfn" href="#transformstream-controller" id="ref-for-transformstream-controller②">[[controller]]</a> slots are not used in a transferred <code class="idl"><a data-link-type="idl" href="#transformstream" id="ref-for-transformstream①②">TransformStream</a></code>.</p> </div> <h3 class="heading settled" data-level="6.3" id="ts-default-controller-class"><span class="secno">6.3. </span><span class="content">The <code class="idl"><a data-link-type="idl" href="#transformstreamdefaultcontroller" id="ref-for-transformstreamdefaultcontroller⑤">TransformStreamDefaultController</a></code> class</span><a class="self-link" href="#ts-default-controller-class"></a></h3> <p>The <code class="idl"><a data-link-type="idl" href="#transformstreamdefaultcontroller" id="ref-for-transformstreamdefaultcontroller⑥">TransformStreamDefaultController</a></code> class has methods that allow manipulation of the associated <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream⑤③">ReadableStream</a></code> and <code class="idl"><a data-link-type="idl" href="#writablestream" id="ref-for-writablestream③④">WritableStream</a></code>. When constructing a <code class="idl"><a data-link-type="idl" href="#transformstream" id="ref-for-transformstream①③">TransformStream</a></code>, the <a data-link-type="dfn" href="#transformer" id="ref-for-transformer④">transformer</a> object is given a corresponding <code class="idl"><a data-link-type="idl" href="#transformstreamdefaultcontroller" id="ref-for-transformstreamdefaultcontroller⑦">TransformStreamDefaultController</a></code> instance to manipulate.</p> <h4 class="heading settled" data-level="6.3.1" id="ts-default-controller-class-definition"><span class="secno">6.3.1. </span><span class="content">Interface definition</span><a class="self-link" href="#ts-default-controller-class-definition"></a></h4> <p>The Web IDL definition for the <code class="idl"><a data-link-type="idl" href="#transformstreamdefaultcontroller" id="ref-for-transformstreamdefaultcontroller⑧">TransformStreamDefaultController</a></code> class is given as follows:</p> <pre class="idl highlight def">[Exposed=*] <c- b>interface</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="interface" data-export id="transformstreamdefaultcontroller"><code><c- g>TransformStreamDefaultController</c-></code></dfn> { <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-unrestricted-double" id="ref-for-idl-unrestricted-double④"><c- b>unrestricted</c-> <c- b>double</c-></a>? <a class="idl-code" data-link-type="attribute" data-readonly data-type="unrestricted double?" href="#ts-default-controller-desired-size" id="ref-for-ts-default-controller-desired-size"><c- g>desiredSize</c-></a>; <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined" id="ref-for-idl-undefined③①"><c- b>undefined</c-></a> <a class="idl-code" data-link-type="method" href="#ts-default-controller-enqueue" id="ref-for-ts-default-controller-enqueue③"><c- g>enqueue</c-></a>(<c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any" id="ref-for-idl-any②⑥"><c- b>any</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="TransformStreamDefaultController/enqueue(chunk), TransformStreamDefaultController/enqueue()" data-dfn-type="argument" data-export id="dom-transformstreamdefaultcontroller-enqueue-chunk-chunk"><code><c- g>chunk</c-></code></dfn>); <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined" id="ref-for-idl-undefined③②"><c- b>undefined</c-></a> <a class="idl-code" data-link-type="method" href="#ts-default-controller-error" id="ref-for-ts-default-controller-error"><c- g>error</c-></a>(<c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any" id="ref-for-idl-any②⑦"><c- b>any</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="TransformStreamDefaultController/error(reason), TransformStreamDefaultController/error()" data-dfn-type="argument" data-export id="dom-transformstreamdefaultcontroller-error-reason-reason"><code><c- g>reason</c-></code></dfn>); <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined" id="ref-for-idl-undefined③③"><c- b>undefined</c-></a> <a class="idl-code" data-link-type="method" href="#ts-default-controller-terminate" id="ref-for-ts-default-controller-terminate②"><c- g>terminate</c-></a>(); }; </pre> <h4 class="heading settled" data-level="6.3.2" id="ts-default-controller-internal-slots"><span class="secno">6.3.2. </span><span class="content">Internal slots</span><a class="self-link" href="#ts-default-controller-internal-slots"></a></h4> <p>Instances of <code class="idl"><a data-link-type="idl" href="#transformstreamdefaultcontroller" id="ref-for-transformstreamdefaultcontroller⑨">TransformStreamDefaultController</a></code> are created with the internal slots described in the following table:</p> <table> <thead> <tr> <th>Internal Slot <th>Description (<em>non-normative</em>) <tbody> <tr> <td><dfn class="dfn-paneled" data-dfn-for="TransformStreamDefaultController" data-dfn-type="dfn" data-noexport id="transformstreamdefaultcontroller-cancelalgorithm">[[cancelAlgorithm]]</dfn> <td class="non-normative">A promise-returning algorithm, taking one argument (the reason for cancellation), which communicates a requested cancellation to the <a data-link-type="dfn" href="#transformer" id="ref-for-transformer⑤">transformer</a> <tr> <td><dfn class="dfn-paneled" data-dfn-for="TransformStreamDefaultController" data-dfn-type="dfn" data-noexport id="transformstreamdefaultcontroller-finishpromise">[[finishPromise]]</dfn> <td class="non-normative">A promise which resolves on completion of either the <a data-link-type="dfn" href="#transformstreamdefaultcontroller-cancelalgorithm" id="ref-for-transformstreamdefaultcontroller-cancelalgorithm">[[cancelAlgorithm]]</a> or the <a data-link-type="dfn" href="#transformstreamdefaultcontroller-flushalgorithm" id="ref-for-transformstreamdefaultcontroller-flushalgorithm">[[flushAlgorithm]]</a>. If this field is unpopulated (that is, undefined), then neither of those algorithms have been <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#invoke-a-callback-function" id="ref-for-invoke-a-callback-function①④">invoked</a> yet <tr> <td><dfn class="dfn-paneled" data-dfn-for="TransformStreamDefaultController" data-dfn-type="dfn" data-noexport id="transformstreamdefaultcontroller-flushalgorithm">[[flushAlgorithm]]</dfn> <td class="non-normative">A promise-returning algorithm which communicates a requested close to the <a data-link-type="dfn" href="#transformer" id="ref-for-transformer⑥">transformer</a> <tr> <td><dfn class="dfn-paneled" data-dfn-for="TransformStreamDefaultController" data-dfn-type="dfn" data-noexport id="transformstreamdefaultcontroller-stream">[[stream]]</dfn> <td class="non-normative">The <code class="idl"><a data-link-type="idl" href="#transformstream" id="ref-for-transformstream①④">TransformStream</a></code> instance controlled <tr> <td><dfn class="dfn-paneled" data-dfn-for="TransformStreamDefaultController" data-dfn-type="dfn" data-noexport id="transformstreamdefaultcontroller-transformalgorithm">[[transformAlgorithm]]</dfn> <td class="non-normative">A promise-returning algorithm, taking one argument (the <a data-link-type="dfn" href="#chunk" id="ref-for-chunk⑥⑨">chunk</a> to transform), which requests the <a data-link-type="dfn" href="#transformer" id="ref-for-transformer⑦">transformer</a> perform its transformation </table> <h4 class="heading settled" data-level="6.3.3" id="ts-default-controller-prototype"><span class="secno">6.3.3. </span><span class="content">Methods and properties</span><a class="self-link" href="#ts-default-controller-prototype"></a></h4> <dl class="domintro non-normative"> <dt><code><var>desiredSize</var> = <var>controller</var>.<code class="idl"><a data-link-type="idl" href="#ts-default-controller-desired-size" id="ref-for-ts-default-controller-desired-size①">desiredSize</a></code></code> <dd> <p>Returns the <a data-link-type="dfn" href="#desired-size-to-fill-a-streams-internal-queue" id="ref-for-desired-size-to-fill-a-streams-internal-queue⑨">desired size to fill the readable side’s internal queue</a>. It can be negative, if the queue is over-full. </p> <dt><code><var>controller</var>.<code class="idl"><a data-link-type="idl" href="#ts-default-controller-enqueue" id="ref-for-ts-default-controller-enqueue④">enqueue</a></code>(<var>chunk</var>)</code> <dd> <p>Enqueues the given <a data-link-type="dfn" href="#chunk" id="ref-for-chunk⑦⓪">chunk</a> <var>chunk</var> in the <a data-link-type="dfn" href="#readable-side" id="ref-for-readable-side①⓪">readable side</a> of the controlled transform stream. </p> <dt><code><var>controller</var>.<code class="idl"><a data-link-type="idl" href="#ts-default-controller-error" id="ref-for-ts-default-controller-error①">error</a></code>(<var>e</var>)</code> <dd> <p>Errors both the <a data-link-type="dfn" href="#readable-side" id="ref-for-readable-side①①">readable side</a> and the <a data-link-type="dfn" href="#writable-side" id="ref-for-writable-side⑨">writable side</a> of the controlled transform stream, making all future interactions with it fail with the given error <var>e</var>. Any <a data-link-type="dfn" href="#chunk" id="ref-for-chunk⑦①">chunks</a> queued for transformation will be discarded. </p> <dt><code><var>controller</var>.<code class="idl"><a data-link-type="idl" href="#ts-default-controller-terminate" id="ref-for-ts-default-controller-terminate③">terminate</a></code>()</code> <dd> <p>Closes the <a data-link-type="dfn" href="#readable-side" id="ref-for-readable-side①②">readable side</a> and errors the <a data-link-type="dfn" href="#writable-side" id="ref-for-writable-side①⓪">writable side</a> of the controlled transform stream. This is useful when the <a data-link-type="dfn" href="#transformer" id="ref-for-transformer⑧">transformer</a> only needs to consume a portion of the <a data-link-type="dfn" href="#chunk" id="ref-for-chunk⑦②">chunks</a> written to the <a data-link-type="dfn" href="#writable-side" id="ref-for-writable-side①①">writable side</a>. </p> </dl> <div class="algorithm" data-algorithm="desiredSize" data-algorithm-for="TransformStreamDefaultController"> The <dfn class="dfn-paneled idl-code" data-dfn-for="TransformStreamDefaultController" data-dfn-type="attribute" data-export id="ts-default-controller-desired-size"><code>desiredSize</code></dfn> getter steps are: <ol> <li data-md> <p>Let <var>readableController</var> be <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this①⓪⑦">this</a>.<a data-link-type="dfn" href="#transformstreamdefaultcontroller-stream" id="ref-for-transformstreamdefaultcontroller-stream">[[stream]]</a>.<a data-link-type="dfn" href="#transformstream-readable" id="ref-for-transformstream-readable⑤">[[readable]]</a>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller④⑥">[[controller]]</a>.</p> <li data-md> <p>Return ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-get-desired-size" id="ref-for-readable-stream-default-controller-get-desired-size②">ReadableStreamDefaultControllerGetDesiredSize</a>(<var>readableController</var>).</p> </ol> </div> <div class="algorithm" data-algorithm="enqueue(chunk)" data-algorithm-for="TransformStreamDefaultController"> The <dfn class="dfn-paneled idl-code" data-dfn-for="TransformStreamDefaultController" data-dfn-type="method" data-export data-lt="enqueue(chunk)|enqueue()" id="ts-default-controller-enqueue"><code>enqueue(<var>chunk</var>)</code></dfn> method steps are: <ol> <li data-md> <p>Perform ? <a data-link-type="abstract-op" href="#transform-stream-default-controller-enqueue" id="ref-for-transform-stream-default-controller-enqueue">TransformStreamDefaultControllerEnqueue</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this①⓪⑧">this</a>, <var>chunk</var>).</p> </ol> </div> <div class="algorithm" data-algorithm="error(e)" data-algorithm-for="TransformStreamDefaultController"> The <dfn class="dfn-paneled idl-code" data-dfn-for="TransformStreamDefaultController" data-dfn-type="method" data-export data-lt="error(reason)|error()|error(e)" id="ts-default-controller-error"><code>error(<var>e</var>)</code></dfn> method steps are: <ol> <li data-md> <p>Perform ? <a data-link-type="abstract-op" href="#transform-stream-default-controller-error" id="ref-for-transform-stream-default-controller-error">TransformStreamDefaultControllerError</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this①⓪⑨">this</a>, <var>e</var>).</p> </ol> </div> <div class="algorithm" data-algorithm="terminate()" data-algorithm-for="TransformStreamDefaultController"> The <dfn class="dfn-paneled idl-code" data-dfn-for="TransformStreamDefaultController" data-dfn-type="method" data-export id="ts-default-controller-terminate"><code>terminate()</code></dfn> method steps are: <ol> <li data-md> <p>Perform ? <a data-link-type="abstract-op" href="#transform-stream-default-controller-terminate" id="ref-for-transform-stream-default-controller-terminate">TransformStreamDefaultControllerTerminate</a>(<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this①①⓪">this</a>).</p> </ol> </div> <h3 class="heading settled" data-level="6.4" id="ts-all-abstract-ops"><span class="secno">6.4. </span><span class="content">Abstract operations</span><a class="self-link" href="#ts-all-abstract-ops"></a></h3> <h4 class="heading settled" data-level="6.4.1" id="ts-abstract-ops"><span class="secno">6.4.1. </span><span class="content">Working with transform streams</span><a class="self-link" href="#ts-abstract-ops"></a></h4> <p>The following abstract operations operate on <code class="idl"><a data-link-type="idl" href="#transformstream" id="ref-for-transformstream①⑤">TransformStream</a></code> instances at a higher level.</p> <div class="algorithm" data-algorithm="InitializeTransformStream"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="InitializeTransformStream" id="initialize-transform-stream">InitializeTransformStream(<var>stream</var>, <var>startPromise</var>, <var>writableHighWaterMark</var>, <var>writableSizeAlgorithm</var>, <var>readableHighWaterMark</var>, <var>readableSizeAlgorithm</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>startAlgorithm</var> be an algorithm that returns <var>startPromise</var>.</p> <li data-md> <p>Let <var>writeAlgorithm</var> be the following steps, taking a <var>chunk</var> argument:</p> <ol> <li data-md> <p>Return ! <a data-link-type="abstract-op" href="#transform-stream-default-sink-write-algorithm" id="ref-for-transform-stream-default-sink-write-algorithm">TransformStreamDefaultSinkWriteAlgorithm</a>(<var>stream</var>, <var>chunk</var>).</p> </ol> <li data-md> <p>Let <var>abortAlgorithm</var> be the following steps, taking a <var>reason</var> argument:</p> <ol> <li data-md> <p>Return ! <a data-link-type="abstract-op" href="#transform-stream-default-sink-abort-algorithm" id="ref-for-transform-stream-default-sink-abort-algorithm">TransformStreamDefaultSinkAbortAlgorithm</a>(<var>stream</var>, <var>reason</var>).</p> </ol> <li data-md> <p>Let <var>closeAlgorithm</var> be the following steps:</p> <ol> <li data-md> <p>Return ! <a data-link-type="abstract-op" href="#transform-stream-default-sink-close-algorithm" id="ref-for-transform-stream-default-sink-close-algorithm">TransformStreamDefaultSinkCloseAlgorithm</a>(<var>stream</var>).</p> </ol> <li data-md> <p>Set <var>stream</var>.<a data-link-type="dfn" href="#transformstream-writable" id="ref-for-transformstream-writable④">[[writable]]</a> to ! <a data-link-type="abstract-op" href="#create-writable-stream" id="ref-for-create-writable-stream">CreateWritableStream</a>(<var>startAlgorithm</var>, <var>writeAlgorithm</var>, <var>closeAlgorithm</var>, <var>abortAlgorithm</var>, <var>writableHighWaterMark</var>, <var>writableSizeAlgorithm</var>).</p> <li data-md> <p>Let <var>pullAlgorithm</var> be the following steps:</p> <ol> <li data-md> <p>Return ! <a data-link-type="abstract-op" href="#transform-stream-default-source-pull" id="ref-for-transform-stream-default-source-pull">TransformStreamDefaultSourcePullAlgorithm</a>(<var>stream</var>).</p> </ol> <li data-md> <p>Let <var>cancelAlgorithm</var> be the following steps, taking a <var>reason</var> argument:</p> <ol> <li data-md> <p>Return ! <a data-link-type="abstract-op" href="#transform-stream-default-source-cancel" id="ref-for-transform-stream-default-source-cancel">TransformStreamDefaultSourceCancelAlgorithm</a>(<var>stream</var>, <var>reason</var>).</p> </ol> <li data-md> <p>Set <var>stream</var>.<a data-link-type="dfn" href="#transformstream-readable" id="ref-for-transformstream-readable⑥">[[readable]]</a> to ! <a data-link-type="abstract-op" href="#create-readable-stream" id="ref-for-create-readable-stream③">CreateReadableStream</a>(<var>startAlgorithm</var>, <var>pullAlgorithm</var>, <var>cancelAlgorithm</var>, <var>readableHighWaterMark</var>, <var>readableSizeAlgorithm</var>).</p> <li data-md> <p>Set <var>stream</var>.<a data-link-type="dfn" href="#transformstream-backpressure" id="ref-for-transformstream-backpressure③">[[backpressure]]</a> and <var>stream</var>.<a data-link-type="dfn" href="#transformstream-backpressurechangepromise" id="ref-for-transformstream-backpressurechangepromise②">[[backpressureChangePromise]]</a> to undefined.</p> <p class="note" role="note">The <a data-link-type="dfn" href="#transformstream-backpressure" id="ref-for-transformstream-backpressure④">[[backpressure]]</a> slot is set to undefined so that it can be initialized by <a data-link-type="abstract-op" href="#transform-stream-set-backpressure" id="ref-for-transform-stream-set-backpressure">TransformStreamSetBackpressure</a>. Alternatively, implementations can use a strictly boolean value for <a data-link-type="dfn" href="#transformstream-backpressure" id="ref-for-transformstream-backpressure⑤">[[backpressure]]</a> and change the way it is initialized. This will not be visible to user code so long as the initialization is correctly completed before the transformer’s <code class="idl"><a data-link-type="idl" href="#dom-transformer-start" id="ref-for-dom-transformer-start⑤">start()</a></code> method is called. </p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#transform-stream-set-backpressure" id="ref-for-transform-stream-set-backpressure①">TransformStreamSetBackpressure</a>(<var>stream</var>, true).</p> <li data-md> <p>Set <var>stream</var>.<a data-link-type="dfn" href="#transformstream-controller" id="ref-for-transformstream-controller③">[[controller]]</a> to undefined.</p> </ol> </div> <div class="algorithm" data-algorithm="TransformStreamError"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="TransformStreamError" id="transform-stream-error">TransformStreamError(<var>stream</var>, <var>e</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-error" id="ref-for-readable-stream-default-controller-error⑨">ReadableStreamDefaultControllerError</a>(<var>stream</var>.<a data-link-type="dfn" href="#transformstream-readable" id="ref-for-transformstream-readable⑦">[[readable]]</a>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller④⑦">[[controller]]</a>, <var>e</var>).</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#transform-stream-error-writable-and-unblock-write" id="ref-for-transform-stream-error-writable-and-unblock-write">TransformStreamErrorWritableAndUnblockWrite</a>(<var>stream</var>, <var>e</var>).</p> </ol> <p class="note" role="note">This operation works correctly when one or both sides are already errored. As a result, calling algorithms do not need to check stream states when responding to an error condition. </p> </div> <div class="algorithm" data-algorithm="TransformStreamErrorWritableAndUnblockWrite"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="TransformStreamErrorWritableAndUnblockWrite" id="transform-stream-error-writable-and-unblock-write">TransformStreamErrorWritableAndUnblockWrite(<var>stream</var>, <var>e</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#transform-stream-default-controller-clear-algorithms" id="ref-for-transform-stream-default-controller-clear-algorithms">TransformStreamDefaultControllerClearAlgorithms</a>(<var>stream</var>.<a data-link-type="dfn" href="#transformstream-controller" id="ref-for-transformstream-controller④">[[controller]]</a>).</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#writable-stream-default-controller-error-if-needed" id="ref-for-writable-stream-default-controller-error-if-needed②">WritableStreamDefaultControllerErrorIfNeeded</a>(<var>stream</var>.<a data-link-type="dfn" href="#transformstream-writable" id="ref-for-transformstream-writable⑤">[[writable]]</a>.<a data-link-type="dfn" href="#writablestream-controller" id="ref-for-writablestream-controller①⓪">[[controller]]</a>, <var>e</var>).</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#transform-stream-unblock-write" id="ref-for-transform-stream-unblock-write">TransformStreamUnblockWrite</a>(<var>stream</var>).</p> </ol> </div> <div class="algorithm" data-algorithm="TransformStreamSetBackpressure"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="TransformStreamSetBackpressure" id="transform-stream-set-backpressure">TransformStreamSetBackpressure(<var>stream</var>, <var>backpressure</var>)</dfn> performs the following steps: <ol> <li data-md> <p class="assertion">Assert: <var>stream</var>.<a data-link-type="dfn" href="#transformstream-backpressure" id="ref-for-transformstream-backpressure⑥">[[backpressure]]</a> is not <var>backpressure</var>.</p> <li data-md> <p>If <var>stream</var>.<a data-link-type="dfn" href="#transformstream-backpressurechangepromise" id="ref-for-transformstream-backpressurechangepromise③">[[backpressureChangePromise]]</a> is not undefined, <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#resolve" id="ref-for-resolve②⑨">resolve</a> stream.<a data-link-type="dfn" href="#transformstream-backpressurechangepromise" id="ref-for-transformstream-backpressurechangepromise④">[[backpressureChangePromise]]</a> with undefined.</p> <li data-md> <p>Set <var>stream</var>.<a data-link-type="dfn" href="#transformstream-backpressurechangepromise" id="ref-for-transformstream-backpressurechangepromise⑤">[[backpressureChangePromise]]</a> to <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-new-promise" id="ref-for-a-new-promise①⑤">a new promise</a>.</p> <li data-md> <p>Set <var>stream</var>.<a data-link-type="dfn" href="#transformstream-backpressure" id="ref-for-transformstream-backpressure⑦">[[backpressure]]</a> to <var>backpressure</var>.</p> </ol> </div> <div class="algorithm" data-algorithm="TransformStreamUnblockWrite"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="TransformStreamUnblockWrite" id="transform-stream-unblock-write">TransformStreamUnblockWrite(<var>stream</var>)</dfn> performs the following steps: <ol> <li data-md> <p>If <var>stream</var>.<a data-link-type="dfn" href="#transformstream-backpressure" id="ref-for-transformstream-backpressure⑧">[[backpressure]]</a> is true, perform ! <a data-link-type="abstract-op" href="#transform-stream-set-backpressure" id="ref-for-transform-stream-set-backpressure②">TransformStreamSetBackpressure</a>(<var>stream</var>, false).</p> </ol> <p class="note" role="note">The <a data-link-type="abstract-op" href="#transform-stream-default-sink-write-algorithm" id="ref-for-transform-stream-default-sink-write-algorithm①">TransformStreamDefaultSinkWriteAlgorithm</a> abstract operation could be waiting for the promise stored in the <a data-link-type="dfn" href="#transformstream-backpressurechangepromise" id="ref-for-transformstream-backpressurechangepromise⑥">[[backpressureChangePromise]]</a> slot to resolve. The call to <a data-link-type="abstract-op" href="#transform-stream-set-backpressure" id="ref-for-transform-stream-set-backpressure③">TransformStreamSetBackpressure</a> ensures that the promise always resolves. </p> </div> <h4 class="heading settled" data-level="6.4.2" id="ts-default-controller-abstract-ops"><span class="secno">6.4.2. </span><span class="content">Default controllers</span><a class="self-link" href="#ts-default-controller-abstract-ops"></a></h4> <p>The following abstract operations support the implementaiton of the <code class="idl"><a data-link-type="idl" href="#transformstreamdefaultcontroller" id="ref-for-transformstreamdefaultcontroller①⓪">TransformStreamDefaultController</a></code> class.</p> <div class="algorithm" data-algorithm="SetUpTransformStreamDefaultController"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="SetUpTransformStreamDefaultController" id="set-up-transform-stream-default-controller">SetUpTransformStreamDefaultController(<var>stream</var>, <var>controller</var>, <var>transformAlgorithm</var>, <var>flushAlgorithm</var>, <var>cancelAlgorithm</var>)</dfn> performs the following steps: <ol> <li data-md> <p class="assertion">Assert: <var>stream</var> <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#implements" id="ref-for-implements②③">implements</a> <code class="idl"><a data-link-type="idl" href="#transformstream" id="ref-for-transformstream①⑥">TransformStream</a></code>.</p> <li data-md> <p class="assertion">Assert: <var>stream</var>.<a data-link-type="dfn" href="#transformstream-controller" id="ref-for-transformstream-controller⑤">[[controller]]</a> is undefined.</p> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#transformstreamdefaultcontroller-stream" id="ref-for-transformstreamdefaultcontroller-stream①">[[stream]]</a> to <var>stream</var>.</p> <li data-md> <p>Set <var>stream</var>.<a data-link-type="dfn" href="#transformstream-controller" id="ref-for-transformstream-controller⑥">[[controller]]</a> to <var>controller</var>.</p> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#transformstreamdefaultcontroller-transformalgorithm" id="ref-for-transformstreamdefaultcontroller-transformalgorithm">[[transformAlgorithm]]</a> to <var>transformAlgorithm</var>.</p> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#transformstreamdefaultcontroller-flushalgorithm" id="ref-for-transformstreamdefaultcontroller-flushalgorithm①">[[flushAlgorithm]]</a> to <var>flushAlgorithm</var>.</p> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#transformstreamdefaultcontroller-cancelalgorithm" id="ref-for-transformstreamdefaultcontroller-cancelalgorithm①">[[cancelAlgorithm]]</a> to <var>cancelAlgorithm</var>.</p> </ol> </div> <div class="algorithm" data-algorithm="SetUpTransformStreamDefaultControllerFromTransformer"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="SetUpTransformStreamDefaultControllerFromTransformer" id="set-up-transform-stream-default-controller-from-transformer">SetUpTransformStreamDefaultControllerFromTransformer(<var>stream</var>, <var>transformer</var>, <var>transformerDict</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>controller</var> be a <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#new" id="ref-for-new①⑨">new</a> <code class="idl"><a data-link-type="idl" href="#transformstreamdefaultcontroller" id="ref-for-transformstreamdefaultcontroller①①">TransformStreamDefaultController</a></code>.</p> <li data-md> <p>Let <var>transformAlgorithm</var> be the following steps, taking a <var>chunk</var> argument:</p> <ol> <li data-md> <p>Let <var>result</var> be <a data-link-type="abstract-op" href="#transform-stream-default-controller-enqueue" id="ref-for-transform-stream-default-controller-enqueue①">TransformStreamDefaultControllerEnqueue</a>(<var>controller</var>, <var>chunk</var>).</p> <li data-md> <p>If <var>result</var> is an abrupt completion, return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-rejected-with" id="ref-for-a-promise-rejected-with③⑥">a promise rejected with</a> <var>result</var>.[[Value]].</p> <li data-md> <p>Otherwise, return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-resolved-with" id="ref-for-a-promise-resolved-with③⓪">a promise resolved with</a> undefined.</p> </ol> <li data-md> <p>Let <var>flushAlgorithm</var> be an algorithm which returns <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-resolved-with" id="ref-for-a-promise-resolved-with③①">a promise resolved with</a> undefined.</p> <li data-md> <p>Let <var>cancelAlgorithm</var> be an algorithm which returns <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-resolved-with" id="ref-for-a-promise-resolved-with③②">a promise resolved with</a> undefined.</p> <li data-md> <p>If <var>transformerDict</var>["<code class="idl"><a data-link-type="idl" href="#dom-transformer-transform" id="ref-for-dom-transformer-transform⑤">transform</a></code>"] <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#map-exists" id="ref-for-map-exists②⓪">exists</a>, set <var>transformAlgorithm</var> to an algorithm which takes an argument <var>chunk</var> and returns the result of <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#invoke-a-callback-function" id="ref-for-invoke-a-callback-function①⑤">invoking</a> <var>transformerDict</var>["<code class="idl"><a data-link-type="idl" href="#dom-transformer-transform" id="ref-for-dom-transformer-transform⑥">transform</a></code>"] with argument list « <var>chunk</var>, <var>controller</var> » and <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-callback-this-value" id="ref-for-dfn-callback-this-value①①">callback this value</a> <var>transformer</var>.</p> <li data-md> <p>If <var>transformerDict</var>["<code class="idl"><a data-link-type="idl" href="#dom-transformer-flush" id="ref-for-dom-transformer-flush④">flush</a></code>"] <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#map-exists" id="ref-for-map-exists②①">exists</a>, set <var>flushAlgorithm</var> to an algorithm which returns the result of <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#invoke-a-callback-function" id="ref-for-invoke-a-callback-function①⑥">invoking</a> <var>transformerDict</var>["<code class="idl"><a data-link-type="idl" href="#dom-transformer-flush" id="ref-for-dom-transformer-flush⑤">flush</a></code>"] with argument list « <var>controller</var> » and <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-callback-this-value" id="ref-for-dfn-callback-this-value①②">callback this value</a> <var>transformer</var>.</p> <li data-md> <p>If <var>transformerDict</var>["<code class="idl"><a data-link-type="idl" href="#dom-transformer-cancel" id="ref-for-dom-transformer-cancel②">cancel</a></code>"] <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#map-exists" id="ref-for-map-exists②②">exists</a>, set <var>cancelAlgorithm</var> to an algorithm which takes an argument <var>reason</var> and returns the result of <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#invoke-a-callback-function" id="ref-for-invoke-a-callback-function①⑦">invoking</a> <var>transformerDict</var>["<code class="idl"><a data-link-type="idl" href="#dom-transformer-cancel" id="ref-for-dom-transformer-cancel③">cancel</a></code>"] with argument list « <var>reason</var> » and <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-callback-this-value" id="ref-for-dfn-callback-this-value①③">callback this value</a> <var>transformer</var>.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#set-up-transform-stream-default-controller" id="ref-for-set-up-transform-stream-default-controller">SetUpTransformStreamDefaultController</a>(<var>stream</var>, <var>controller</var>, <var>transformAlgorithm</var>, <var>flushAlgorithm</var>, <var>cancelAlgorithm</var>).</p> </ol> </div> <div class="algorithm" data-algorithm="TransformStreamDefaultControllerClearAlgorithms"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="TransformStreamDefaultControllerClearAlgorithms" id="transform-stream-default-controller-clear-algorithms">TransformStreamDefaultControllerClearAlgorithms(<var>controller</var>)</dfn> is called once the stream is closed or errored and the algorithms will not be executed any more. By removing the algorithm references it permits the <a data-link-type="dfn" href="#transformer" id="ref-for-transformer⑨">transformer</a> object to be garbage collected even if the <code class="idl"><a data-link-type="idl" href="#transformstream" id="ref-for-transformstream①⑦">TransformStream</a></code> itself is still referenced. <p class="note" role="note">This is observable using <a href="https://github.com/tc39/proposal-weakrefs/">weak references</a>. See <a href="https://github.com/tc39/proposal-weakrefs/issues/31">tc39/proposal-weakrefs#31</a> for more detail. </p> <p>It performs the following steps:</p> <ol> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#transformstreamdefaultcontroller-transformalgorithm" id="ref-for-transformstreamdefaultcontroller-transformalgorithm①">[[transformAlgorithm]]</a> to undefined.</p> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#transformstreamdefaultcontroller-flushalgorithm" id="ref-for-transformstreamdefaultcontroller-flushalgorithm②">[[flushAlgorithm]]</a> to undefined.</p> <li data-md> <p>Set <var>controller</var>.<a data-link-type="dfn" href="#transformstreamdefaultcontroller-cancelalgorithm" id="ref-for-transformstreamdefaultcontroller-cancelalgorithm②">[[cancelAlgorithm]]</a> to undefined.</p> </ol> </div> <div class="algorithm" data-algorithm="TransformStreamDefaultControllerEnqueue"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="TransformStreamDefaultControllerEnqueue" id="transform-stream-default-controller-enqueue">TransformStreamDefaultControllerEnqueue(<var>controller</var>, <var>chunk</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>stream</var> be <var>controller</var>.<a data-link-type="dfn" href="#transformstreamdefaultcontroller-stream" id="ref-for-transformstreamdefaultcontroller-stream②">[[stream]]</a>.</p> <li data-md> <p>Let <var>readableController</var> be <var>stream</var>.<a data-link-type="dfn" href="#transformstream-readable" id="ref-for-transformstream-readable⑧">[[readable]]</a>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller④⑧">[[controller]]</a>.</p> <li data-md> <p>If ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-can-close-or-enqueue" id="ref-for-readable-stream-default-controller-can-close-or-enqueue⑤">ReadableStreamDefaultControllerCanCloseOrEnqueue</a>(<var>readableController</var>) is false, throw a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror⑥③">TypeError</a></code> exception.</p> <li data-md> <p>Let <var>enqueueResult</var> be <a data-link-type="abstract-op" href="#readable-stream-default-controller-enqueue" id="ref-for-readable-stream-default-controller-enqueue④">ReadableStreamDefaultControllerEnqueue</a>(<var>readableController</var>, <var>chunk</var>).</p> <li data-md> <p>If <var>enqueueResult</var> is an abrupt completion,</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#transform-stream-error-writable-and-unblock-write" id="ref-for-transform-stream-error-writable-and-unblock-write①">TransformStreamErrorWritableAndUnblockWrite</a>(<var>stream</var>, <var>enqueueResult</var>.[[Value]]).</p> <li data-md> <p>Throw <var>stream</var>.<a data-link-type="dfn" href="#transformstream-readable" id="ref-for-transformstream-readable⑨">[[readable]]</a>.<a data-link-type="dfn" href="#readablestream-storederror" id="ref-for-readablestream-storederror⑨">[[storedError]]</a>.</p> </ol> <li data-md> <p>Let <var>backpressure</var> be ! <a data-link-type="abstract-op" href="#rs-default-controller-has-backpressure" id="ref-for-rs-default-controller-has-backpressure">ReadableStreamDefaultControllerHasBackpressure</a>(<var>readableController</var>).</p> <li data-md> <p>If <var>backpressure</var> is not <var>stream</var>.<a data-link-type="dfn" href="#transformstream-backpressure" id="ref-for-transformstream-backpressure⑨">[[backpressure]]</a>,</p> <ol> <li data-md> <p class="assertion">Assert: <var>backpressure</var> is true.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#transform-stream-set-backpressure" id="ref-for-transform-stream-set-backpressure④">TransformStreamSetBackpressure</a>(<var>stream</var>, true).</p> </ol> </ol> </div> <div class="algorithm" data-algorithm="TransformStreamDefaultControllerError"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="TransformStreamDefaultControllerError" id="transform-stream-default-controller-error">TransformStreamDefaultControllerError(<var>controller</var>, <var>e</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#transform-stream-error" id="ref-for-transform-stream-error">TransformStreamError</a>(<var>controller</var>.<a data-link-type="dfn" href="#transformstreamdefaultcontroller-stream" id="ref-for-transformstreamdefaultcontroller-stream③">[[stream]]</a>, <var>e</var>).</p> </ol> </div> <div class="algorithm" data-algorithm="TransformStreamDefaultControllerPerformTransform"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="TransformStreamDefaultControllerPerformTransform" id="transform-stream-default-controller-perform-transform">TransformStreamDefaultControllerPerformTransform(<var>controller</var>, <var>chunk</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>transformPromise</var> be the result of performing <var>controller</var>.<a data-link-type="dfn" href="#transformstreamdefaultcontroller-transformalgorithm" id="ref-for-transformstreamdefaultcontroller-transformalgorithm②">[[transformAlgorithm]]</a>, passing <var>chunk</var>.</p> <li data-md> <p>Return the result of <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-perform-steps-once-promise-is-settled" id="ref-for-dfn-perform-steps-once-promise-is-settled③">reacting</a> to <var>transformPromise</var> with the following rejection steps given the argument <var>r</var>:</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#transform-stream-error" id="ref-for-transform-stream-error①">TransformStreamError</a>(<var>controller</var>.<a data-link-type="dfn" href="#transformstreamdefaultcontroller-stream" id="ref-for-transformstreamdefaultcontroller-stream④">[[stream]]</a>, <var>r</var>).</p> <li data-md> <p>Throw <var>r</var>.</p> </ol> </ol> </div> <div class="algorithm" data-algorithm="TransformStreamDefaultControllerTerminate"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="TransformStreamDefaultControllerTerminate" id="transform-stream-default-controller-terminate">TransformStreamDefaultControllerTerminate(<var>controller</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>stream</var> be <var>controller</var>.<a data-link-type="dfn" href="#transformstreamdefaultcontroller-stream" id="ref-for-transformstreamdefaultcontroller-stream⑤">[[stream]]</a>.</p> <li data-md> <p>Let <var>readableController</var> be <var>stream</var>.<a data-link-type="dfn" href="#transformstream-readable" id="ref-for-transformstream-readable①⓪">[[readable]]</a>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller④⑨">[[controller]]</a>.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-close" id="ref-for-readable-stream-default-controller-close④">ReadableStreamDefaultControllerClose</a>(<var>readableController</var>).</p> <li data-md> <p>Let <var>error</var> be a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror⑥④">TypeError</a></code> exception indicating that the stream has been terminated.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#transform-stream-error-writable-and-unblock-write" id="ref-for-transform-stream-error-writable-and-unblock-write②">TransformStreamErrorWritableAndUnblockWrite</a>(<var>stream</var>, <var>error</var>).</p> </ol> </div> <h4 class="heading settled" data-level="6.4.3" id="ts-default-sink-abstract-ops"><span class="secno">6.4.3. </span><span class="content">Default sinks</span><a class="self-link" href="#ts-default-sink-abstract-ops"></a></h4> <p>The following abstract operations are used to implement the <a data-link-type="dfn" href="#underlying-sink" id="ref-for-underlying-sink③③">underlying sink</a> for the <a data-link-type="dfn" href="#writable-side" id="ref-for-writable-side①②">writable side</a> of <a data-link-type="dfn" href="#transform-stream" id="ref-for-transform-stream③">transform streams</a>.</p> <div class="algorithm" data-algorithm="TransformStreamDefaultSinkWriteAlgorithm"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="TransformStreamDefaultSinkWriteAlgorithm" id="transform-stream-default-sink-write-algorithm">TransformStreamDefaultSinkWriteAlgorithm(<var>stream</var>, <var>chunk</var>)</dfn> performs the following steps: <ol> <li data-md> <p class="assertion">Assert: <var>stream</var>.<a data-link-type="dfn" href="#transformstream-writable" id="ref-for-transformstream-writable⑥">[[writable]]</a>.<a data-link-type="dfn" href="#writablestream-state" id="ref-for-writablestream-state③⑥">[[state]]</a> is "<code>writable</code>".</p> <li data-md> <p>Let <var>controller</var> be <var>stream</var>.<a data-link-type="dfn" href="#transformstream-controller" id="ref-for-transformstream-controller⑦">[[controller]]</a>.</p> <li data-md> <p>If <var>stream</var>.<a data-link-type="dfn" href="#transformstream-backpressure" id="ref-for-transformstream-backpressure①⓪">[[backpressure]]</a> is true,</p> <ol> <li data-md> <p>Let <var>backpressureChangePromise</var> be <var>stream</var>.<a data-link-type="dfn" href="#transformstream-backpressurechangepromise" id="ref-for-transformstream-backpressurechangepromise⑦">[[backpressureChangePromise]]</a>.</p> <li data-md> <p class="assertion">Assert: <var>backpressureChangePromise</var> is not undefined.</p> <li data-md> <p>Return the result of <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-perform-steps-once-promise-is-settled" id="ref-for-dfn-perform-steps-once-promise-is-settled④">reacting</a> to <var>backpressureChangePromise</var> with the following fulfillment steps:</p> <ol> <li data-md> <p>Let <var>writable</var> be <var>stream</var>.<a data-link-type="dfn" href="#transformstream-writable" id="ref-for-transformstream-writable⑦">[[writable]]</a>.</p> <li data-md> <p>Let <var>state</var> be <var>writable</var>.<a data-link-type="dfn" href="#writablestream-state" id="ref-for-writablestream-state③⑦">[[state]]</a>.</p> <li data-md> <p>If <var>state</var> is "<code>erroring</code>", throw <var>writable</var>.<a data-link-type="dfn" href="#writablestream-storederror" id="ref-for-writablestream-storederror①⑥">[[storedError]]</a>.</p> <li data-md> <p class="assertion">Assert: <var>state</var> is "<code>writable</code>".</p> <li data-md> <p>Return ! <a data-link-type="abstract-op" href="#transform-stream-default-controller-perform-transform" id="ref-for-transform-stream-default-controller-perform-transform">TransformStreamDefaultControllerPerformTransform</a>(<var>controller</var>, <var>chunk</var>).</p> </ol> </ol> <li data-md> <p>Return ! <a data-link-type="abstract-op" href="#transform-stream-default-controller-perform-transform" id="ref-for-transform-stream-default-controller-perform-transform①">TransformStreamDefaultControllerPerformTransform</a>(<var>controller</var>, <var>chunk</var>).</p> </ol> </div> <div class="algorithm" data-algorithm="TransformStreamDefaultSinkAbortAlgorithm"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="TransformStreamDefaultSinkAbortAlgorithm" id="transform-stream-default-sink-abort-algorithm">TransformStreamDefaultSinkAbortAlgorithm(<var>stream</var>, <var>reason</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>controller</var> be <var>stream</var>.<a data-link-type="dfn" href="#transformstream-controller" id="ref-for-transformstream-controller⑧">[[controller]]</a>.</p> <li data-md> <p>If <var>controller</var>.<a data-link-type="dfn" href="#transformstreamdefaultcontroller-finishpromise" id="ref-for-transformstreamdefaultcontroller-finishpromise">[[finishPromise]]</a> is not undefined, return <var>controller</var>.<a data-link-type="dfn" href="#transformstreamdefaultcontroller-finishpromise" id="ref-for-transformstreamdefaultcontroller-finishpromise①">[[finishPromise]]</a>.</p> <li data-md> <p>Let <var>readable</var> be <var>stream</var>.<a data-link-type="dfn" href="#transformstream-readable" id="ref-for-transformstream-readable①①">[[readable]]</a>.</p> <li data-md> <p>Let <var>controller</var>.<a data-link-type="dfn" href="#transformstreamdefaultcontroller-finishpromise" id="ref-for-transformstreamdefaultcontroller-finishpromise②">[[finishPromise]]</a> be a new promise.</p> <li data-md> <p>Let <var>cancelPromise</var> be the result of performing <var>controller</var>.<a data-link-type="dfn" href="#transformstreamdefaultcontroller-cancelalgorithm" id="ref-for-transformstreamdefaultcontroller-cancelalgorithm③">[[cancelAlgorithm]]</a>, passing <var>reason</var>.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#transform-stream-default-controller-clear-algorithms" id="ref-for-transform-stream-default-controller-clear-algorithms①">TransformStreamDefaultControllerClearAlgorithms</a>(<var>controller</var>).</p> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-perform-steps-once-promise-is-settled" id="ref-for-dfn-perform-steps-once-promise-is-settled⑤">React</a> to <var>cancelPromise</var>:</p> <ol> <li data-md> <p>If <var>cancelPromise</var> was fulfilled, then:</p> <ol> <li data-md> <p>If <var>readable</var>.<a data-link-type="dfn" href="#readablestream-state" id="ref-for-readablestream-state③⑦">[[state]]</a> is "<code>errored</code>", <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#reject" id="ref-for-reject①⑥">reject</a> <var>controller</var>.<a data-link-type="dfn" href="#transformstreamdefaultcontroller-finishpromise" id="ref-for-transformstreamdefaultcontroller-finishpromise③">[[finishPromise]]</a> with <var>readable</var>.<a data-link-type="dfn" href="#readablestream-storederror" id="ref-for-readablestream-storederror①⓪">[[storedError]]</a>.</p> <li data-md> <p>Otherwise:</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-error" id="ref-for-readable-stream-default-controller-error①⓪">ReadableStreamDefaultControllerError</a>(<var>readable</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller⑤⓪">[[controller]]</a>, <var>reason</var>).</p> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#resolve" id="ref-for-resolve③⓪">Resolve</a> <var>controller</var>.<a data-link-type="dfn" href="#transformstreamdefaultcontroller-finishpromise" id="ref-for-transformstreamdefaultcontroller-finishpromise④">[[finishPromise]]</a> with undefined.</p> </ol> </ol> <li data-md> <p>If <var>cancelPromise</var> was rejected with reason <var>r</var>, then:</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-error" id="ref-for-readable-stream-default-controller-error①①">ReadableStreamDefaultControllerError</a>(<var>readable</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller⑤①">[[controller]]</a>, <var>r</var>).</p> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#reject" id="ref-for-reject①⑦">Reject</a> <var>controller</var>.<a data-link-type="dfn" href="#transformstreamdefaultcontroller-finishpromise" id="ref-for-transformstreamdefaultcontroller-finishpromise⑤">[[finishPromise]]</a> with <var>r</var>.</p> </ol> </ol> <li data-md> <p>Return <var>controller</var>.<a data-link-type="dfn" href="#transformstreamdefaultcontroller-finishpromise" id="ref-for-transformstreamdefaultcontroller-finishpromise⑥">[[finishPromise]]</a>.</p> </ol> </div> <div class="algorithm" data-algorithm="TransformStreamDefaultSinkCloseAlgorithm"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="TransformStreamDefaultSinkCloseAlgorithm" id="transform-stream-default-sink-close-algorithm">TransformStreamDefaultSinkCloseAlgorithm(<var>stream</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>controller</var> be <var>stream</var>.<a data-link-type="dfn" href="#transformstream-controller" id="ref-for-transformstream-controller⑨">[[controller]]</a>.</p> <li data-md> <p>If <var>controller</var>.<a data-link-type="dfn" href="#transformstreamdefaultcontroller-finishpromise" id="ref-for-transformstreamdefaultcontroller-finishpromise⑦">[[finishPromise]]</a> is not undefined, return <var>controller</var>.<a data-link-type="dfn" href="#transformstreamdefaultcontroller-finishpromise" id="ref-for-transformstreamdefaultcontroller-finishpromise⑧">[[finishPromise]]</a>.</p> <li data-md> <p>Let <var>readable</var> be <var>stream</var>.<a data-link-type="dfn" href="#transformstream-readable" id="ref-for-transformstream-readable①②">[[readable]]</a>.</p> <li data-md> <p>Let <var>controller</var>.<a data-link-type="dfn" href="#transformstreamdefaultcontroller-finishpromise" id="ref-for-transformstreamdefaultcontroller-finishpromise⑨">[[finishPromise]]</a> be a new promise.</p> <li data-md> <p>Let <var>flushPromise</var> be the result of performing <var>controller</var>.<a data-link-type="dfn" href="#transformstreamdefaultcontroller-flushalgorithm" id="ref-for-transformstreamdefaultcontroller-flushalgorithm③">[[flushAlgorithm]]</a>.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#transform-stream-default-controller-clear-algorithms" id="ref-for-transform-stream-default-controller-clear-algorithms②">TransformStreamDefaultControllerClearAlgorithms</a>(<var>controller</var>).</p> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-perform-steps-once-promise-is-settled" id="ref-for-dfn-perform-steps-once-promise-is-settled⑥">React</a> to <var>flushPromise</var>:</p> <ol> <li data-md> <p>If <var>flushPromise</var> was fulfilled, then:</p> <ol> <li data-md> <p>If <var>readable</var>.<a data-link-type="dfn" href="#readablestream-state" id="ref-for-readablestream-state③⑧">[[state]]</a> is "<code>errored</code>", <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#reject" id="ref-for-reject①⑧">reject</a> <var>controller</var>.<a data-link-type="dfn" href="#transformstreamdefaultcontroller-finishpromise" id="ref-for-transformstreamdefaultcontroller-finishpromise①⓪">[[finishPromise]]</a> with <var>readable</var>.<a data-link-type="dfn" href="#readablestream-storederror" id="ref-for-readablestream-storederror①①">[[storedError]]</a>.</p> <li data-md> <p>Otherwise:</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-close" id="ref-for-readable-stream-default-controller-close⑤">ReadableStreamDefaultControllerClose</a>(<var>readable</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller⑤②">[[controller]]</a>).</p> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#resolve" id="ref-for-resolve③①">Resolve</a> <var>controller</var>.<a data-link-type="dfn" href="#transformstreamdefaultcontroller-finishpromise" id="ref-for-transformstreamdefaultcontroller-finishpromise①①">[[finishPromise]]</a> with undefined.</p> </ol> </ol> <li data-md> <p>If <var>flushPromise</var> was rejected with reason <var>r</var>, then:</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-error" id="ref-for-readable-stream-default-controller-error①②">ReadableStreamDefaultControllerError</a>(<var>readable</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller⑤③">[[controller]]</a>, <var>r</var>).</p> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#reject" id="ref-for-reject①⑨">Reject</a> <var>controller</var>.<a data-link-type="dfn" href="#transformstreamdefaultcontroller-finishpromise" id="ref-for-transformstreamdefaultcontroller-finishpromise①②">[[finishPromise]]</a> with <var>r</var>.</p> </ol> </ol> <li data-md> <p>Return <var>controller</var>.<a data-link-type="dfn" href="#transformstreamdefaultcontroller-finishpromise" id="ref-for-transformstreamdefaultcontroller-finishpromise①③">[[finishPromise]]</a>.</p> </ol> </div> <h4 class="heading settled" data-level="6.4.4" id="ts-default-source-abstract-ops"><span class="secno">6.4.4. </span><span class="content">Default sources</span><a class="self-link" href="#ts-default-source-abstract-ops"></a></h4> <p>The following abstract operation is used to implement the <a data-link-type="dfn" href="#underlying-source" id="ref-for-underlying-source②⑧">underlying source</a> for the <a data-link-type="dfn" href="#readable-side" id="ref-for-readable-side①③">readable side</a> of <a data-link-type="dfn" href="#transform-stream" id="ref-for-transform-stream④">transform streams</a>.</p> <div class="algorithm" data-algorithm="TransformStreamDefaultSourceCancelAlgorithm"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="TransformStreamDefaultSourceCancelAlgorithm" id="transform-stream-default-source-cancel">TransformStreamDefaultSourceCancelAlgorithm(<var>stream</var>, <var>reason</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>controller</var> be <var>stream</var>.<a data-link-type="dfn" href="#transformstream-controller" id="ref-for-transformstream-controller①⓪">[[controller]]</a>.</p> <li data-md> <p>If <var>controller</var>.<a data-link-type="dfn" href="#transformstreamdefaultcontroller-finishpromise" id="ref-for-transformstreamdefaultcontroller-finishpromise①④">[[finishPromise]]</a> is not undefined, return <var>controller</var>.<a data-link-type="dfn" href="#transformstreamdefaultcontroller-finishpromise" id="ref-for-transformstreamdefaultcontroller-finishpromise①⑤">[[finishPromise]]</a>.</p> <li data-md> <p>Let <var>writable</var> be <var>stream</var>.<a data-link-type="dfn" href="#transformstream-writable" id="ref-for-transformstream-writable⑧">[[writable]]</a>.</p> <li data-md> <p>Let <var>controller</var>.<a data-link-type="dfn" href="#transformstreamdefaultcontroller-finishpromise" id="ref-for-transformstreamdefaultcontroller-finishpromise①⑥">[[finishPromise]]</a> be a new promise.</p> <li data-md> <p>Let <var>cancelPromise</var> be the result of performing <var>controller</var>.<a data-link-type="dfn" href="#transformstreamdefaultcontroller-cancelalgorithm" id="ref-for-transformstreamdefaultcontroller-cancelalgorithm④">[[cancelAlgorithm]]</a>, passing <var>reason</var>.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#transform-stream-default-controller-clear-algorithms" id="ref-for-transform-stream-default-controller-clear-algorithms③">TransformStreamDefaultControllerClearAlgorithms</a>(<var>controller</var>).</p> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-perform-steps-once-promise-is-settled" id="ref-for-dfn-perform-steps-once-promise-is-settled⑦">React</a> to <var>cancelPromise</var>:</p> <ol> <li data-md> <p>If <var>cancelPromise</var> was fulfilled, then:</p> <ol> <li data-md> <p>If <var>writable</var>.<a data-link-type="dfn" href="#writablestream-state" id="ref-for-writablestream-state③⑧">[[state]]</a> is "<code>errored</code>", <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#reject" id="ref-for-reject②⓪">reject</a> <var>controller</var>.<a data-link-type="dfn" href="#transformstreamdefaultcontroller-finishpromise" id="ref-for-transformstreamdefaultcontroller-finishpromise①⑦">[[finishPromise]]</a> with <var>writable</var>.<a data-link-type="dfn" href="#writablestream-storederror" id="ref-for-writablestream-storederror①⑦">[[storedError]]</a>.</p> <li data-md> <p>Otherwise:</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#writable-stream-default-controller-error-if-needed" id="ref-for-writable-stream-default-controller-error-if-needed③">WritableStreamDefaultControllerErrorIfNeeded</a>(<var>writable</var>.<a data-link-type="dfn" href="#writablestream-controller" id="ref-for-writablestream-controller①①">[[controller]]</a>, <var>reason</var>).</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#transform-stream-unblock-write" id="ref-for-transform-stream-unblock-write①">TransformStreamUnblockWrite</a>(<var>stream</var>).</p> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#resolve" id="ref-for-resolve③②">Resolve</a> <var>controller</var>.<a data-link-type="dfn" href="#transformstreamdefaultcontroller-finishpromise" id="ref-for-transformstreamdefaultcontroller-finishpromise①⑧">[[finishPromise]]</a> with undefined.</p> </ol> </ol> <li data-md> <p>If <var>cancelPromise</var> was rejected with reason <var>r</var>, then:</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#writable-stream-default-controller-error-if-needed" id="ref-for-writable-stream-default-controller-error-if-needed④">WritableStreamDefaultControllerErrorIfNeeded</a>(<var>writable</var>.<a data-link-type="dfn" href="#writablestream-controller" id="ref-for-writablestream-controller①②">[[controller]]</a>, <var>r</var>).</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#transform-stream-unblock-write" id="ref-for-transform-stream-unblock-write②">TransformStreamUnblockWrite</a>(<var>stream</var>).</p> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#reject" id="ref-for-reject②①">Reject</a> <var>controller</var>.<a data-link-type="dfn" href="#transformstreamdefaultcontroller-finishpromise" id="ref-for-transformstreamdefaultcontroller-finishpromise①⑨">[[finishPromise]]</a> with <var>r</var>.</p> </ol> </ol> <li data-md> <p>Return <var>controller</var>.<a data-link-type="dfn" href="#transformstreamdefaultcontroller-finishpromise" id="ref-for-transformstreamdefaultcontroller-finishpromise②⓪">[[finishPromise]]</a>.</p> </ol> </div> <div class="algorithm" data-algorithm="TransformStreamDefaultSourcePullAlgorithm"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="TransformStreamDefaultSourcePullAlgorithm" id="transform-stream-default-source-pull">TransformStreamDefaultSourcePullAlgorithm(<var>stream</var>)</dfn> performs the following steps: <ol> <li data-md> <p class="assertion">Assert: <var>stream</var>.<a data-link-type="dfn" href="#transformstream-backpressure" id="ref-for-transformstream-backpressure①①">[[backpressure]]</a> is true.</p> <li data-md> <p class="assertion">Assert: <var>stream</var>.<a data-link-type="dfn" href="#transformstream-backpressurechangepromise" id="ref-for-transformstream-backpressurechangepromise⑧">[[backpressureChangePromise]]</a> is not undefined.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#transform-stream-set-backpressure" id="ref-for-transform-stream-set-backpressure⑤">TransformStreamSetBackpressure</a>(<var>stream</var>, false).</p> <li data-md> <p>Return <var>stream</var>.<a data-link-type="dfn" href="#transformstream-backpressurechangepromise" id="ref-for-transformstream-backpressurechangepromise⑨">[[backpressureChangePromise]]</a>.</p> </ol> </div> <h2 class="heading settled" data-level="7" id="qs"><span class="secno">7. </span><span class="content">Queuing strategies</span><a class="self-link" href="#qs"></a></h2> <h3 class="heading settled" data-level="7.1" id="qs-api"><span class="secno">7.1. </span><span class="content">The queuing strategy API</span><a class="self-link" href="#qs-api"></a></h3> <p>The <code class="idl"><a data-link-type="idl" href="#rs-constructor" id="ref-for-rs-constructor⑥">ReadableStream()</a></code>, <code class="idl"><a data-link-type="idl" href="#ws-constructor" id="ref-for-ws-constructor⑤">WritableStream()</a></code>, and <code class="idl"><a data-link-type="idl" href="#ts-constructor" id="ref-for-ts-constructor⑤">TransformStream()</a></code> constructors all accept at least one argument representing an appropriate <a data-link-type="dfn" href="#queuing-strategy" id="ref-for-queuing-strategy⑧">queuing strategy</a> for the stream being created. Such objects contain the following properties:</p> <pre class="idl highlight def"><c- b>dictionary</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="dictionary" data-export id="dictdef-queuingstrategy"><code><c- g>QueuingStrategy</c-></code></dfn> { <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-unrestricted-double" id="ref-for-idl-unrestricted-double⑤"><c- b>unrestricted</c-> <c- b>double</c-></a> <a class="idl-code" data-link-type="dict-member" data-type="unrestricted double" href="#dom-queuingstrategy-highwatermark" id="ref-for-dom-queuingstrategy-highwatermark③"><c- g>highWaterMark</c-></a>; <a data-link-type="idl-name" href="#callbackdef-queuingstrategysize" id="ref-for-callbackdef-queuingstrategysize"><c- n>QueuingStrategySize</c-></a> <a class="idl-code" data-link-type="dict-member" data-type="QueuingStrategySize" href="#dom-queuingstrategy-size" id="ref-for-dom-queuingstrategy-size②"><c- g>size</c-></a>; }; <c- b>callback</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="callback" data-export id="callbackdef-queuingstrategysize"><code><c- g>QueuingStrategySize</c-></code></dfn> = <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-unrestricted-double" id="ref-for-idl-unrestricted-double⑥"><c- b>unrestricted</c-> <c- b>double</c-></a> (<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any" id="ref-for-idl-any②⑧"><c- b>any</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="QueuingStrategySize" data-dfn-type="argument" data-export id="dom-queuingstrategysize-chunk"><code><c- g>chunk</c-></code></dfn>); </pre> <dl> <dt><dfn class="dfn-paneled idl-code" data-dfn-for="QueuingStrategy" data-dfn-type="dict-member" data-export id="dom-queuingstrategy-highwatermark"><code>highWaterMark</code></dfn>, <span> of type <a data-link-type="idl-name" href="https://webidl.spec.whatwg.org/#idl-unrestricted-double" id="ref-for-idl-unrestricted-double⑦">unrestricted double</a></span> <dd> <p>A non-negative number indicating the <a data-link-type="dfn" href="#high-water-mark" id="ref-for-high-water-mark⑥">high water mark</a> of the stream using this queuing strategy. </p> <dt><dfn class="dfn-paneled idl-code" data-dfn-for="QueuingStrategy" data-dfn-type="dict-member" data-export data-lt="size" id="dom-queuingstrategy-size"><code>size(<var>chunk</var>)</code></dfn> (non-byte streams only), <span> of type <a data-link-type="idl-name" href="#callbackdef-queuingstrategysize" id="ref-for-callbackdef-queuingstrategysize①">QueuingStrategySize</a></span> <dd> <p>A function that computes and returns the finite non-negative size of the given <a data-link-type="dfn" href="#chunk" id="ref-for-chunk⑦③">chunk</a> value. </p> <p>The result is used to determine <a data-link-type="dfn" href="#backpressure" id="ref-for-backpressure①⑤">backpressure</a>, manifesting via the appropriate <code>desiredSize</code> property: either <code class="idl"><a data-link-type="idl" href="#rs-default-controller-desired-size" id="ref-for-rs-default-controller-desired-size③">defaultController.desiredSize</a></code>, <code class="idl"><a data-link-type="idl" href="#rbs-controller-desired-size" id="ref-for-rbs-controller-desired-size③">byteController.desiredSize</a></code>, or <code class="idl"><a data-link-type="idl" href="#default-writer-desired-size" id="ref-for-default-writer-desired-size⑦">writer.desiredSize</a></code>, depending on where the queuing strategy is being used. For readable streams, it also governs when the <a data-link-type="dfn" href="#underlying-source" id="ref-for-underlying-source②⑨">underlying source</a>'s <code class="idl"><a data-link-type="idl" href="#dom-underlyingsource-pull" id="ref-for-dom-underlyingsource-pull⑧">pull()</a></code> method is called. </p> <p>This function has to be idempotent and not cause side effects; very strange results can occur otherwise. </p> <p>For <a data-link-type="dfn" href="#readable-byte-stream" id="ref-for-readable-byte-stream①⑤">readable byte streams</a>, this function is not used, as chunks are always measured in bytes. </p> </dl> <p>Any object with these properties can be used when a queuing strategy object is expected. However, we provide two built-in queuing strategy classes that provide a common vocabulary for certain cases: <code class="idl"><a data-link-type="idl" href="#bytelengthqueuingstrategy" id="ref-for-bytelengthqueuingstrategy">ByteLengthQueuingStrategy</a></code> and <code class="idl"><a data-link-type="idl" href="#countqueuingstrategy" id="ref-for-countqueuingstrategy④">CountQueuingStrategy</a></code>. They both make use of the following Web IDL fragment for their constructors:</p> <pre class="idl highlight def"><c- b>dictionary</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="dictionary" data-export id="dictdef-queuingstrategyinit"><code><c- g>QueuingStrategyInit</c-></code></dfn> { <c- b>required</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-unrestricted-double" id="ref-for-idl-unrestricted-double⑧"><c- b>unrestricted</c-> <c- b>double</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="QueuingStrategyInit" data-dfn-type="dict-member" data-export data-type="unrestricted double" id="dom-queuingstrategyinit-highwatermark"><code><c- g>highWaterMark</c-></code></dfn>; }; </pre> <h3 class="heading settled" data-level="7.2" id="blqs-class"><span class="secno">7.2. </span><span class="content">The <code class="idl"><a data-link-type="idl" href="#bytelengthqueuingstrategy" id="ref-for-bytelengthqueuingstrategy①">ByteLengthQueuingStrategy</a></code> class</span><a class="self-link" href="#blqs-class"></a></h3> <p>A common <a data-link-type="dfn" href="#queuing-strategy" id="ref-for-queuing-strategy⑨">queuing strategy</a> when dealing with bytes is to wait until the accumulated <code>byteLength</code> properties of the incoming <a data-link-type="dfn" href="#chunk" id="ref-for-chunk⑦④">chunks</a> reaches a specified high-water mark. As such, this is provided as a built-in <a data-link-type="dfn" href="#queuing-strategy" id="ref-for-queuing-strategy①⓪">queuing strategy</a> that can be used when constructing streams.</p> <div class="example" id="example-blqs"> <a class="self-link" href="#example-blqs"></a> When creating a <a data-link-type="dfn" href="#readable-stream" id="ref-for-readable-stream①⑧">readable stream</a> or <a data-link-type="dfn" href="#writable-stream" id="ref-for-writable-stream①①">writable stream</a>, you can supply a byte-length queuing strategy directly: <pre class="highlight"><c- a>const</c-> stream <c- o>=</c-> <c- ow>new</c-> ReadableStream<c- p>(</c-> <c- p>{</c-> <c- p>...</c-> <c- p>},</c-> <c- ow>new</c-> ByteLengthQueuingStrategy<c- p>({</c-> highWaterMark<c- o>:</c-> <c- mf>16</c-> <c- o>*</c-> <c- mf>1024</c-> <c- p>})</c-> <c- p>);</c-> </pre> <p>In this case, 16 KiB worth of <a data-link-type="dfn" href="#chunk" id="ref-for-chunk⑦⑤">chunks</a> can be enqueued by the readable stream’s <a data-link-type="dfn" href="#underlying-source" id="ref-for-underlying-source③⓪">underlying source</a> before the readable stream implementation starts sending <a data-link-type="dfn" href="#backpressure" id="ref-for-backpressure①⑥">backpressure</a> signals to the underlying source.</p> <pre class="highlight"><c- a>const</c-> stream <c- o>=</c-> <c- ow>new</c-> WritableStream<c- p>(</c-> <c- p>{</c-> <c- p>...</c-> <c- p>},</c-> <c- ow>new</c-> ByteLengthQueuingStrategy<c- p>({</c-> highWaterMark<c- o>:</c-> <c- mf>32</c-> <c- o>*</c-> <c- mf>1024</c-> <c- p>})</c-> <c- p>);</c-> </pre> <p>In this case, 32 KiB worth of <a data-link-type="dfn" href="#chunk" id="ref-for-chunk⑦⑥">chunks</a> can be accumulated in the writable stream’s internal queue, waiting for previous writes to the <a data-link-type="dfn" href="#underlying-sink" id="ref-for-underlying-sink③④">underlying sink</a> to finish, before the writable stream starts sending <a data-link-type="dfn" href="#backpressure" id="ref-for-backpressure①⑦">backpressure</a> signals to any <a data-link-type="dfn" href="#producer" id="ref-for-producer①②">producers</a>.</p> </div> <p class="note" role="note">It is not necessary to use <code class="idl"><a data-link-type="idl" href="#bytelengthqueuingstrategy" id="ref-for-bytelengthqueuingstrategy②">ByteLengthQueuingStrategy</a></code> with <a data-link-type="dfn" href="#readable-byte-stream" id="ref-for-readable-byte-stream①⑥">readable byte streams</a>, as they always measure chunks in bytes. Attempting to construct a byte stream with a <code class="idl"><a data-link-type="idl" href="#bytelengthqueuingstrategy" id="ref-for-bytelengthqueuingstrategy③">ByteLengthQueuingStrategy</a></code> will fail. </p> <h4 class="heading settled" data-level="7.2.1" id="blqs-class-definition"><span class="secno">7.2.1. </span><span class="content">Interface definition</span><a class="self-link" href="#blqs-class-definition"></a></h4> <p>The Web IDL definition for the <code class="idl"><a data-link-type="idl" href="#bytelengthqueuingstrategy" id="ref-for-bytelengthqueuingstrategy④">ByteLengthQueuingStrategy</a></code> class is given as follows:</p> <pre class="idl highlight def">[Exposed=*] <c- b>interface</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="interface" data-export id="bytelengthqueuingstrategy"><code><c- g>ByteLengthQueuingStrategy</c-></code></dfn> { <a class="idl-code" data-link-type="constructor" href="#blqs-constructor" id="ref-for-blqs-constructor"><c- g>constructor</c-></a>(<a data-link-type="idl-name" href="#dictdef-queuingstrategyinit" id="ref-for-dictdef-queuingstrategyinit"><c- n>QueuingStrategyInit</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="ByteLengthQueuingStrategy/ByteLengthQueuingStrategy(init), ByteLengthQueuingStrategy/constructor(init)" data-dfn-type="argument" data-export id="dom-bytelengthqueuingstrategy-bytelengthqueuingstrategy-init-init"><code><c- g>init</c-></code></dfn>); <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-unrestricted-double" id="ref-for-idl-unrestricted-double⑨"><c- b>unrestricted</c-> <c- b>double</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="unrestricted double" href="#blqs-high-water-mark" id="ref-for-blqs-high-water-mark"><c- g>highWaterMark</c-></a>; <c- b>readonly</c-> <c- b>attribute</c-> <a data-link-type="idl-name" href="https://webidl.spec.whatwg.org/#Function" id="ref-for-Function"><c- n>Function</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="Function" href="#blqs-size" id="ref-for-blqs-size"><c- g>size</c-></a>; }; </pre> <h4 class="heading settled" data-level="7.2.2" id="blqs-internal-slots"><span class="secno">7.2.2. </span><span class="content">Internal slots</span><a class="self-link" href="#blqs-internal-slots"></a></h4> <p>Instances of <code class="idl"><a data-link-type="idl" href="#bytelengthqueuingstrategy" id="ref-for-bytelengthqueuingstrategy⑤">ByteLengthQueuingStrategy</a></code> have a <dfn class="dfn-paneled" data-dfn-for="ByteLengthQueuingStrategy" data-dfn-type="dfn" data-noexport id="bytelengthqueuingstrategy-highwatermark">[[highWaterMark]]</dfn> internal slot, storing the value given in the constructor.</p> <div class="algorithm" data-algorithm="byte length queuing strategy size function"> Additionally, every <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#global-object" id="ref-for-global-object">global object</a> <var>globalObject</var> has an associated <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="byte length queuing strategy size function" data-noexport id="byte-length-queuing-strategy-size-function">byte length queuing strategy size function</dfn>, which is a <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#Function" id="ref-for-Function①">Function</a></code> whose value must be initialized as follows: <ol> <li data-md> <p>Let <var>steps</var> be the following steps, given <var>chunk</var>:</p> <ol> <li data-md> <p>Return ? <a data-link-type="abstract-op" href="https://tc39.es/ecma262/multipage/abstract-operations.html#sec-getv" id="ref-for-sec-getv">GetV</a>(<var>chunk</var>, "<code>byteLength</code>").</p> </ol> <li data-md> <p>Let <var>F</var> be ! <a data-link-type="abstract-op" href="https://tc39.es/ecma262/multipage/ordinary-and-exotic-objects-behaviours.html#sec-createbuiltinfunction" id="ref-for-sec-createbuiltinfunction">CreateBuiltinFunction</a>(<var>steps</var>, 1, "<code>size</code>", « », <var>globalObject</var>’s <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#concept-relevant-realm" id="ref-for-concept-relevant-realm">relevant Realm</a>).</p> <li data-md> <p>Set <var>globalObject</var>’s <a data-link-type="dfn" href="#byte-length-queuing-strategy-size-function" id="ref-for-byte-length-queuing-strategy-size-function">byte length queuing strategy size function</a> to a <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#Function" id="ref-for-Function②">Function</a></code> that represents a reference to <var>F</var>, with <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-callback-context" id="ref-for-dfn-callback-context">callback context</a> equal to <var>globalObject</var>’s <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#relevant-settings-object" id="ref-for-relevant-settings-object">relevant settings object</a>.</p> </ol> <p class="note" role="note">This design is somewhat historical. It is motivated by the desire to ensure that <code class="idl"><a data-link-type="idl" href="#blqs-size" id="ref-for-blqs-size①">size</a></code> is a function, not a method, i.e. it does not check its <code>this</code> value. See <a href="https://github.com/whatwg/streams/issues/1005">whatwg/streams#1005</a> and <a href="https://github.com/heycam/webidl/issues/819">heycam/webidl#819</a> for more background. </p> </div> <h4 class="heading settled" data-level="7.2.3" id="blqs-prototype"><span class="secno">7.2.3. </span><span class="content">Constructor and properties</span><a class="self-link" href="#blqs-prototype"></a></h4> <dl class="domintro non-normative"> <dt><code><var>strategy</var> = new <code class="idl"><a data-link-type="idl" href="#blqs-constructor" id="ref-for-blqs-constructor①">ByteLengthQueuingStrategy</a></code>({ <code class="idl"><a data-link-type="idl" href="#dom-queuingstrategyinit-highwatermark" id="ref-for-dom-queuingstrategyinit-highwatermark">highWaterMark</a></code> })</code> <dd> <p>Creates a new <code class="idl"><a data-link-type="idl" href="#bytelengthqueuingstrategy" id="ref-for-bytelengthqueuingstrategy⑥">ByteLengthQueuingStrategy</a></code> with the provided <a data-link-type="dfn" href="#high-water-mark" id="ref-for-high-water-mark⑦">high water mark</a>. </p> <p>Note that the provided high water mark will not be validated ahead of time. Instead, if it is negative, NaN, or not a number, the resulting <code class="idl"><a data-link-type="idl" href="#bytelengthqueuingstrategy" id="ref-for-bytelengthqueuingstrategy⑦">ByteLengthQueuingStrategy</a></code> will cause the corresponding stream constructor to throw. </p> <dt><code><var>highWaterMark</var> = <var>strategy</var>.<code class="idl"><a data-link-type="idl" href="#blqs-high-water-mark" id="ref-for-blqs-high-water-mark①">highWaterMark</a></code></code> <dd> <p>Returns the <a data-link-type="dfn" href="#high-water-mark" id="ref-for-high-water-mark⑧">high water mark</a> provided to the constructor. </p> <dt><code><var>strategy</var>.<code class="idl"><a data-link-type="idl" href="#blqs-size" id="ref-for-blqs-size②">size</a></code>(<var>chunk</var>)</code> <dd> <p>Measures the size of <var>chunk</var> by returning the value of its <code>byteLength</code> property. </p> </dl> <div class="algorithm" data-algorithm="ByteLengthQueuingStrategy(init)" data-algorithm-for="ByteLengthQueuingStrategy"> The <dfn class="dfn-paneled idl-code" data-dfn-for="ByteLengthQueuingStrategy" data-dfn-type="constructor" data-export data-lt="ByteLengthQueuingStrategy(init)|constructor(init)" id="blqs-constructor"><code>new ByteLengthQueuingStrategy(<var>init</var>)</code></dfn> constructor steps are: <ol> <li data-md> <p>Set <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this①①①">this</a>.<a data-link-type="dfn" href="#bytelengthqueuingstrategy-highwatermark" id="ref-for-bytelengthqueuingstrategy-highwatermark">[[highWaterMark]]</a> to <var>init</var>["<code class="idl"><a data-link-type="idl" href="#dom-queuingstrategyinit-highwatermark" id="ref-for-dom-queuingstrategyinit-highwatermark①">highWaterMark</a></code>"].</p> </ol> </div> <div class="algorithm" data-algorithm="highWaterMark" data-algorithm-for="ByteLengthQueuingStrategy"> The <dfn class="dfn-paneled idl-code" data-dfn-for="ByteLengthQueuingStrategy" data-dfn-type="attribute" data-export id="blqs-high-water-mark"><code>highWaterMark</code></dfn> getter steps are: <ol> <li data-md> <p>Return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this①①②">this</a>.<a data-link-type="dfn" href="#bytelengthqueuingstrategy-highwatermark" id="ref-for-bytelengthqueuingstrategy-highwatermark①">[[highWaterMark]]</a>.</p> </ol> </div> <div class="algorithm" data-algorithm="size" data-algorithm-for="ByteLengthQueuingStrategy"> The <dfn class="dfn-paneled idl-code" data-dfn-for="ByteLengthQueuingStrategy" data-dfn-type="attribute" data-export id="blqs-size"><code>size</code></dfn> getter steps are: <ol> <li data-md> <p>Return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this①①③">this</a>'s <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#concept-relevant-global" id="ref-for-concept-relevant-global">relevant global object</a>'s <a data-link-type="dfn" href="#byte-length-queuing-strategy-size-function" id="ref-for-byte-length-queuing-strategy-size-function①">byte length queuing strategy size function</a>.</p> </ol> </div> <h3 class="heading settled" data-level="7.3" id="cqs-class"><span class="secno">7.3. </span><span class="content">The <code class="idl"><a data-link-type="idl" href="#countqueuingstrategy" id="ref-for-countqueuingstrategy⑤">CountQueuingStrategy</a></code> class</span><a class="self-link" href="#cqs-class"></a></h3> <p>A common <a data-link-type="dfn" href="#queuing-strategy" id="ref-for-queuing-strategy①①">queuing strategy</a> when dealing with streams of generic objects is to simply count the number of chunks that have been accumulated so far, waiting until this number reaches a specified high-water mark. As such, this strategy is also provided out of the box.</p> <div class="example" id="example-cqs"> <a class="self-link" href="#example-cqs"></a> When creating a <a data-link-type="dfn" href="#readable-stream" id="ref-for-readable-stream①⑨">readable stream</a> or <a data-link-type="dfn" href="#writable-stream" id="ref-for-writable-stream①②">writable stream</a>, you can supply a count queuing strategy directly: <pre class="highlight"><c- a>const</c-> stream <c- o>=</c-> <c- ow>new</c-> ReadableStream<c- p>(</c-> <c- p>{</c-> <c- p>...</c-> <c- p>},</c-> <c- ow>new</c-> CountQueuingStrategy<c- p>({</c-> highWaterMark<c- o>:</c-> <c- mf>10</c-> <c- p>})</c-> <c- p>);</c-> </pre> <p>In this case, 10 <a data-link-type="dfn" href="#chunk" id="ref-for-chunk⑦⑦">chunks</a> (of any kind) can be enqueued by the readable stream’s <a data-link-type="dfn" href="#underlying-source" id="ref-for-underlying-source③①">underlying source</a> before the readable stream implementation starts sending <a data-link-type="dfn" href="#backpressure" id="ref-for-backpressure①⑧">backpressure</a> signals to the underlying source.</p> <pre class="highlight"><c- a>const</c-> stream <c- o>=</c-> <c- ow>new</c-> WritableStream<c- p>(</c-> <c- p>{</c-> <c- p>...</c-> <c- p>},</c-> <c- ow>new</c-> CountQueuingStrategy<c- p>({</c-> highWaterMark<c- o>:</c-> <c- mf>5</c-> <c- p>})</c-> <c- p>);</c-> </pre> <p>In this case, five <a data-link-type="dfn" href="#chunk" id="ref-for-chunk⑦⑧">chunks</a> (of any kind) can be accumulated in the writable stream’s internal queue, waiting for previous writes to the <a data-link-type="dfn" href="#underlying-sink" id="ref-for-underlying-sink③⑤">underlying sink</a> to finish, before the writable stream starts sending <a data-link-type="dfn" href="#backpressure" id="ref-for-backpressure①⑨">backpressure</a> signals to any <a data-link-type="dfn" href="#producer" id="ref-for-producer①③">producers</a>.</p> </div> <h4 class="heading settled" data-level="7.3.1" id="cqs-class-definition"><span class="secno">7.3.1. </span><span class="content">Interface definition</span><a class="self-link" href="#cqs-class-definition"></a></h4> <p>The Web IDL definition for the <code class="idl"><a data-link-type="idl" href="#countqueuingstrategy" id="ref-for-countqueuingstrategy⑥">CountQueuingStrategy</a></code> class is given as follows:</p> <pre class="idl highlight def">[Exposed=*] <c- b>interface</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="interface" data-export id="countqueuingstrategy"><code><c- g>CountQueuingStrategy</c-></code></dfn> { <a class="idl-code" data-link-type="constructor" href="#cqs-constructor" id="ref-for-cqs-constructor"><c- g>constructor</c-></a>(<a data-link-type="idl-name" href="#dictdef-queuingstrategyinit" id="ref-for-dictdef-queuingstrategyinit①"><c- n>QueuingStrategyInit</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="CountQueuingStrategy/CountQueuingStrategy(init), CountQueuingStrategy/constructor(init)" data-dfn-type="argument" data-export id="dom-countqueuingstrategy-countqueuingstrategy-init-init"><code><c- g>init</c-></code></dfn>); <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-unrestricted-double" id="ref-for-idl-unrestricted-double①⓪"><c- b>unrestricted</c-> <c- b>double</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="unrestricted double" href="#cqs-high-water-mark" id="ref-for-cqs-high-water-mark"><c- g>highWaterMark</c-></a>; <c- b>readonly</c-> <c- b>attribute</c-> <a data-link-type="idl-name" href="https://webidl.spec.whatwg.org/#Function" id="ref-for-Function③"><c- n>Function</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="Function" href="#cqs-size" id="ref-for-cqs-size"><c- g>size</c-></a>; }; </pre> <h4 class="heading settled" data-level="7.3.2" id="cqs-internal-slots"><span class="secno">7.3.2. </span><span class="content">Internal slots</span><a class="self-link" href="#cqs-internal-slots"></a></h4> <p>Instances of <code class="idl"><a data-link-type="idl" href="#countqueuingstrategy" id="ref-for-countqueuingstrategy⑦">CountQueuingStrategy</a></code> have a <dfn class="dfn-paneled" data-dfn-for="CountQueuingStrategy" data-dfn-type="dfn" data-noexport id="countqueuingstrategy-highwatermark">[[highWaterMark]]</dfn> internal slot, storing the value given in the constructor.</p> <div class="algorithm" data-algorithm="count queuing strategy size function"> Additionally, every <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#global-object" id="ref-for-global-object①">global object</a> <var>globalObject</var> has an associated <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="count queuing strategy size function" data-noexport id="count-queuing-strategy-size-function">count queuing strategy size function</dfn>, which is a <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#Function" id="ref-for-Function④">Function</a></code> whose value must be initialized as follows: <ol> <li data-md> <p>Let <var>steps</var> be the following steps:</p> <ol> <li data-md> <p>Return 1.</p> </ol> <li data-md> <p>Let <var>F</var> be ! <a data-link-type="abstract-op" href="https://tc39.es/ecma262/multipage/ordinary-and-exotic-objects-behaviours.html#sec-createbuiltinfunction" id="ref-for-sec-createbuiltinfunction①">CreateBuiltinFunction</a>(<var>steps</var>, 0, "<code>size</code>", « », <var>globalObject</var>’s <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#concept-relevant-realm" id="ref-for-concept-relevant-realm①">relevant Realm</a>).</p> <li data-md> <p>Set <var>globalObject</var>’s <a data-link-type="dfn" href="#count-queuing-strategy-size-function" id="ref-for-count-queuing-strategy-size-function">count queuing strategy size function</a> to a <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#Function" id="ref-for-Function⑤">Function</a></code> that represents a reference to <var>F</var>, with <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-callback-context" id="ref-for-dfn-callback-context①">callback context</a> equal to <var>globalObject</var>’s <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#relevant-settings-object" id="ref-for-relevant-settings-object①">relevant settings object</a>.</p> </ol> <p class="note" role="note">This design is somewhat historical. It is motivated by the desire to ensure that <code class="idl"><a data-link-type="idl" href="#cqs-size" id="ref-for-cqs-size①">size</a></code> is a function, not a method, i.e. it does not check its <code>this</code> value. See <a href="https://github.com/whatwg/streams/issues/1005">whatwg/streams#1005</a> and <a href="https://github.com/heycam/webidl/issues/819">heycam/webidl#819</a> for more background. </p> </div> <h4 class="heading settled" data-level="7.3.3" id="cqs-prototype"><span class="secno">7.3.3. </span><span class="content">Constructor and properties</span><a class="self-link" href="#cqs-prototype"></a></h4> <dl class="domintro non-normative"> <dt><code><var>strategy</var> = new <code class="idl"><a data-link-type="idl" href="#cqs-constructor" id="ref-for-cqs-constructor①">CountQueuingStrategy</a></code>({ <code class="idl"><a data-link-type="idl" href="#dom-queuingstrategyinit-highwatermark" id="ref-for-dom-queuingstrategyinit-highwatermark②">highWaterMark</a></code> })</code> <dd> <p>Creates a new <code class="idl"><a data-link-type="idl" href="#countqueuingstrategy" id="ref-for-countqueuingstrategy⑧">CountQueuingStrategy</a></code> with the provided <a data-link-type="dfn" href="#high-water-mark" id="ref-for-high-water-mark⑨">high water mark</a>. </p> <p>Note that the provided high water mark will not be validated ahead of time. Instead, if it is negative, NaN, or not a number, the resulting <code class="idl"><a data-link-type="idl" href="#countqueuingstrategy" id="ref-for-countqueuingstrategy⑨">CountQueuingStrategy</a></code> will cause the corresponding stream constructor to throw. </p> <dt><code><var>highWaterMark</var> = <var>strategy</var>.<code class="idl"><a data-link-type="idl" href="#cqs-high-water-mark" id="ref-for-cqs-high-water-mark①">highWaterMark</a></code></code> <dd> <p>Returns the <a data-link-type="dfn" href="#high-water-mark" id="ref-for-high-water-mark①⓪">high water mark</a> provided to the constructor. </p> <dt><code><var>strategy</var>.<code class="idl"><a data-link-type="idl" href="#cqs-size" id="ref-for-cqs-size②">size</a></code>(<var>chunk</var>)</code> <dd> <p>Measures the size of <var>chunk</var> by always returning 1. This ensures that the total queue size is a count of the number of chunks in the queue. </p> </dl> <div class="algorithm" data-algorithm="CountQueuingStrategy(init)" data-algorithm-for="CountQueuingStrategy"> The <dfn class="dfn-paneled idl-code" data-dfn-for="CountQueuingStrategy" data-dfn-type="constructor" data-export data-lt="CountQueuingStrategy(init)|constructor(init)" id="cqs-constructor"><code>new CountQueuingStrategy(<var>init</var>)</code></dfn> constructor steps are: <ol> <li data-md> <p>Set <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this①①④">this</a>.<a data-link-type="dfn" href="#countqueuingstrategy-highwatermark" id="ref-for-countqueuingstrategy-highwatermark">[[highWaterMark]]</a> to <var>init</var>["<code class="idl"><a data-link-type="idl" href="#dom-queuingstrategyinit-highwatermark" id="ref-for-dom-queuingstrategyinit-highwatermark③">highWaterMark</a></code>"].</p> </ol> </div> <div class="algorithm" data-algorithm="highWaterMark" data-algorithm-for="CountQueuingStrategy"> The <dfn class="dfn-paneled idl-code" data-dfn-for="CountQueuingStrategy" data-dfn-type="attribute" data-export id="cqs-high-water-mark"><code>highWaterMark</code></dfn> getter steps are: <ol> <li data-md> <p>Return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this①①⑤">this</a>.<a data-link-type="dfn" href="#countqueuingstrategy-highwatermark" id="ref-for-countqueuingstrategy-highwatermark①">[[highWaterMark]]</a>.</p> </ol> </div> <div class="algorithm" data-algorithm="size" data-algorithm-for="CountQueuingStrategy"> The <dfn class="dfn-paneled idl-code" data-dfn-for="CountQueuingStrategy" data-dfn-type="attribute" data-export id="cqs-size"><code>size</code></dfn> getter steps are: <ol> <li data-md> <p>Return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this①①⑥">this</a>'s <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#concept-relevant-global" id="ref-for-concept-relevant-global①">relevant global object</a>'s <a data-link-type="dfn" href="#count-queuing-strategy-size-function" id="ref-for-count-queuing-strategy-size-function①">count queuing strategy size function</a>.</p> </ol> </div> <h3 class="heading settled" data-level="7.4" id="qs-abstract-ops"><span class="secno">7.4. </span><span class="content">Abstract operations</span><a class="self-link" href="#qs-abstract-ops"></a></h3> <p>The following algorithms are used by the stream constructors to extract the relevant pieces from a <code class="idl"><a data-link-type="idl" href="#dictdef-queuingstrategy" id="ref-for-dictdef-queuingstrategy④">QueuingStrategy</a></code> dictionary.</p> <div class="algorithm" data-algorithm="ExtractHighWaterMark"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ExtractHighWaterMark" id="validate-and-normalize-high-water-mark">ExtractHighWaterMark(<var>strategy</var>, <var>defaultHWM</var>)</dfn> performs the following steps: <ol> <li data-md> <p>If <var>strategy</var>["<code class="idl"><a data-link-type="idl" href="#dom-queuingstrategy-highwatermark" id="ref-for-dom-queuingstrategy-highwatermark④">highWaterMark</a></code>"] does not <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#map-exists" id="ref-for-map-exists②③">exist</a>, return <var>defaultHWM</var>.</p> <li data-md> <p>Let <var>highWaterMark</var> be <var>strategy</var>["<code class="idl"><a data-link-type="idl" href="#dom-queuingstrategy-highwatermark" id="ref-for-dom-queuingstrategy-highwatermark⑤">highWaterMark</a></code>"].</p> <li data-md> <p>If <var>highWaterMark</var> is NaN or <var>highWaterMark</var> < 0, throw a <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#exceptiondef-rangeerror" id="ref-for-exceptiondef-rangeerror①⓪">RangeError</a></code> exception.</p> <li data-md> <p>Return <var>highWaterMark</var>.</p> </ol> <p class="note" role="note">+∞ is explicitly allowed as a valid <a data-link-type="dfn" href="#high-water-mark" id="ref-for-high-water-mark①①">high water mark</a>. It causes <a data-link-type="dfn" href="#backpressure" id="ref-for-backpressure②⓪">backpressure</a> to never be applied. </p> </div> <div class="algorithm" data-algorithm="ExtractSizeAlgorithm"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ExtractSizeAlgorithm" id="make-size-algorithm-from-size-function">ExtractSizeAlgorithm(<var>strategy</var>)</dfn> performs the following steps: <ol> <li data-md> <p>If <var>strategy</var>["<code class="idl"><a data-link-type="idl" href="#dom-queuingstrategy-size" id="ref-for-dom-queuingstrategy-size③">size</a></code>"] does not <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#map-exists" id="ref-for-map-exists②④">exist</a>, return an algorithm that returns 1.</p> <li data-md> <p>Return an algorithm that performs the following steps, taking a <var>chunk</var> argument:</p> <ol> <li data-md> <p>Return the result of <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#invoke-a-callback-function" id="ref-for-invoke-a-callback-function①⑧">invoking</a> <var>strategy</var>["<code class="idl"><a data-link-type="idl" href="#dom-queuingstrategy-size" id="ref-for-dom-queuingstrategy-size④">size</a></code>"] with argument list « <var>chunk</var> ».</p> </ol> </ol> </div> <h2 class="heading settled" data-level="8" id="other-stuff"><span class="secno">8. </span><span class="content">Supporting abstract operations</span><a class="self-link" href="#other-stuff"></a></h2> <p>The following abstract operations each support the implementation of more than one type of stream, and as such are not grouped under the major sections above.</p> <h3 class="heading settled" data-level="8.1" id="queue-with-sizes"><span class="secno">8.1. </span><span class="content">Queue-with-sizes</span><a class="self-link" href="#queue-with-sizes"></a></h3> <p>The streams in this specification use a "queue-with-sizes" data structure to store queued up values, along with their determined sizes. Various specification objects contain a queue-with-sizes, represented by the object having two paired internal slots, always named [[queue]] and [[queueTotalSize]]. [[queue]] is a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list" id="ref-for-list②⓪">list</a> of <a data-link-type="dfn" href="#value-with-size" id="ref-for-value-with-size">value-with-sizes</a>, and [[queueTotalSize]] is a JavaScript <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/multipage/numbers-and-dates.html#sec-number-objects" id="ref-for-sec-number-objects">Number</a></code>, i.e. a double-precision floating point number.</p> <p>The following abstract operations are used when operating on objects that contain queues-with-sizes, in order to ensure that the two internal slots stay synchronized.</p> <p class="warning">Due to the limited precision of floating-point arithmetic, the framework specified here, of keeping a running total in the [[queueTotalSize]] slot, is <em>not</em> equivalent to adding up the size of all <a data-link-type="dfn" href="#chunk" id="ref-for-chunk⑦⑨">chunks</a> in [[queue]]. (However, this only makes a difference when there is a huge (~10<sup>15</sup>) variance in size between chunks, or when trillions of chunks are enqueued.) </p> <p>In what follows, a <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="value-with-size">value-with-size</dfn> is a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#struct" id="ref-for-struct⑤">struct</a> with the two <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#struct-item" id="ref-for-struct-item①①">items</a> <dfn class="dfn-paneled" data-dfn-for="value-with-size" data-dfn-type="dfn" data-noexport id="value-with-size-value">value</dfn> and <dfn class="dfn-paneled" data-dfn-for="value-with-size" data-dfn-type="dfn" data-noexport id="value-with-size-size">size</dfn>.</p> <div class="algorithm" data-algorithm="DequeueValue"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="DequeueValue" id="dequeue-value">DequeueValue(<var>container</var>)</dfn> performs the following steps: <ol> <li data-md> <p class="assertion">Assert: <var>container</var> has [[queue]] and [[queueTotalSize]] internal slots.</p> <li data-md> <p class="assertion">Assert: <var>container</var>.[[queue]] is not <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-is-empty" id="ref-for-list-is-empty②①">empty</a>.</p> <li data-md> <p>Let <var>valueWithSize</var> be <var>container</var>.[[queue]][0].</p> <li data-md> <p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-remove" id="ref-for-list-remove⑦">Remove</a> <var>valueWithSize</var> from <var>container</var>.[[queue]].</p> <li data-md> <p>Set <var>container</var>.[[queueTotalSize]] to <var>container</var>.[[queueTotalSize]] − <var>valueWithSize</var>’s <a data-link-type="dfn" href="#value-with-size-size" id="ref-for-value-with-size-size">size</a>.</p> <li data-md> <p>If <var>container</var>.[[queueTotalSize]] < 0, set <var>container</var>.[[queueTotalSize]] to 0. (This can occur due to rounding errors.)</p> <li data-md> <p>Return <var>valueWithSize</var>’s <a data-link-type="dfn" href="#value-with-size-value" id="ref-for-value-with-size-value">value</a>.</p> </ol> </div> <div class="algorithm" data-algorithm="EnqueueValueWithSize"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="EnqueueValueWithSize" id="enqueue-value-with-size">EnqueueValueWithSize(<var>container</var>, <var>value</var>, <var>size</var>)</dfn> performs the following steps: <ol> <li data-md> <p class="assertion">Assert: <var>container</var> has [[queue]] and [[queueTotalSize]] internal slots.</p> <li data-md> <p>If ! <a data-link-type="abstract-op" href="#is-non-negative-number" id="ref-for-is-non-negative-number②">IsNonNegativeNumber</a>(<var>size</var>) is false, throw a <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#exceptiondef-rangeerror" id="ref-for-exceptiondef-rangeerror①①">RangeError</a></code> exception.</p> <li data-md> <p>If <var>size</var> is +∞, throw a <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#exceptiondef-rangeerror" id="ref-for-exceptiondef-rangeerror①②">RangeError</a></code> exception.</p> <li data-md> <p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-append" id="ref-for-list-append⑨">Append</a> a new <a data-link-type="dfn" href="#value-with-size" id="ref-for-value-with-size①">value-with-size</a> with <a data-link-type="dfn" href="#value-with-size-value" id="ref-for-value-with-size-value①">value</a> <var>value</var> and <a data-link-type="dfn" href="#value-with-size-size" id="ref-for-value-with-size-size①">size</a> <var>size</var> to <var>container</var>.[[queue]].</p> <li data-md> <p>Set <var>container</var>.[[queueTotalSize]] to <var>container</var>.[[queueTotalSize]] + <var>size</var>.</p> </ol> </div> <div class="algorithm" data-algorithm="PeekQueueValue"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="PeekQueueValue" id="peek-queue-value">PeekQueueValue(<var>container</var>)</dfn> performs the following steps: <ol> <li data-md> <p class="assertion">Assert: <var>container</var> has [[queue]] and [[queueTotalSize]] internal slots.</p> <li data-md> <p class="assertion">Assert: <var>container</var>.[[queue]] is not <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-is-empty" id="ref-for-list-is-empty②②">empty</a>.</p> <li data-md> <p>Let <var>valueWithSize</var> be <var>container</var>.[[queue]][0].</p> <li data-md> <p>Return <var>valueWithSize</var>’s <a data-link-type="dfn" href="#value-with-size-value" id="ref-for-value-with-size-value②">value</a>.</p> </ol> </div> <div class="algorithm" data-algorithm="ResetQueue"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="ResetQueue" id="reset-queue">ResetQueue(<var>container</var>)</dfn> performs the following steps: <ol> <li data-md> <p class="assertion">Assert: <var>container</var> has [[queue]] and [[queueTotalSize]] internal slots.</p> <li data-md> <p>Set <var>container</var>.[[queue]] to a new empty <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list" id="ref-for-list②①">list</a>.</p> <li data-md> <p>Set <var>container</var>.[[queueTotalSize]] to 0.</p> </ol> </div> <h3 class="heading settled" data-level="8.2" id="transferrable-streams"><span class="secno">8.2. </span><span class="content">Transferable streams</span><a class="self-link" href="#transferrable-streams"></a></h3> <p>Transferable streams are implemented using a special kind of identity transform which has the <a data-link-type="dfn" href="#writable-side" id="ref-for-writable-side①③">writable side</a> in one <a data-link-type="dfn" href="https://tc39.es/ecma262/#sec-code-realms" id="ref-for-sec-code-realms">realm</a> and the <a data-link-type="dfn" href="#readable-side" id="ref-for-readable-side①④">readable side</a> in another realm. The following abstract operations are used to implement these "cross-realm transforms".</p> <div class="algorithm" data-algorithm="CrossRealmTransformSendError"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="CrossRealmTransformSendError" id="abstract-opdef-crossrealmtransformsenderror">CrossRealmTransformSendError(<var>port</var>, <var>error</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Perform <a data-link-type="abstract-op" href="#abstract-opdef-packandpostmessage" id="ref-for-abstract-opdef-packandpostmessage">PackAndPostMessage</a>(<var>port</var>, "<code>error</code>", <var>error</var>), discarding the result.</p> </ol> <p class="note" role="note">As we are already in an errored state when this abstract operation is performed, we cannot handle further errors, so we just discard them.</p> </div> <div class="algorithm" data-algorithm="PackAndPostMessage"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="PackAndPostMessage" id="abstract-opdef-packandpostmessage">PackAndPostMessage(<var>port</var>, <var>type</var>, <var>value</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>message</var> be <a data-link-type="abstract-op" href="https://tc39.es/ecma262/multipage/ordinary-and-exotic-objects-behaviours.html#sec-ordinaryobjectcreate" id="ref-for-sec-ordinaryobjectcreate">OrdinaryObjectCreate</a>(null).</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="https://tc39.es/ecma262/multipage/abstract-operations.html#sec-createdataproperty" id="ref-for-sec-createdataproperty">CreateDataProperty</a>(<var>message</var>, "<code>type</code>", <var>type</var>).</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="https://tc39.es/ecma262/multipage/abstract-operations.html#sec-createdataproperty" id="ref-for-sec-createdataproperty①">CreateDataProperty</a>(<var>message</var>, "<code>value</code>", <var>value</var>).</p> <li data-md> <p>Let <var>targetPort</var> be the port with which <var>port</var> is entangled, if any; otherwise let it be null.</p> <li data-md> <p>Let <var>options</var> be «[ "<code>transfer</code>" → « » ]».</p> <li data-md> <p>Run the <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/web-messaging.html#message-port-post-message-steps" id="ref-for-message-port-post-message-steps">message port post message steps</a> providing <var>targetPort</var>, <var>message</var>, and <var>options</var>.</p> </ol> <p class="note" role="note">A JavaScript object is used for transfer to avoid having to duplicate the <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/web-messaging.html#message-port-post-message-steps" id="ref-for-message-port-post-message-steps①">message port post message steps</a>. The prototype of the object is set to null to avoid interference from <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-properties-of-the-object-prototype-object" id="ref-for-sec-properties-of-the-object-prototype-object">%Object.prototype%</a></code>.</p> </div> <div class="algorithm" data-algorithm="PackAndPostMessageHandlingError"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="PackAndPostMessageHandlingError" id="abstract-opdef-packandpostmessagehandlingerror">PackAndPostMessageHandlingError(<var>port</var>, <var>type</var>, <var>value</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>result</var> be <a data-link-type="abstract-op" href="#abstract-opdef-packandpostmessage" id="ref-for-abstract-opdef-packandpostmessage①">PackAndPostMessage</a>(<var>port</var>, <var>type</var>, <var>value</var>).</p> <li data-md> <p>If <var>result</var> is an abrupt completion,</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#abstract-opdef-crossrealmtransformsenderror" id="ref-for-abstract-opdef-crossrealmtransformsenderror">CrossRealmTransformSendError</a>(<var>port</var>, <var>result</var>.[[Value]]).</p> </ol> <li data-md> <p>Return <var>result</var> as a completion record.</p> </ol> </div> <div class="algorithm" data-algorithm="SetUpCrossRealmTransformReadable"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="SetUpCrossRealmTransformReadable" id="abstract-opdef-setupcrossrealmtransformreadable">SetUpCrossRealmTransformReadable(<var>stream</var>, <var>port</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#initialize-readable-stream" id="ref-for-initialize-readable-stream③">InitializeReadableStream</a>(<var>stream</var>).</p> <li data-md> <p>Let <var>controller</var> be a <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#new" id="ref-for-new②⓪">new</a> <code class="idl"><a data-link-type="idl" href="#readablestreamdefaultcontroller" id="ref-for-readablestreamdefaultcontroller①③">ReadableStreamDefaultController</a></code>.</p> <li data-md> <p>Add a handler for <var>port</var>’s <code class="idl"><a data-link-type="idl" href="https://html.spec.whatwg.org/multipage/indices.html#event-message" id="ref-for-event-message">message</a></code> event with the following steps:</p> <ol> <li data-md> <p>Let <var>data</var> be the data of the message.</p> <li data-md> <p class="assertion">Assert: <var>data</var> <a data-link-type="dfn" href="https://tc39.es/ecma262/#sec-object-type" id="ref-for-sec-object-type②">is an Object</a>.</p> <li data-md> <p>Let <var>type</var> be ! <a data-link-type="abstract-op" href="https://tc39.es/ecma262/multipage/abstract-operations.html#sec-get-o-p" id="ref-for-sec-get-o-p">Get</a>(<var>data</var>, "<code>type</code>").</p> <li data-md> <p>Let <var>value</var> be ! <a data-link-type="abstract-op" href="https://tc39.es/ecma262/multipage/abstract-operations.html#sec-get-o-p" id="ref-for-sec-get-o-p①">Get</a>(<var>data</var>, "<code>value</code>").</p> <li data-md> <p class="assertion">Assert: <var>type</var> <a data-link-type="dfn" href="https://tc39.es/ecma262/#sec-ecmascript-language-types-string-type" id="ref-for-sec-ecmascript-language-types-string-type">is a String</a>.</p> <li data-md> <p>If <var>type</var> is "<code>chunk</code>",</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-enqueue" id="ref-for-readable-stream-default-controller-enqueue⑤">ReadableStreamDefaultControllerEnqueue</a>(<var>controller</var>, <var>value</var>).</p> </ol> <li data-md> <p>Otherwise, if <var>type</var> is "<code>close</code>",</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-close" id="ref-for-readable-stream-default-controller-close⑥">ReadableStreamDefaultControllerClose</a>(<var>controller</var>).</p> <li data-md> <p>Disentangle <var>port</var>.</p> </ol> <li data-md> <p>Otherwise, if <var>type</var> is "<code>error</code>",</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-error" id="ref-for-readable-stream-default-controller-error①③">ReadableStreamDefaultControllerError</a>(<var>controller</var>, <var>value</var>).</p> <li data-md> <p>Disentangle <var>port</var>.</p> </ol> </ol> <li data-md> <p>Add a handler for <var>port</var>’s <code class="idl"><a data-link-type="idl" href="https://html.spec.whatwg.org/multipage/indices.html#event-messageerror" id="ref-for-event-messageerror">messageerror</a></code> event with the following steps:</p> <ol> <li data-md> <p>Let <var>error</var> be a new "<code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#datacloneerror" id="ref-for-datacloneerror④">DataCloneError</a></code>" <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#idl-DOMException" id="ref-for-idl-DOMException④">DOMException</a></code>.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#abstract-opdef-crossrealmtransformsenderror" id="ref-for-abstract-opdef-crossrealmtransformsenderror①">CrossRealmTransformSendError</a>(<var>port</var>, <var>error</var>).</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-error" id="ref-for-readable-stream-default-controller-error①④">ReadableStreamDefaultControllerError</a>(<var>controller</var>, <var>error</var>).</p> <li data-md> <p>Disentangle <var>port</var>.</p> </ol> <li data-md> <p>Enable <var>port</var>’s <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/web-messaging.html#port-message-queue" id="ref-for-port-message-queue">port message queue</a>.</p> <li data-md> <p>Let <var>startAlgorithm</var> be an algorithm that returns undefined.</p> <li data-md> <p>Let <var>pullAlgorithm</var> be the following steps:</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#abstract-opdef-packandpostmessage" id="ref-for-abstract-opdef-packandpostmessage②">PackAndPostMessage</a>(<var>port</var>, "<code>pull</code>", undefined).</p> <li data-md> <p>Return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-resolved-with" id="ref-for-a-promise-resolved-with③③">a promise resolved with</a> undefined.</p> </ol> <li data-md> <p>Let <var>cancelAlgorithm</var> be the following steps, taking a <var>reason</var> argument:</p> <ol> <li data-md> <p>Let <var>result</var> be <a data-link-type="abstract-op" href="#abstract-opdef-packandpostmessagehandlingerror" id="ref-for-abstract-opdef-packandpostmessagehandlingerror">PackAndPostMessageHandlingError</a>(<var>port</var>, "<code>error</code>", <var>reason</var>).</p> <li data-md> <p>Disentangle <var>port</var>.</p> <li data-md> <p>If <var>result</var> is an abrupt completion, return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-rejected-with" id="ref-for-a-promise-rejected-with③⑦">a promise rejected with</a> <var>result</var>.[[Value]].</p> <li data-md> <p>Otherwise, return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-resolved-with" id="ref-for-a-promise-resolved-with③④">a promise resolved with</a> undefined.</p> </ol> <li data-md> <p>Let <var>sizeAlgorithm</var> be an algorithm that returns 1.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#set-up-readable-stream-default-controller" id="ref-for-set-up-readable-stream-default-controller②">SetUpReadableStreamDefaultController</a>(<var>stream</var>, <var>controller</var>, <var>startAlgorithm</var>, <var>pullAlgorithm</var>, <var>cancelAlgorithm</var>, 0, <var>sizeAlgorithm</var>).</p> </ol> <p class="note" role="note">Implementations are encouraged to explicitly handle failures from the asserts in this algorithm, as the input might come from an untrusted context. Failure to do so could lead to security issues.</p> </div> <div class="algorithm" data-algorithm="SetUpCrossRealmTransformWritable"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="SetUpCrossRealmTransformWritable" id="abstract-opdef-setupcrossrealmtransformwritable">SetUpCrossRealmTransformWritable(<var>stream</var>, <var>port</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#initialize-writable-stream" id="ref-for-initialize-writable-stream②">InitializeWritableStream</a>(<var>stream</var>).</p> <li data-md> <p>Let <var>controller</var> be a <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#new" id="ref-for-new②①">new</a> <code class="idl"><a data-link-type="idl" href="#writablestreamdefaultcontroller" id="ref-for-writablestreamdefaultcontroller①⑤">WritableStreamDefaultController</a></code>.</p> <li data-md> <p>Let <var>backpressurePromise</var> be <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-new-promise" id="ref-for-a-new-promise①⑥">a new promise</a>.</p> <li data-md> <p>Add a handler for <var>port</var>’s <code class="idl"><a data-link-type="idl" href="https://html.spec.whatwg.org/multipage/indices.html#event-message" id="ref-for-event-message①">message</a></code> event with the following steps:</p> <ol> <li data-md> <p>Let <var>data</var> be the data of the message.</p> <li data-md> <p class="assertion">Assert: <var>data</var> <a data-link-type="dfn" href="https://tc39.es/ecma262/#sec-object-type" id="ref-for-sec-object-type③">is an Object</a>.</p> <li data-md> <p>Let <var>type</var> be ! <a data-link-type="abstract-op" href="https://tc39.es/ecma262/multipage/abstract-operations.html#sec-get-o-p" id="ref-for-sec-get-o-p②">Get</a>(<var>data</var>, "<code>type</code>").</p> <li data-md> <p>Let <var>value</var> be ! <a data-link-type="abstract-op" href="https://tc39.es/ecma262/multipage/abstract-operations.html#sec-get-o-p" id="ref-for-sec-get-o-p③">Get</a>(<var>data</var>, "<code>value</code>").</p> <li data-md> <p class="assertion">Assert: <var>type</var> <a data-link-type="dfn" href="https://tc39.es/ecma262/#sec-ecmascript-language-types-string-type" id="ref-for-sec-ecmascript-language-types-string-type①">is a String</a>.</p> <li data-md> <p>If <var>type</var> is "<code>pull</code>",</p> <ol> <li data-md> <p>If <var>backpressurePromise</var> is not undefined,</p> <ol> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#resolve" id="ref-for-resolve③③">Resolve</a> <var>backpressurePromise</var> with undefined.</p> <li data-md> <p>Set <var>backpressurePromise</var> to undefined.</p> </ol> </ol> <li data-md> <p>Otherwise, if <var>type</var> is "<code>error</code>",</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#writable-stream-default-controller-error-if-needed" id="ref-for-writable-stream-default-controller-error-if-needed⑤">WritableStreamDefaultControllerErrorIfNeeded</a>(<var>controller</var>, <var>value</var>).</p> <li data-md> <p>If <var>backpressurePromise</var> is not undefined,</p> <ol> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#resolve" id="ref-for-resolve③④">Resolve</a> <var>backpressurePromise</var> with undefined.</p> <li data-md> <p>Set <var>backpressurePromise</var> to undefined.</p> </ol> </ol> </ol> <li data-md> <p>Add a handler for <var>port</var>’s <code class="idl"><a data-link-type="idl" href="https://html.spec.whatwg.org/multipage/indices.html#event-messageerror" id="ref-for-event-messageerror①">messageerror</a></code> event with the following steps:</p> <ol> <li data-md> <p>Let <var>error</var> be a new "<code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#datacloneerror" id="ref-for-datacloneerror⑤">DataCloneError</a></code>" <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#idl-DOMException" id="ref-for-idl-DOMException⑤">DOMException</a></code>.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#abstract-opdef-crossrealmtransformsenderror" id="ref-for-abstract-opdef-crossrealmtransformsenderror②">CrossRealmTransformSendError</a>(<var>port</var>, <var>error</var>).</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#writable-stream-default-controller-error-if-needed" id="ref-for-writable-stream-default-controller-error-if-needed⑥">WritableStreamDefaultControllerErrorIfNeeded</a>(<var>controller</var>, <var>error</var>).</p> <li data-md> <p>Disentangle <var>port</var>.</p> </ol> <li data-md> <p>Enable <var>port</var>’s <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/web-messaging.html#port-message-queue" id="ref-for-port-message-queue①">port message queue</a>.</p> <li data-md> <p>Let <var>startAlgorithm</var> be an algorithm that returns undefined.</p> <li data-md> <p>Let <var>writeAlgorithm</var> be the following steps, taking a <var>chunk</var> argument:</p> <ol> <li data-md> <p>If <var>backpressurePromise</var> is undefined, set <var>backpressurePromise</var> to <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-resolved-with" id="ref-for-a-promise-resolved-with③⑤">a promise resolved with</a> undefined.</p> <li data-md> <p>Return the result of <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-perform-steps-once-promise-is-settled" id="ref-for-dfn-perform-steps-once-promise-is-settled⑧">reacting</a> to <var>backpressurePromise</var> with the following fulfillment steps:</p> <ol> <li data-md> <p>Set <var>backpressurePromise</var> to <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-new-promise" id="ref-for-a-new-promise①⑦">a new promise</a>.</p> <li data-md> <p>Let <var>result</var> be <a data-link-type="abstract-op" href="#abstract-opdef-packandpostmessagehandlingerror" id="ref-for-abstract-opdef-packandpostmessagehandlingerror①">PackAndPostMessageHandlingError</a>(<var>port</var>, "<code>chunk</code>", <var>chunk</var>).</p> <li data-md> <p>If <var>result</var> is an abrupt completion,</p> <ol> <li data-md> <p>Disentangle <var>port</var>.</p> <li data-md> <p>Return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-rejected-with" id="ref-for-a-promise-rejected-with③⑧">a promise rejected with</a> <var>result</var>.[[Value]].</p> </ol> <li data-md> <p>Otherwise, return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-resolved-with" id="ref-for-a-promise-resolved-with③⑥">a promise resolved with</a> undefined.</p> </ol> </ol> <li data-md> <p>Let <var>closeAlgorithm</var> be the folowing steps:</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#abstract-opdef-packandpostmessage" id="ref-for-abstract-opdef-packandpostmessage③">PackAndPostMessage</a>(<var>port</var>, "<code>close</code>", undefined).</p> <li data-md> <p>Disentangle <var>port</var>.</p> <li data-md> <p>Return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-resolved-with" id="ref-for-a-promise-resolved-with③⑦">a promise resolved with</a> undefined.</p> </ol> <li data-md> <p>Let <var>abortAlgorithm</var> be the following steps, taking a <var>reason</var> argument:</p> <ol> <li data-md> <p>Let <var>result</var> be <a data-link-type="abstract-op" href="#abstract-opdef-packandpostmessagehandlingerror" id="ref-for-abstract-opdef-packandpostmessagehandlingerror②">PackAndPostMessageHandlingError</a>(<var>port</var>, "<code>error</code>", <var>reason</var>).</p> <li data-md> <p>Disentangle <var>port</var>.</p> <li data-md> <p>If <var>result</var> is an abrupt completion, return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-rejected-with" id="ref-for-a-promise-rejected-with③⑨">a promise rejected with</a> <var>result</var>.[[Value]].</p> <li data-md> <p>Otherwise, return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-resolved-with" id="ref-for-a-promise-resolved-with③⑧">a promise resolved with</a> undefined.</p> </ol> <li data-md> <p>Let <var>sizeAlgorithm</var> be an algorithm that returns 1.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#set-up-writable-stream-default-controller" id="ref-for-set-up-writable-stream-default-controller②">SetUpWritableStreamDefaultController</a>(<var>stream</var>, <var>controller</var>, <var>startAlgorithm</var>, <var>writeAlgorithm</var>, <var>closeAlgorithm</var>, <var>abortAlgorithm</var>, 1, <var>sizeAlgorithm</var>).</p> </ol> <p class="note" role="note">Implementations are encouraged to explicitly handle failures from the asserts in this algorithm, as the input might come from an untrusted context. Failure to do so could lead to security issues.</p> </div> <h3 class="heading settled" data-level="8.3" id="misc-abstract-ops"><span class="secno">8.3. </span><span class="content">Miscellaneous</span><a class="self-link" href="#misc-abstract-ops"></a></h3> <p>The following abstract operations are a grab-bag of utilities.</p> <div class="algorithm" data-algorithm="CanTransferArrayBuffer"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="CanTransferArrayBuffer" id="can-transfer-array-buffer">CanTransferArrayBuffer(<var>O</var>)</dfn> performs the following steps: <ol> <li data-md> <p class="assertion">Assert: <var>O</var> <a data-link-type="dfn" href="https://tc39.es/ecma262/#sec-object-type" id="ref-for-sec-object-type④">is an Object</a>.</p> <li data-md> <p class="assertion">Assert: <var>O</var> has an [[ArrayBufferData]] internal slot.</p> <li data-md> <p>If ! <a data-link-type="abstract-op" href="https://tc39.es/ecma262/multipage/structured-data.html#sec-isdetachedbuffer" id="ref-for-sec-isdetachedbuffer⑦">IsDetachedBuffer</a>(<var>O</var>) is true, return false.</p> <li data-md> <p>If <a data-link-type="abstract-op" href="https://tc39.es/ecma262/multipage/abstract-operations.html#sec-samevalue" id="ref-for-sec-samevalue">SameValue</a>(<var>O</var>.[[ArrayBufferDetachKey]], undefined) is false, return false.</p> <li data-md> <p>Return true.</p> </ol> </div> <div class="algorithm" data-algorithm="IsNonNegativeNumber"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="IsNonNegativeNumber" id="is-non-negative-number">IsNonNegativeNumber(<var>v</var>)</dfn> performs the following steps: <ol> <li data-md> <p>If <var>v</var> <a data-link-type="dfn" href="https://tc39.es/ecma262/#sec-ecmascript-language-types-number-type" id="ref-for-sec-ecmascript-language-types-number-type①">is not a Number</a>, return false.</p> <li data-md> <p>If <var>v</var> is NaN, return false.</p> <li data-md> <p>If <var>v</var> < 0, return false.</p> <li data-md> <p>Return true.</p> </ol> </div> <div class="algorithm" data-algorithm="TransferArrayBuffer"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="TransferArrayBuffer" id="transfer-array-buffer">TransferArrayBuffer(<var>O</var>)</dfn> performs the following steps: <ol> <li data-md> <p class="assertion">Assert: ! <a data-link-type="abstract-op" href="https://tc39.es/ecma262/multipage/structured-data.html#sec-isdetachedbuffer" id="ref-for-sec-isdetachedbuffer⑧">IsDetachedBuffer</a>(<var>O</var>) is false.</p> <li data-md> <p>Let <var>arrayBufferData</var> be <var>O</var>.[[ArrayBufferData]].</p> <li data-md> <p>Let <var>arrayBufferByteLength</var> be <var>O</var>.[[ArrayBufferByteLength]].</p> <li data-md> <p>Perform ? <a data-link-type="abstract-op" href="https://tc39.es/ecma262/multipage/structured-data.html#sec-detacharraybuffer" id="ref-for-sec-detacharraybuffer">DetachArrayBuffer</a>(<var>O</var>).</p> <p class="note" role="note">This will throw an exception if <var>O</var> has an [[ArrayBufferDetachKey]] that is not undefined, such as a <code class="idl"><a data-link-type="idl" href="https://webassembly.github.io/spec/js-api/#memory" id="ref-for-memory">WebAssembly.Memory</a></code>'s <code class="idl"><a data-link-type="idl" href="https://webassembly.github.io/spec/js-api/#dom-memory-buffer" id="ref-for-dom-memory-buffer">buffer</a></code>. <a data-link-type="biblio" href="#biblio-wasm-js-api-1" title="WebAssembly JavaScript Interface">[WASM-JS-API-1]</a></p> <li data-md> <p>Return a new <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-arraybuffer-objects" id="ref-for-sec-arraybuffer-objects⑤">ArrayBuffer</a></code> object, created in <a data-link-type="dfn" href="https://tc39.es/ecma262/#current-realm" id="ref-for-current-realm①⓪">the current Realm</a>, whose [[ArrayBufferData]] internal slot value is <var>arrayBufferData</var> and whose [[ArrayBufferByteLength]] internal slot value is <var>arrayBufferByteLength</var>.</p> </ol> </div> <div class="algorithm" data-algorithm="CloneAsUint8Array"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="CloneAsUint8Array" id="abstract-opdef-cloneasuint8array">CloneAsUint8Array(<var>O</var>)</dfn> performs the following steps: <ol> <li data-md> <p class="assertion">Assert: <var>O</var> <a data-link-type="dfn" href="https://tc39.es/ecma262/#sec-object-type" id="ref-for-sec-object-type⑤">is an Object</a>.</p> <li data-md> <p class="assertion">Assert: <var>O</var> has an [[ViewedArrayBuffer]] internal slot.</p> <li data-md> <p class="assertion">Assert: ! <a data-link-type="abstract-op" href="https://tc39.es/ecma262/multipage/structured-data.html#sec-isdetachedbuffer" id="ref-for-sec-isdetachedbuffer⑨">IsDetachedBuffer</a>(<var>O</var>.[[ViewedArrayBuffer]]) is false.</p> <li data-md> <p>Let <var>buffer</var> be ? <a data-link-type="abstract-op" href="https://tc39.es/ecma262/multipage/structured-data.html#sec-clonearraybuffer" id="ref-for-sec-clonearraybuffer①">CloneArrayBuffer</a>(<var>O</var>.[[ViewedArrayBuffer]], <var>O</var>.[[ByteOffset]], <var>O</var>.[[ByteLength]], <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/multipage/structured-data.html#sec-arraybuffer-constructor" id="ref-for-sec-arraybuffer-constructor②">%ArrayBuffer%</a></code>).</p> <li data-md> <p>Let <var>array</var> be ! <a data-link-type="abstract-op" href="https://tc39.es/ecma262/multipage/abstract-operations.html#sec-construct" id="ref-for-sec-construct⑥">Construct</a>(<code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/multipage/indexed-collections.html#sec-typedarray-objects" id="ref-for-sec-typedarray-objects⑦">%Uint8Array%</a></code>, « <var>buffer</var> »).</p> <li data-md> <p>Return <var>array</var>.</p> </ol> </div> <div class="algorithm" data-algorithm="StructuredClone"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="StructuredClone" id="abstract-opdef-structuredclone">StructuredClone(<var>v</var>)</dfn> performs the following steps: <ol> <li data-md> <p>Let <var>serialized</var> be ? <a data-link-type="abstract-op" href="https://html.spec.whatwg.org/multipage/structured-data.html#structuredserialize" id="ref-for-structuredserialize">StructuredSerialize</a>(<var>v</var>).</p> <li data-md> <p>Return ? <a data-link-type="abstract-op" href="https://html.spec.whatwg.org/multipage/structured-data.html#structureddeserialize" id="ref-for-structureddeserialize">StructuredDeserialize</a>(<var>serialized</var>, <a data-link-type="dfn" href="https://tc39.es/ecma262/#current-realm" id="ref-for-current-realm①①">the current Realm</a>).</p> </ol> </div> <div class="algorithm" data-algorithm="CanCopyDataBlockBytes"> <dfn class="dfn-paneled" data-dfn-type="abstract-op" data-export data-lt="CanCopyDataBlockBytes" id="abstract-opdef-cancopydatablockbytes">CanCopyDataBlockBytes(<var>toBuffer</var>, <var>toIndex</var>, <var>fromBuffer</var>, <var>fromIndex</var>, <var>count</var>)</dfn> performs the following steps: <ol> <li data-md> <p class="assertion">Assert: <var>toBuffer</var> <a data-link-type="dfn" href="https://tc39.es/ecma262/#sec-object-type" id="ref-for-sec-object-type⑥">is an Object</a>.</p> <li data-md> <p class="assertion">Assert: <var>toBuffer</var> has an [[ArrayBufferData]] internal slot.</p> <li data-md> <p class="assertion">Assert: <var>fromBuffer</var> <a data-link-type="dfn" href="https://tc39.es/ecma262/#sec-object-type" id="ref-for-sec-object-type⑦">is an Object</a>.</p> <li data-md> <p class="assertion">Assert: <var>fromBuffer</var> has an [[ArrayBufferData]] internal slot.</p> <li data-md> <p>If <var>toBuffer</var> is <var>fromBuffer</var>, return false.</p> <li data-md> <p>If ! <a data-link-type="abstract-op" href="https://tc39.es/ecma262/multipage/structured-data.html#sec-isdetachedbuffer" id="ref-for-sec-isdetachedbuffer①⓪">IsDetachedBuffer</a>(<var>toBuffer</var>) is true, return false.</p> <li data-md> <p>If ! <a data-link-type="abstract-op" href="https://tc39.es/ecma262/multipage/structured-data.html#sec-isdetachedbuffer" id="ref-for-sec-isdetachedbuffer①①">IsDetachedBuffer</a>(<var>fromBuffer</var>) is true, return false.</p> <li data-md> <p>If <var>toIndex</var> + <var>count</var> > <var>toBuffer</var>.[[ArrayBufferByteLength]], return false.</p> <li data-md> <p>If <var>fromIndex</var> + <var>count</var> > <var>fromBuffer</var>.[[ArrayBufferByteLength]], return false.</p> <li data-md> <p>Return true.</p> </ol> </div> <h2 class="heading settled" data-level="9" id="other-specs"><span class="secno">9. </span><span class="content">Using streams in other specifications</span><a class="self-link" href="#other-specs"></a></h2> <p>Much of this standard concerns itself with the internal machinery of streams. Other specifications generally do not need to worry about these details. Instead, they should interface with this standard via the various IDL types it defines, along with the following definitions.</p> <p>Specifications should not directly inspect or manipulate the various internal slots defined in this standard. Similarly, they should not use the abstract operations defined here. Such direct usage can break invariants that this standard otherwise maintains.</p> <p class="note" role="note">If your specification wants to interface with streams in a way not supported here, <a href="https://github.com/whatwg/streams/issues/new">file an issue</a>. This section is intended to grow organically as needed. </p> <h3 class="heading settled" data-level="9.1" id="other-specs-rs"><span class="secno">9.1. </span><span class="content">Readable streams</span><a class="self-link" href="#other-specs-rs"></a></h3> <h4 class="heading settled" data-level="9.1.1" id="other-specs-rs-create"><span class="secno">9.1.1. </span><span class="content">Creation and manipulation</span><a class="self-link" href="#other-specs-rs-create"></a></h4> <div class="algorithm" data-algorithm="set up a ReadableStream"> To <dfn class="dfn-paneled" data-dfn-for="ReadableStream" data-dfn-type="dfn" data-export id="readablestream-set-up">set up</dfn> a newly-<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#new" id="ref-for-new②②">created-via-Web IDL</a> <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream⑤④">ReadableStream</a></code> object <var>stream</var>, given an optional algorithm <dfn class="dfn-paneled" data-dfn-for="ReadableStream/set up" data-dfn-type="dfn" data-export id="readablestream-set-up-pullalgorithm"><var>pullAlgorithm</var></dfn>, an optional algorithm <dfn class="dfn-paneled" data-dfn-for="ReadableStream/set up" data-dfn-type="dfn" data-export id="readablestream-set-up-cancelalgorithm"><var>cancelAlgorithm</var></dfn>, an optional number <dfn class="dfn-paneled" data-dfn-for="ReadableStream/set up" data-dfn-type="dfn" data-export id="readablestream-set-up-highwatermark"><var>highWaterMark</var></dfn> (default 1), and an optional algorithm <dfn class="dfn-paneled" data-dfn-for="ReadableStream/set up" data-dfn-type="dfn" data-export id="readablestream-set-up-sizealgorithm"><var>sizeAlgorithm</var></dfn>, perform the following steps. If given, <var>pullAlgorithm</var> and <var>cancelAlgorithm</var> may return a promise. If given, <var>sizeAlgorithm</var> must be an algorithm accepting <a data-link-type="dfn" href="#chunk" id="ref-for-chunk⑧⓪">chunk</a> objects and returning a number; and if given, <var>highWaterMark</var> must be a non-negative, non-NaN number. <ol> <li data-md> <p>Let <var>startAlgorithm</var> be an algorithm that returns undefined.</p> <li data-md> <p>Let <var>pullAlgorithmWrapper</var> be an algorithm that runs these steps:</p> <ol> <li data-md> <p>Let <var>result</var> be the result of running <var>pullAlgorithm</var>, if <var>pullAlgorithm</var> was given, or null otherwise. If this throws an exception <var>e</var>, return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-rejected-with" id="ref-for-a-promise-rejected-with④⓪">a promise rejected with</a> <var>e</var>.</p> <li data-md> <p>If <var>result</var> is a <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#idl-promise" id="ref-for-idl-promise②①">Promise</a></code>, then return <var>result</var>.</p> <li data-md> <p>Return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-resolved-with" id="ref-for-a-promise-resolved-with③⑨">a promise resolved with</a> undefined.</p> </ol> <li data-md> <p>Let <var>cancelAlgorithmWrapper</var> be an algorithm that runs these steps given <var>reason</var>:</p> <ol> <li data-md> <p>Let <var>result</var> be the result of running <var>cancelAlgorithm</var> given <var>reason</var>, if <var>cancelAlgorithm</var> was given, or null otherwise. If this throws an exception <var>e</var>, return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-rejected-with" id="ref-for-a-promise-rejected-with④①">a promise rejected with</a> <var>e</var>.</p> <li data-md> <p>If <var>result</var> is a <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#idl-promise" id="ref-for-idl-promise②②">Promise</a></code>, then return <var>result</var>.</p> <li data-md> <p>Return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-resolved-with" id="ref-for-a-promise-resolved-with④⓪">a promise resolved with</a> undefined.</p> </ol> <li data-md> <p>If <var>sizeAlgorithm</var> was not given, then set it to an algorithm that returns 1.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#initialize-readable-stream" id="ref-for-initialize-readable-stream④">InitializeReadableStream</a>(<var>stream</var>).</p> <li data-md> <p>Let <var>controller</var> be a <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#new" id="ref-for-new②③">new</a> <code class="idl"><a data-link-type="idl" href="#readablestreamdefaultcontroller" id="ref-for-readablestreamdefaultcontroller①④">ReadableStreamDefaultController</a></code>.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#set-up-readable-stream-default-controller" id="ref-for-set-up-readable-stream-default-controller③">SetUpReadableStreamDefaultController</a>(<var>stream</var>, <var>controller</var>, <var>startAlgorithm</var>, <var>pullAlgorithmWrapper</var>, <var>cancelAlgorithmWrapper</var>, <var>highWaterMark</var>, <var>sizeAlgorithm</var>).</p> </ol> </div> <div class="algorithm" data-algorithm="set up a byte-source ReadableStream"> To <dfn class="dfn-paneled" data-dfn-for="ReadableStream" data-dfn-type="dfn" data-export id="readablestream-set-up-with-byte-reading-support">set up with byte reading support</dfn> a newly-<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#new" id="ref-for-new②④">created-via-Web IDL</a> <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream⑤⑤">ReadableStream</a></code> object <var>stream</var>, given an optional algorithm <dfn class="dfn-paneled" data-dfn-for="ReadableStream/set up with byte reading support" data-dfn-type="dfn" data-export id="readablestream-set-up-with-byte-reading-support-pullalgorithm"><var>pullAlgorithm</var></dfn>, an optional algorithm <dfn class="dfn-paneled" data-dfn-for="ReadableStream/set up with byte reading support" data-dfn-type="dfn" data-export id="readablestream-set-up-with-byte-reading-support-cancelalgorithm"><var>cancelAlgorithm</var></dfn>, and an optional number <dfn class="dfn-paneled" data-dfn-for="ReadableStream/set up with byte reading support" data-dfn-type="dfn" data-export id="readablestream-set-up-with-byte-reading-support-highwatermark"><var>highWaterMark</var></dfn> (default 0), perform the following steps. If given, <var>pullAlgorithm</var> and <var>cancelAlgorithm</var> may return a promise. If given, <var>highWaterMark</var> must be a non-negative, non-NaN number. <ol> <li data-md> <p>Let <var>startAlgorithm</var> be an algorithm that returns undefined.</p> <li data-md> <p>Let <var>pullAlgorithmWrapper</var> be an algorithm that runs these steps:</p> <ol> <li data-md> <p>Let <var>result</var> be the result of running <var>pullAlgorithm</var>, if <var>pullAlgorithm</var> was given, or null otherwise. If this throws an exception <var>e</var>, return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-rejected-with" id="ref-for-a-promise-rejected-with④②">a promise rejected with</a> <var>e</var>.</p> <li data-md> <p>If <var>result</var> is a <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#idl-promise" id="ref-for-idl-promise②③">Promise</a></code>, then return <var>result</var>.</p> <li data-md> <p>Return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-resolved-with" id="ref-for-a-promise-resolved-with④①">a promise resolved with</a> undefined.</p> </ol> <li data-md> <p>Let <var>cancelAlgorithmWrapper</var> be an algorithm that runs these steps:</p> <ol> <li data-md> <p>Let <var>result</var> be the result of running <var>cancelAlgorithm</var>, if <var>cancelAlgorithm</var> was given, or null otherwise. If this throws an exception <var>e</var>, return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-rejected-with" id="ref-for-a-promise-rejected-with④③">a promise rejected with</a> <var>e</var>.</p> <li data-md> <p>If <var>result</var> is a <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#idl-promise" id="ref-for-idl-promise②④">Promise</a></code>, then return <var>result</var>.</p> <li data-md> <p>Return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-resolved-with" id="ref-for-a-promise-resolved-with④②">a promise resolved with</a> undefined.</p> </ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#initialize-readable-stream" id="ref-for-initialize-readable-stream⑤">InitializeReadableStream</a>(<var>stream</var>).</p> <li data-md> <p>Let <var>controller</var> be a <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#new" id="ref-for-new②⑤">new</a> <code class="idl"><a data-link-type="idl" href="#readablebytestreamcontroller" id="ref-for-readablebytestreamcontroller①⑨">ReadableByteStreamController</a></code>.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#set-up-readable-byte-stream-controller" id="ref-for-set-up-readable-byte-stream-controller②">SetUpReadableByteStreamController</a>(<var>stream</var>, <var>controller</var>, <var>startAlgorithm</var>, <var>pullAlgorithmWrapper</var>, <var>cancelAlgorithmWrapper</var>, <var>highWaterMark</var>, undefined).</p> </ol> </div> <div class="example" id="example-set-up-rs"> <a class="self-link" href="#example-set-up-rs"></a> Creating a <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream⑤⑥">ReadableStream</a></code> from other specifications is thus a two-step process, like so: <ol> <li data-md> <p>Let <var>readableStream</var> be a <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#new" id="ref-for-new②⑥">new</a> <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream⑤⑦">ReadableStream</a></code>.</p> <li data-md> <p><a data-link-type="dfn" href="#readablestream-set-up" id="ref-for-readablestream-set-up">Set up</a> <var>readableStream</var> given….</p> </ol> </div> <p class="note" role="note">Subclasses of <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream⑤⑧">ReadableStream</a></code> will use the <a data-link-type="dfn" href="#readablestream-set-up" id="ref-for-readablestream-set-up①">set up</a> or <a data-link-type="dfn" href="#readablestream-set-up-with-byte-reading-support" id="ref-for-readablestream-set-up-with-byte-reading-support">set up with byte reading support</a> operations directly on the <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this①①⑦">this</a> value inside their constructor steps. </p> <hr> <p>The following algorithms must only be used on <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream⑤⑨">ReadableStream</a></code> instances initialized via the above <a data-link-type="dfn" href="#readablestream-set-up" id="ref-for-readablestream-set-up②">set up</a> or <a data-link-type="dfn" href="#readablestream-set-up-with-byte-reading-support" id="ref-for-readablestream-set-up-with-byte-reading-support①">set up with byte reading support</a> algorithms (not, e.g., on web-developer-created instances):</p> <div class="algorithm" data-algorithm="desired size to fill up to the high water mark" data-algorithm-for="ReadableStream"> A <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream⑥⓪">ReadableStream</a></code> <var>stream</var>’s <dfn class="dfn-paneled" data-dfn-for="ReadableStream" data-dfn-type="dfn" data-export data-lt="desired size to fill up to the high water mark" id="readablestream-desired-size-to-fill-up-to-the-high-water-mark">desired size to fill up to the high water mark</dfn> is the result of running the following steps: <ol> <li data-md> <p>If <var>stream</var> is not <a data-link-type="dfn" href="#readablestream-readable" id="ref-for-readablestream-readable">readable</a>, then return 0.</p> <li data-md> <p>If <var>stream</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller⑤④">[[controller]]</a> <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#implements" id="ref-for-implements②④">implements</a> <code class="idl"><a data-link-type="idl" href="#readablebytestreamcontroller" id="ref-for-readablebytestreamcontroller②⓪">ReadableByteStreamController</a></code>, then return ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-get-desired-size" id="ref-for-readable-byte-stream-controller-get-desired-size②">ReadableByteStreamControllerGetDesiredSize</a>(<var>stream</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller⑤⑤">[[controller]]</a>).</p> <li data-md> <p>Return ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-get-desired-size" id="ref-for-readable-stream-default-controller-get-desired-size③">ReadableStreamDefaultControllerGetDesiredSize</a>(<var>stream</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller⑤⑥">[[controller]]</a>).</p> </ol> </div> <p class="algorithm" data-algorithm="need more data" data-algorithm-for="ReadableStream">A <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream⑥①">ReadableStream</a></code> <dfn class="dfn-paneled" data-dfn-for="ReadableStream" data-dfn-type="dfn" data-export data-lt="need more data|needs more data" id="readablestream-need-more-data">needs more data</dfn> if its <a data-link-type="dfn" href="#readablestream-desired-size-to-fill-up-to-the-high-water-mark" id="ref-for-readablestream-desired-size-to-fill-up-to-the-high-water-mark">desired size to fill up to the high water mark</a> is greater than zero. </p> <div class="algorithm" data-algorithm="close" data-algorithm-for="ReadableStream"> To <dfn class="dfn-paneled" data-dfn-for="ReadableStream" data-dfn-type="dfn" data-export id="readablestream-close">close</dfn> a <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream⑥②">ReadableStream</a></code> <var>stream</var>: <ol> <li data-md> <p>If <var>stream</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller⑤⑦">[[controller]]</a> <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#implements" id="ref-for-implements②⑤">implements</a> <code class="idl"><a data-link-type="idl" href="#readablebytestreamcontroller" id="ref-for-readablebytestreamcontroller②①">ReadableByteStreamController</a></code>,</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-close" id="ref-for-readable-byte-stream-controller-close⑤">ReadableByteStreamControllerClose</a>(<var>stream</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller⑤⑧">[[controller]]</a>).</p> <li data-md> <p>If <var>stream</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller⑤⑨">[[controller]]</a>.<a data-link-type="dfn" href="#readablebytestreamcontroller-pendingpullintos" id="ref-for-readablebytestreamcontroller-pendingpullintos③②">[[pendingPullIntos]]</a> is not <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-is-empty" id="ref-for-list-is-empty②③">empty</a>, perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-respond" id="ref-for-readable-byte-stream-controller-respond④">ReadableByteStreamControllerRespond</a>(<var>stream</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller⑥⓪">[[controller]]</a>, 0).</p> </ol> <li data-md> <p>Otherwise, perform ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-close" id="ref-for-readable-stream-default-controller-close⑦">ReadableStreamDefaultControllerClose</a>(<var>stream</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller⑥①">[[controller]]</a>).</p> </ol> </div> <div class="algorithm" data-algorithm="error" data-algorithm-for="ReadableStream"> To <dfn class="dfn-paneled" data-dfn-for="ReadableStream" data-dfn-type="dfn" data-export id="readablestream-error">error</dfn> a <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream⑥③">ReadableStream</a></code> <var>stream</var> given a JavaScript value <var>e</var>: <ol> <li data-md> <p>If <var>stream</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller⑥②">[[controller]]</a> <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#implements" id="ref-for-implements②⑥">implements</a> <code class="idl"><a data-link-type="idl" href="#readablebytestreamcontroller" id="ref-for-readablebytestreamcontroller②②">ReadableByteStreamController</a></code>, then perform ! <a data-link-type="abstract-op" href="#readable-byte-stream-controller-error" id="ref-for-readable-byte-stream-controller-error①③">ReadableByteStreamControllerError</a>(<var>stream</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller⑥③">[[controller]]</a>, <var>e</var>).</p> <li data-md> <p>Otherwise, perform ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-error" id="ref-for-readable-stream-default-controller-error①⑤">ReadableStreamDefaultControllerError</a>(<var>stream</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller⑥④">[[controller]]</a>, <var>e</var>).</p> </ol> </div> <div class="algorithm" data-algorithm="enqueue" data-algorithm-for="ReadableStream"> To <dfn class="dfn-paneled" data-dfn-for="ReadableStream" data-dfn-type="dfn" data-export id="readablestream-enqueue">enqueue</dfn> the JavaScript value <var>chunk</var> into a <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream⑥④">ReadableStream</a></code> <var>stream</var>: <ol> <li data-md> <p>If <var>stream</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller⑥⑤">[[controller]]</a> <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#implements" id="ref-for-implements②⑦">implements</a> <code class="idl"><a data-link-type="idl" href="#readablestreamdefaultcontroller" id="ref-for-readablestreamdefaultcontroller①⑤">ReadableStreamDefaultController</a></code>,</p> <ol> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-default-controller-enqueue" id="ref-for-readable-stream-default-controller-enqueue⑥">ReadableStreamDefaultControllerEnqueue</a>(<var>stream</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller⑥⑥">[[controller]]</a>, <var>chunk</var>).</p> </ol> <li data-md> <p>Otherwise,</p> <ol> <li data-md> <p class="assertion">Assert: <var>stream</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller⑥⑦">[[controller]]</a> <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#implements" id="ref-for-implements②⑧">implements</a> <code class="idl"><a data-link-type="idl" href="#readablebytestreamcontroller" id="ref-for-readablebytestreamcontroller②③">ReadableByteStreamController</a></code>.</p> <li data-md> <p class="assertion">Assert: <var>chunk</var> is an <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#ArrayBufferView" id="ref-for-ArrayBufferView⑥">ArrayBufferView</a></code>.</p> <li data-md> <p>Let <var>byobView</var> be the <a data-link-type="dfn" href="#readablestream-current-byob-request-view" id="ref-for-readablestream-current-byob-request-view">current BYOB request view</a> for <var>stream</var>.</p> <li data-md> <p>If <var>byobView</var> is non-null, and <var>chunk</var>.[[ViewedArrayBuffer]] is <var>byobView</var>.[[ViewedArrayBuffer]], then:</p> <ol> <li data-md> <p class="assertion">Assert: <var>chunk</var>.[[ByteOffset]] is <var>byobView</var>.[[ByteOffset]].</p> <li data-md> <p class="assertion">Assert: <var>chunk</var>.[[ByteLength]] ≤ <var>byobView</var>.[[ByteLength]].</p> <p class="note" role="note">These asserts ensure that the caller does not write outside the requested range in the <a data-link-type="dfn" href="#readablestream-current-byob-request-view" id="ref-for-readablestream-current-byob-request-view①">current BYOB request view</a>. </p> <li data-md> <p>Perform ? <a data-link-type="abstract-op" href="#readable-byte-stream-controller-respond" id="ref-for-readable-byte-stream-controller-respond⑤">ReadableByteStreamControllerRespond</a>(<var>stream</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller⑥⑧">[[controller]]</a>, <var>chunk</var>.[[ByteLength]]).</p> </ol> <li data-md> <p>Otherwise, perform ? <a data-link-type="abstract-op" href="#readable-byte-stream-controller-enqueue" id="ref-for-readable-byte-stream-controller-enqueue④">ReadableByteStreamControllerEnqueue</a>(<var>stream</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller⑥⑨">[[controller]]</a>, <var>chunk</var>).</p> </ol> </ol> </div> <hr> <p>The following algorithms must only be used on <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream⑥⑤">ReadableStream</a></code> instances initialized via the above <a data-link-type="dfn" href="#readablestream-set-up-with-byte-reading-support" id="ref-for-readablestream-set-up-with-byte-reading-support②">set up with byte reading support</a> algorithm:</p> <div class="algorithm" data-algorithm="current BYOB request view" data-algorithm-for="ReadableStream"> The <dfn class="dfn-paneled" data-dfn-for="ReadableStream" data-dfn-type="dfn" data-export id="readablestream-current-byob-request-view">current BYOB request view</dfn> for a <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream⑥⑥">ReadableStream</a></code> <var>stream</var> is either an <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#ArrayBufferView" id="ref-for-ArrayBufferView⑦">ArrayBufferView</a></code> or null, determined by the following steps: <ol> <li data-md> <p class="assertion">Assert: <var>stream</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller⑦⓪">[[controller]]</a> <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#implements" id="ref-for-implements②⑨">implements</a> <code class="idl"><a data-link-type="idl" href="#readablebytestreamcontroller" id="ref-for-readablebytestreamcontroller②④">ReadableByteStreamController</a></code>.</p> <li data-md> <p>Let <var>byobRequest</var> be ! <a data-link-type="abstract-op" href="#abstract-opdef-readablebytestreamcontrollergetbyobrequest" id="ref-for-abstract-opdef-readablebytestreamcontrollergetbyobrequest③">ReadableByteStreamControllerGetBYOBRequest</a>(<var>stream</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller⑦①">[[controller]]</a>).</p> <li data-md> <p>If <var>byobRequest</var> is null, then return null.</p> <li data-md> <p>Return <var>byobRequest</var>.<a data-link-type="dfn" href="#readablestreambyobrequest-view" id="ref-for-readablestreambyobrequest-view⑧">[[view]]</a>.</p> </ol> </div> <p>Specifications must not <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#arraybuffer-transfer" id="ref-for-arraybuffer-transfer">transfer</a> or <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-detach" id="ref-for-dfn-detach②">detach</a> the <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#buffersource-underlying-buffer" id="ref-for-buffersource-underlying-buffer">underlying buffer</a> of the <a data-link-type="dfn" href="#readablestream-current-byob-request-view" id="ref-for-readablestream-current-byob-request-view②">current BYOB request view</a>.</p> <p class="note" role="note">Implementations could do something equivalent to transferring, e.g. if they want to write into the memory from another thread. But they would need to make a few adjustments to how they implement the <a data-link-type="dfn" href="#readablestream-enqueue" id="ref-for-readablestream-enqueue">enqueue</a> and <a data-link-type="dfn" href="#readablestream-close" id="ref-for-readablestream-close">close</a> algorithms to keep the same observable consequences. In specification-land, transferring and detaching is just disallowed. </p> <p>Specifications should, when possible, <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#arraybufferview-write" id="ref-for-arraybufferview-write">write</a> into the <a data-link-type="dfn" href="#readablestream-current-byob-request-view" id="ref-for-readablestream-current-byob-request-view③">current BYOB request view</a> when it is non-null, and then call <a data-link-type="dfn" href="#readablestream-enqueue" id="ref-for-readablestream-enqueue①">enqueue</a> with that view. They should only <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#arraybufferview-create" id="ref-for-arraybufferview-create">create</a> a new <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#ArrayBufferView" id="ref-for-ArrayBufferView⑧">ArrayBufferView</a></code> to pass to <a data-link-type="dfn" href="#readablestream-enqueue" id="ref-for-readablestream-enqueue②">enqueue</a> when the <a data-link-type="dfn" href="#readablestream-current-byob-request-view" id="ref-for-readablestream-current-byob-request-view④">current BYOB request view</a> is null, or when they have more bytes on hand than the <a data-link-type="dfn" href="#readablestream-current-byob-request-view" id="ref-for-readablestream-current-byob-request-view⑤">current BYOB request view</a>'s <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#buffersource-byte-length" id="ref-for-buffersource-byte-length">byte length</a>. This avoids unnecessary copies and better respects the wishes of the stream’s <a data-link-type="dfn" href="#consumer" id="ref-for-consumer⑨">consumer</a>.</p> <p>The following <a data-link-type="dfn" href="#readablestream-pull-from-bytes" id="ref-for-readablestream-pull-from-bytes">pull from bytes</a> algorithm implements these requirements, for the common case where bytes are derived from a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#byte-sequence" id="ref-for-byte-sequence">byte sequence</a> that serves as the specification-level representation of an <a data-link-type="dfn" href="#underlying-byte-source" id="ref-for-underlying-byte-source①⑤">underlying byte source</a>. Note that it is conservative and leaves bytes in the <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#byte-sequence" id="ref-for-byte-sequence①">byte sequence</a>, instead of aggressively <a data-link-type="dfn" href="#readablestream-enqueue" id="ref-for-readablestream-enqueue③">enqueueing</a> them, so callers of this algorithm might want to use the number of remaining bytes as a <a data-link-type="dfn" href="#backpressure" id="ref-for-backpressure②①">backpressure</a> signal.</p> <div class="algorithm" data-algorithm="pull from bytes" data-algorithm-for="ReadableStream"> To <dfn class="dfn-paneled" data-dfn-for="ReadableStream" data-dfn-type="dfn" data-export id="readablestream-pull-from-bytes">pull from bytes</dfn> with a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#byte-sequence" id="ref-for-byte-sequence②">byte sequence</a> <var>bytes</var> into a <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream⑥⑦">ReadableStream</a></code> <var>stream</var>: <ol> <li data-md> <p class="assertion">Assert: <var>stream</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller⑦②">[[controller]]</a> <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#implements" id="ref-for-implements③⓪">implements</a> <code class="idl"><a data-link-type="idl" href="#readablebytestreamcontroller" id="ref-for-readablebytestreamcontroller②⑤">ReadableByteStreamController</a></code>.</p> <li data-md> <p>Let <var>available</var> be <var>bytes</var>’s <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#byte-sequence-length" id="ref-for-byte-sequence-length">length</a>.</p> <li data-md> <p>Let <var>desiredSize</var> be <var>available</var>.</p> <li data-md> <p>If <var>stream</var>’s <a data-link-type="dfn" href="#readablestream-current-byob-request-view" id="ref-for-readablestream-current-byob-request-view⑥">current BYOB request view</a> is non-null, then set <var>desiredSize</var> to <var>stream</var>’s <a data-link-type="dfn" href="#readablestream-current-byob-request-view" id="ref-for-readablestream-current-byob-request-view⑦">current BYOB request view</a>'s <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#buffersource-byte-length" id="ref-for-buffersource-byte-length①">byte length</a>.</p> <li data-md> <p>Let <var>pullSize</var> be the smaller value of <var>available</var> and <var>desiredSize</var>.</p> <li data-md> <p>Let <var>pulled</var> be the first <var>pullSize</var> bytes of <var>bytes</var>.</p> <li data-md> <p>Remove the first <var>pullSize</var> bytes from <var>bytes</var>.</p> <li data-md> <p>If <var>stream</var>’s <a data-link-type="dfn" href="#readablestream-current-byob-request-view" id="ref-for-readablestream-current-byob-request-view⑧">current BYOB request view</a> is non-null, then:</p> <ol> <li data-md> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#arraybufferview-write" id="ref-for-arraybufferview-write①">Write</a> <var>pulled</var> into <var>stream</var>’s <a data-link-type="dfn" href="#readablestream-current-byob-request-view" id="ref-for-readablestream-current-byob-request-view⑨">current BYOB request view</a>.</p> <li data-md> <p>Perform ? <a data-link-type="abstract-op" href="#readable-byte-stream-controller-respond" id="ref-for-readable-byte-stream-controller-respond⑥">ReadableByteStreamControllerRespond</a>(<var>stream</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller⑦③">[[controller]]</a>, <var>pullSize</var>).</p> </ol> <li data-md> <p>Otherwise,</p> <ol> <li data-md> <p>Set <var>view</var> to the result of <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#arraybufferview-create" id="ref-for-arraybufferview-create①">creating</a> a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-typedarray-objects" id="ref-for-sec-typedarray-objects⑧">Uint8Array</a></code> from <var>pulled</var> in <var>stream</var>’s <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#concept-relevant-realm" id="ref-for-concept-relevant-realm②">relevant Realm</a>.</p> <li data-md> <p>Perform ? <a data-link-type="abstract-op" href="#readable-byte-stream-controller-enqueue" id="ref-for-readable-byte-stream-controller-enqueue⑤">ReadableByteStreamControllerEnqueue</a>(<var>stream</var>.<a data-link-type="dfn" href="#readablestream-controller" id="ref-for-readablestream-controller⑦④">[[controller]]</a>, <var>view</var>).</p> </ol> </ol> </div> <p>Specifications must not <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#arraybuffer-write" id="ref-for-arraybuffer-write">write</a> into the <a data-link-type="dfn" href="#readablestream-current-byob-request-view" id="ref-for-readablestream-current-byob-request-view①⓪">current BYOB request view</a> or <a data-link-type="dfn" href="#readablestream-pull-from-bytes" id="ref-for-readablestream-pull-from-bytes①">pull from bytes</a> after <a data-link-type="dfn" href="#readablestream-close" id="ref-for-readablestream-close①">closing</a> the corresponding <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream⑥⑧">ReadableStream</a></code>.</p> <h4 class="heading settled" data-level="9.1.2" id="other-specs-rs-reading"><span class="secno">9.1.2. </span><span class="content">Reading</span><a class="self-link" href="#other-specs-rs-reading"></a></h4> <p>The following algorithms can be used on arbitrary <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream⑥⑨">ReadableStream</a></code> instances, including ones that are created by web developers. They can all fail in various operation-specific ways, and these failures should be handled by the calling specification.</p> <div class="algorithm" data-algorithm="get a reader" data-algorithm-for="ReadableStream"> <p>To <dfn class="dfn-paneled" data-dfn-for="ReadableStream" data-dfn-type="dfn" data-export data-lt="get a reader|getting a reader" id="readablestream-get-a-reader">get a reader</dfn> for a <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream⑦⓪">ReadableStream</a></code> <var>stream</var>, return ? <a data-link-type="abstract-op" href="#acquire-readable-stream-reader" id="ref-for-acquire-readable-stream-reader⑦">AcquireReadableStreamDefaultReader</a>(<var>stream</var>). The result will be a <code class="idl"><a data-link-type="idl" href="#readablestreamdefaultreader" id="ref-for-readablestreamdefaultreader①⑧">ReadableStreamDefaultReader</a></code>. </p> <p class="note" role="note">This will throw an exception if <var>stream</var> is already <a data-link-type="dfn" href="#readablestream-locked" id="ref-for-readablestream-locked">locked</a>. </p> </div> <p class="algorithm" data-algorithm="read a chunk" data-algorithm-for="ReadableStreamDefaultReader">To <dfn class="dfn-paneled" data-dfn-for="ReadableStreamDefaultReader" data-dfn-type="dfn" data-export data-lt="read a chunk|reading a chunk" id="readablestreamdefaultreader-read-a-chunk">read a chunk</dfn> from a <code class="idl"><a data-link-type="idl" href="#readablestreamdefaultreader" id="ref-for-readablestreamdefaultreader①⑨">ReadableStreamDefaultReader</a></code> <var>reader</var>, given a <a data-link-type="dfn" href="#read-request" id="ref-for-read-request⑤">read request</a> <var>readRequest</var>, perform ! <a data-link-type="abstract-op" href="#readable-stream-default-reader-read" id="ref-for-readable-stream-default-reader-read④">ReadableStreamDefaultReaderRead</a>(<var>reader</var>, <var>readRequest</var>). </p> <div class="algorithm" data-algorithm="read all bytes"> <p>To <dfn class="dfn-paneled" data-dfn-for="ReadableStreamDefaultReader" data-dfn-type="dfn" data-export data-lt="read all bytes|reading all bytes" id="readablestreamdefaultreader-read-all-bytes">read all bytes</dfn> from a <code class="idl"><a data-link-type="idl" href="#readablestreamdefaultreader" id="ref-for-readablestreamdefaultreader②⓪">ReadableStreamDefaultReader</a></code> <var>reader</var>, given <var>successSteps</var>, which is an algorithm accepting a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#byte-sequence" id="ref-for-byte-sequence③">byte sequence</a>, and <var>failureSteps</var>, which is an algorithm accepting a JavaScript value: <a data-link-type="dfn" href="#read-loop" id="ref-for-read-loop">read-loop</a> given <var>reader</var>, a new <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#byte-sequence" id="ref-for-byte-sequence④">byte sequence</a>, <var>successSteps</var>, and <var>failureSteps</var>. </p> <div class="algorithm" data-algorithm="read-loop"> For the purposes of the above algorithm, to <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="read-loop">read-loop</dfn> given <var>reader</var>, <var>bytes</var>, <var>successSteps</var>, and <var>failureSteps</var>: <ol> <li data-md> <p>Let <var>readRequest</var> be a new <a data-link-type="dfn" href="#read-request" id="ref-for-read-request⑥">read request</a> with the following <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#struct-item" id="ref-for-struct-item①②">items</a>:</p> <dl> <dt data-md><a data-link-type="dfn" href="#read-request-chunk-steps" id="ref-for-read-request-chunk-steps⑦">chunk steps</a>, given <var>chunk</var> <dd data-md> <ol> <li data-md> <p>If <var>chunk</var> is not a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-typedarray-objects" id="ref-for-sec-typedarray-objects⑨">Uint8Array</a></code> object, call <var>failureSteps</var> with a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror" id="ref-for-sec-native-error-types-used-in-this-standard-typeerror⑥⑤">TypeError</a></code> and abort these steps.</p> <li data-md> <p>Append the bytes represented by <var>chunk</var> to <var>bytes</var>.</p> <li data-md> <p><a data-link-type="dfn" href="#read-loop" id="ref-for-read-loop①">Read-loop</a> given <var>reader</var>, <var>bytes</var>, <var>successSteps</var>, and <var>failureSteps</var>.</p> <p class="note" role="note">This recursion could potentially cause a stack overflow if implemented directly. Implementations will need to mitigate this, e.g. by using a non-recursive variant of this algorithm, or <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-microtask" id="ref-for-queue-a-microtask③">queuing a microtask</a>, or using a more direct method of byte-reading as noted below. </p> </ol> <dt data-md><a data-link-type="dfn" href="#read-request-close-steps" id="ref-for-read-request-close-steps⑦">close steps</a> <dd data-md> <ol> <li data-md> <p>Call <var>successSteps</var> with <var>bytes</var>.</p> </ol> <dt data-md><a data-link-type="dfn" href="#read-request-error-steps" id="ref-for-read-request-error-steps⑦">error steps</a>, given <var>e</var> <dd data-md> <ol> <li data-md> <p>Call <var>failureSteps</var> with <var>e</var>.</p> </ol> </dl> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#readable-stream-default-reader-read" id="ref-for-readable-stream-default-reader-read⑤">ReadableStreamDefaultReaderRead</a>(<var>reader</var>, <var>readRequest</var>).</p> </ol> </div> <p class="note" role="note">Because <var>reader</var> grants exclusive access to its corresponding <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream⑦①">ReadableStream</a></code>, the actual mechanism of how to read cannot be observed. Implementations could use a more direct mechanism if convenient, such as acquiring and using a <code class="idl"><a data-link-type="idl" href="#readablestreambyobreader" id="ref-for-readablestreambyobreader①⑧">ReadableStreamBYOBReader</a></code> instead of a <code class="idl"><a data-link-type="idl" href="#readablestreamdefaultreader" id="ref-for-readablestreamdefaultreader②①">ReadableStreamDefaultReader</a></code>, or accessing the chunks directly. </p> </div> <p class="algorithm" data-algorithm="release" data-algorithm-for="ReadableStreamDefaultReader">To <dfn class="dfn-paneled" data-dfn-for="ReadableStreamDefaultReader" data-dfn-type="dfn" data-export id="readablestreamdefaultreader-release">release</dfn> a <code class="idl"><a data-link-type="idl" href="#readablestreamdefaultreader" id="ref-for-readablestreamdefaultreader②②">ReadableStreamDefaultReader</a></code> <var>reader</var>, perform ! <a data-link-type="abstract-op" href="#abstract-opdef-readablestreamdefaultreaderrelease" id="ref-for-abstract-opdef-readablestreamdefaultreaderrelease⑦">ReadableStreamDefaultReaderRelease</a>(<var>reader</var>). </p> <p class="algorithm" data-algorithm="cancel" data-algorithm-for="ReadableStreamDefaultReader">To <dfn class="dfn-paneled" data-dfn-for="ReadableStreamDefaultReader" data-dfn-type="dfn" data-export id="readablestreamdefaultreader-cancel">cancel</dfn> a <code class="idl"><a data-link-type="idl" href="#readablestreamdefaultreader" id="ref-for-readablestreamdefaultreader②③">ReadableStreamDefaultReader</a></code> <var>reader</var> with <var>reason</var>, perform ! <a data-link-type="abstract-op" href="#readable-stream-reader-generic-cancel" id="ref-for-readable-stream-reader-generic-cancel②">ReadableStreamReaderGenericCancel</a>(<var>reader</var>, <var>reason</var>). The return value will be a promise that either fulfills with undefined, or rejects with a failure reason. </p> <p class="algorithm" data-algorithm="cancel" data-algorithm-for="ReadableStream">To <dfn class="dfn-paneled" data-dfn-for="ReadableStream" data-dfn-type="dfn" data-export id="readablestream-cancel">cancel</dfn> a <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream⑦②">ReadableStream</a></code> <var>stream</var> with <var>reason</var>, return ! <a data-link-type="abstract-op" href="#readable-stream-cancel" id="ref-for-readable-stream-cancel①②">ReadableStreamCancel</a>(<var>stream</var>, <var>reason</var>). The return value will be a promise that either fulfills with undefined, or rejects with a failure reason. </p> <div class="algorithm" data-algorithm="tee" data-algorithm-for="ReadableStream"> <p>To <dfn class="dfn-paneled" data-dfn-for="ReadableStream" data-dfn-type="dfn" data-export data-lt="tee|teeing" id="readablestream-tee">tee</dfn> a <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream⑦③">ReadableStream</a></code> <var>stream</var>, return ? <a data-link-type="abstract-op" href="#readable-stream-tee" id="ref-for-readable-stream-tee①">ReadableStreamTee</a>(<var>stream</var>, true). </p> <p class="note" role="note">Because we pass true as the second argument to <a data-link-type="abstract-op" href="#readable-stream-tee" id="ref-for-readable-stream-tee②">ReadableStreamTee</a>, the second branch returned will have its <a data-link-type="dfn" href="#chunk" id="ref-for-chunk⑧①">chunks</a> cloned (using HTML’s <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/structured-data.html#serializable-objects" id="ref-for-serializable-objects①">serializable objects</a> framework) from those of the first branch. This prevents consumption of one of the branches from interfering with the other. </p> </div> <h4 class="heading settled" data-level="9.1.3" id="other-specs-rs-introspect"><span class="secno">9.1.3. </span><span class="content">Introspection</span><a class="self-link" href="#other-specs-rs-introspect"></a></h4> <p>The following predicates can be used on arbitrary <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream⑦④">ReadableStream</a></code> objects. However, note that apart from checking whether or not the stream is <a data-link-type="dfn" href="#readablestream-locked" id="ref-for-readablestream-locked①">locked</a>, this direct introspection is not possible via the public JavaScript API, and so specifications should instead use the algorithms in <a href="#other-specs-rs-reading">§ 9.1.2 Reading</a>. (For example, instead of testing if the stream is <a data-link-type="dfn" href="#readablestream-readable" id="ref-for-readablestream-readable①">readable</a>, attempt to <a data-link-type="dfn" href="#readablestream-get-a-reader" id="ref-for-readablestream-get-a-reader">get a reader</a> and handle any exception.)</p> <p class="algorithm" data-algorithm="readable" data-algorithm-for="ReadableStream">A <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream⑦⑤">ReadableStream</a></code> <var>stream</var> is <dfn class="dfn-paneled" data-dfn-for="ReadableStream" data-dfn-type="dfn" data-export id="readablestream-readable">readable</dfn> if <var>stream</var>.<a data-link-type="dfn" href="#readablestream-state" id="ref-for-readablestream-state③⑨">[[state]]</a> is "<code>readable</code>". </p> <p class="algorithm" data-algorithm="closed" data-algorithm-for="ReadableStream">A <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream⑦⑥">ReadableStream</a></code> <var>stream</var> is <dfn class="dfn-paneled" data-dfn-for="ReadableStream" data-dfn-type="dfn" data-export id="readablestream-closed">closed</dfn> if <var>stream</var>.<a data-link-type="dfn" href="#readablestream-state" id="ref-for-readablestream-state④⓪">[[state]]</a> is "<code>closed</code>". </p> <p class="algorithm" data-algorithm="errored" data-algorithm-for="ReadableStream">A <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream⑦⑦">ReadableStream</a></code> <var>stream</var> is <dfn class="dfn-paneled" data-dfn-for="ReadableStream" data-dfn-type="dfn" data-export id="readablestream-errored">errored</dfn> if <var>stream</var>.<a data-link-type="dfn" href="#readablestream-state" id="ref-for-readablestream-state④①">[[state]]</a> is "<code>errored</code>". </p> <p class="algorithm" data-algorithm="ReadableStream locked">A <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream⑦⑧">ReadableStream</a></code> <var>stream</var> is <dfn class="dfn-paneled" data-dfn-for="ReadableStream" data-dfn-type="dfn" data-export id="readablestream-locked">locked</dfn> if ! <a data-link-type="abstract-op" href="#is-readable-stream-locked" id="ref-for-is-readable-stream-locked①②">IsReadableStreamLocked</a>(<var>stream</var>) returns true. </p> <div class="algorithm" data-algorithm="disturbed" data-algorithm-for="ReadableStream"> <p>A <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream⑦⑨">ReadableStream</a></code> <var>stream</var> is <dfn class="dfn-paneled" data-dfn-for="ReadableStream" data-dfn-type="dfn" data-export id="is-readable-stream-disturbed">disturbed</dfn> if <var>stream</var>.<a data-link-type="dfn" href="#readablestream-disturbed" id="ref-for-readablestream-disturbed⑤">[[disturbed]]</a> is true. </p> <p class="note" role="note">This indicates whether the stream has ever been read from or canceled. Even more so than other predicates in this section, it is best consulted sparingly, since this is not information web developers have access to even indirectly. As such, branching platform behavior on it is undesirable. </p> </div> <h3 class="heading settled" data-level="9.2" id="other-specs-ws"><span class="secno">9.2. </span><span class="content">Writable streams</span><a class="self-link" href="#other-specs-ws"></a></h3> <h4 class="heading settled" data-level="9.2.1" id="other-specs-ws-creation"><span class="secno">9.2.1. </span><span class="content">Creation and manipulation</span><a class="self-link" href="#other-specs-ws-creation"></a></h4> <div class="algorithm" data-algorithm="set up a WritableStream"> To <dfn class="dfn-paneled" data-dfn-for="WritableStream" data-dfn-type="dfn" data-export id="writablestream-set-up">set up</dfn> a newly-<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#new" id="ref-for-new②⑦">created-via-Web IDL</a> <code class="idl"><a data-link-type="idl" href="#writablestream" id="ref-for-writablestream③⑤">WritableStream</a></code> object <var>stream</var>, given an algorithm <dfn class="dfn-paneled" data-dfn-for="WritableStream/set up" data-dfn-type="dfn" data-export id="writablestream-set-up-writealgorithm"><var>writeAlgorithm</var></dfn>, an optional algorithm <dfn class="dfn-paneled" data-dfn-for="WritableStream/set up" data-dfn-type="dfn" data-export id="writablestream-set-up-closealgorithm"><var>closeAlgorithm</var></dfn>, an optional algorithm <dfn class="dfn-paneled" data-dfn-for="WritableStream/set up" data-dfn-type="dfn" data-export id="writablestream-set-up-abortalgorithm"><var>abortAlgorithm</var></dfn>, an optional number <dfn class="dfn-paneled" data-dfn-for="WritableStream/set up" data-dfn-type="dfn" data-export id="writablestream-set-up-highwatermark"><var>highWaterMark</var></dfn> (default 1), an optional algorithm <dfn class="dfn-paneled" data-dfn-for="WritableStream/set up" data-dfn-type="dfn" data-export id="writablestream-set-up-sizealgorithm"><var>sizeAlgorithm</var></dfn>, perform the following steps. <var>writeAlgorithm</var> must be an algorithm that accepts a <a data-link-type="dfn" href="#chunk" id="ref-for-chunk⑧②">chunk</a> object and returns a promise. If given, <var>closeAlgorithm</var> and <var>abortAlgorithm</var> may return a promise. If given, <var>sizeAlgorithm</var> must be an algorithm accepting <a data-link-type="dfn" href="#chunk" id="ref-for-chunk⑧③">chunk</a> objects and returning a number; and if given, <var>highWaterMark</var> must be a non-negative, non-NaN number. <ol> <li data-md> <p>Let <var>startAlgorithm</var> be an algorithm that returns undefined.</p> <li data-md> <p>Let <var>closeAlgorithmWrapper</var> be an algorithm that runs these steps:</p> <ol> <li data-md> <p>Let <var>result</var> be the result of running <var>closeAlgorithm</var>, if <var>closeAlgorithm</var> was given, or null otherwise. If this throws an exception <var>e</var>, return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-rejected-with" id="ref-for-a-promise-rejected-with④④">a promise rejected with</a> <var>e</var>.</p> <li data-md> <p>If <var>result</var> is a <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#idl-promise" id="ref-for-idl-promise②⑤">Promise</a></code>, then return <var>result</var>.</p> <li data-md> <p>Return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-resolved-with" id="ref-for-a-promise-resolved-with④③">a promise resolved with</a> undefined.</p> </ol> <li data-md> <p>Let <var>abortAlgorithmWrapper</var> be an algorithm that runs these steps given <var>reason</var>:</p> <ol> <li data-md> <p>Let <var>result</var> be the result of running <var>abortAlgorithm</var> given <var>reason</var>, if <var>abortAlgorithm</var> was given, or null otherwise. If this throws an exception <var>e</var>, return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-rejected-with" id="ref-for-a-promise-rejected-with④⑤">a promise rejected with</a> <var>e</var>.</p> <li data-md> <p>If <var>result</var> is a <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#idl-promise" id="ref-for-idl-promise②⑥">Promise</a></code>, then return <var>result</var>.</p> <li data-md> <p>Return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-resolved-with" id="ref-for-a-promise-resolved-with④④">a promise resolved with</a> undefined.</p> </ol> <li data-md> <p>If <var>sizeAlgorithm</var> was not given, then set it to an algorithm that returns 1.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#initialize-writable-stream" id="ref-for-initialize-writable-stream③">InitializeWritableStream</a>(<var>stream</var>).</p> <li data-md> <p>Let <var>controller</var> be a <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#new" id="ref-for-new②⑧">new</a> <code class="idl"><a data-link-type="idl" href="#writablestreamdefaultcontroller" id="ref-for-writablestreamdefaultcontroller①⑥">WritableStreamDefaultController</a></code>.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#set-up-writable-stream-default-controller" id="ref-for-set-up-writable-stream-default-controller③">SetUpWritableStreamDefaultController</a>(<var>stream</var>, <var>controller</var>, <var>startAlgorithm</var>, <var>writeAlgorithm</var>, <var>closeAlgorithmWrapper</var>, <var>abortAlgorithmWrapper</var>, <var>highWaterMark</var>, <var>sizeAlgorithm</var>).</p> </ol> <p>Other specifications should be careful when constructing their <i><a data-link-type="dfn" href="#writablestream-set-up-writealgorithm" id="ref-for-writablestream-set-up-writealgorithm">writeAlgorithm</a></i> to avoid <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/infrastructure.html#in-parallel" id="ref-for-in-parallel①">in parallel</a> reads from the given <a data-link-type="dfn" href="#chunk" id="ref-for-chunk⑧④">chunk</a>, as such reads can violate the run-to-completion semantics of JavaScript. To avoid this, they can make a synchronous copy or transfer of the given value, using operations such as <a data-link-type="abstract-op" href="https://html.spec.whatwg.org/multipage/structured-data.html#structuredserializewithtransfer" id="ref-for-structuredserializewithtransfer④">StructuredSerializeWithTransfer</a>, <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-get-buffer-source-copy" id="ref-for-dfn-get-buffer-source-copy">get a copy of the bytes held by the buffer source</a>, or <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#arraybuffer-transfer" id="ref-for-arraybuffer-transfer①">transferring an <code>ArrayBuffer</code></a>. An exception is when the <a data-link-type="dfn" href="#chunk" id="ref-for-chunk⑧⑤">chunk</a> is a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-sharedarraybuffer-objects" id="ref-for-sec-sharedarraybuffer-objects">SharedArrayBuffer</a></code>, for which it is understood that parallel mutations are a fact of life.</p> <div class="example" id="example-set-up-ws"> <a class="self-link" href="#example-set-up-ws"></a> Creating a <code class="idl"><a data-link-type="idl" href="#writablestream" id="ref-for-writablestream③⑥">WritableStream</a></code> from other specifications is thus a two-step process, like so: <ol> <li data-md> <p>Let <var>writableStream</var> be a <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#new" id="ref-for-new②⑨">new</a> <code class="idl"><a data-link-type="idl" href="#writablestream" id="ref-for-writablestream③⑦">WritableStream</a></code>.</p> <li data-md> <p><a data-link-type="dfn" href="#writablestream-set-up" id="ref-for-writablestream-set-up">Set up</a> <var>writableStream</var> given….</p> </ol> </div> <p class="note" role="note">Subclasses of <code class="idl"><a data-link-type="idl" href="#writablestream" id="ref-for-writablestream③⑧">WritableStream</a></code> will use the <a data-link-type="dfn" href="#writablestream-set-up" id="ref-for-writablestream-set-up①">set up</a> operation directly on the <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this①①⑧">this</a> value inside their constructor steps.</p> </div> <hr> <p>The following definitions must only be used on <code class="idl"><a data-link-type="idl" href="#writablestream" id="ref-for-writablestream③⑨">WritableStream</a></code> instances initialized via the above <a data-link-type="dfn" href="#writablestream-set-up" id="ref-for-writablestream-set-up②">set up</a> algorithm:</p> <p class="algorithm" data-algorithm="error" data-algorithm-for="WritableStream">To <dfn class="dfn-paneled" data-dfn-for="WritableStream" data-dfn-type="dfn" data-export data-lt="error|erroring" id="writablestream-error">error</dfn> a <code class="idl"><a data-link-type="idl" href="#writablestream" id="ref-for-writablestream④⓪">WritableStream</a></code> <var>stream</var> given a JavaScript value <var>e</var>, perform ! <a data-link-type="abstract-op" href="#writable-stream-default-controller-error-if-needed" id="ref-for-writable-stream-default-controller-error-if-needed⑦">WritableStreamDefaultControllerErrorIfNeeded</a>(<var>stream</var>.<a data-link-type="dfn" href="#writablestream-controller" id="ref-for-writablestream-controller①③">[[controller]]</a>, <var>e</var>). </p> <p>The <dfn class="dfn-paneled" data-dfn-for="WritableStream" data-dfn-type="dfn" data-export id="writablestream-signal">signal</dfn> of a <code class="idl"><a data-link-type="idl" href="#writablestream" id="ref-for-writablestream④①">WritableStream</a></code> <var>stream</var> is <var>stream</var>.<a data-link-type="dfn" href="#writablestream-controller" id="ref-for-writablestream-controller①④">[[controller]]</a>.<a data-link-type="dfn" href="#writablestreamdefaultcontroller-abortcontroller" id="ref-for-writablestreamdefaultcontroller-abortcontroller③">[[abortController]]</a>'s <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#abortcontroller-signal" id="ref-for-abortcontroller-signal①">signal</a>. Specifications can <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#abortsignal-add" id="ref-for-abortsignal-add①">add</a> or <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#abortsignal-remove" id="ref-for-abortsignal-remove①">remove</a> algorithms to this <code class="idl"><a data-link-type="idl" href="https://dom.spec.whatwg.org/#abortsignal" id="ref-for-abortsignal⑤">AbortSignal</a></code>, or consult whether it is <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#abortsignal-aborted" id="ref-for-abortsignal-aborted①">aborted</a> and its <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#abortsignal-abort-reason" id="ref-for-abortsignal-abort-reason①">abort reason</a>. </p> <p class="note" role="note">The usual usage is, after <a data-link-type="dfn" href="#writablestream-set-up" id="ref-for-writablestream-set-up③">setting up</a> the <code class="idl"><a data-link-type="idl" href="#writablestream" id="ref-for-writablestream④②">WritableStream</a></code>, <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#abortsignal-add" id="ref-for-abortsignal-add②">add</a> an algorithm to its <a data-link-type="dfn" href="#writablestream-signal" id="ref-for-writablestream-signal">signal</a>, which aborts any ongoing write operation to the <a data-link-type="dfn" href="#underlying-sink" id="ref-for-underlying-sink③⑥">underlying sink</a>. Then, inside the <var><a data-link-type="dfn" href="#writablestream-set-up-writealgorithm" id="ref-for-writablestream-set-up-writealgorithm①">writeAlgorithm</a></var>, once the <a data-link-type="dfn" href="#underlying-sink" id="ref-for-underlying-sink③⑦">underlying sink</a> has responded, check if the <a data-link-type="dfn" href="#writablestream-signal" id="ref-for-writablestream-signal①">signal</a> is <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#abortsignal-aborted" id="ref-for-abortsignal-aborted②">aborted</a>, and <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#reject" id="ref-for-reject②②">reject</a> the returned promise with the signal’s <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#abortsignal-abort-reason" id="ref-for-abortsignal-abort-reason②">abort reason</a> if so. </p> <h4 class="heading settled" data-level="9.2.2" id="other-specs-ws-writing"><span class="secno">9.2.2. </span><span class="content">Writing</span><a class="self-link" href="#other-specs-ws-writing"></a></h4> <p>The following algorithms can be used on arbitrary <code class="idl"><a data-link-type="idl" href="#writablestream" id="ref-for-writablestream④③">WritableStream</a></code> instances, including ones that are created by web developers. They can all fail in various operation-specific ways, and these failures should be handled by the calling specification.</p> <div class="algorithm" data-algorithm="get a writer" data-algorithm-for="WritableStream"> <p>To <dfn class="dfn-paneled" data-dfn-for="WritableStream" data-dfn-type="dfn" data-export data-lt="get a writer|getting a writer" id="writablestream-get-a-writer">get a writer</dfn> for a <code class="idl"><a data-link-type="idl" href="#writablestream" id="ref-for-writablestream④④">WritableStream</a></code> <var>stream</var>, return ? <a data-link-type="abstract-op" href="#acquire-writable-stream-default-writer" id="ref-for-acquire-writable-stream-default-writer②">AcquireWritableStreamDefaultWriter</a>(<var>stream</var>). The result will be a <code class="idl"><a data-link-type="idl" href="#writablestreamdefaultwriter" id="ref-for-writablestreamdefaultwriter①①">WritableStreamDefaultWriter</a></code>. </p> <p class="note" role="note">This will throw an exception if <var>stream</var> is already locked. </p> </div> <p class="algorithm" data-algorithm="write a chunk" data-algorithm-for="WritableStreamDefaultWriter">To <dfn class="dfn-paneled" data-dfn-for="WritableStreamDefaultWriter" data-dfn-type="dfn" data-export data-lt="write a chunk|writing a chunk" id="writablestreamdefaultwriter-write-a-chunk">write a chunk</dfn> to a <code class="idl"><a data-link-type="idl" href="#writablestreamdefaultwriter" id="ref-for-writablestreamdefaultwriter①②">WritableStreamDefaultWriter</a></code> <var>writer</var>, given a value <var>chunk</var>, return ! <a data-link-type="abstract-op" href="#writable-stream-default-writer-write" id="ref-for-writable-stream-default-writer-write①">WritableStreamDefaultWriterWrite</a>(<var>writer</var>, <var>chunk</var>). </p> <p class="algorithm" data-algorithm="release" data-algorithm-for="WritableStreamDefaultWriter">To <dfn class="dfn-paneled" data-dfn-for="WritableStreamDefaultWriter" data-dfn-type="dfn" data-export id="writablestreamdefaultwriter-release">release</dfn> a <code class="idl"><a data-link-type="idl" href="#writablestreamdefaultwriter" id="ref-for-writablestreamdefaultwriter①③">WritableStreamDefaultWriter</a></code> <var>writer</var>, perform ! <a data-link-type="abstract-op" href="#writable-stream-default-writer-release" id="ref-for-writable-stream-default-writer-release②">WritableStreamDefaultWriterRelease</a>(<var>writer</var>). </p> <p class="algorithm" data-algorithm="close" data-algorithm-for="WritableStream">To <dfn class="dfn-paneled" data-dfn-for="WritableStream" data-dfn-type="dfn" data-export data-lt="close|closing" id="writablestream-close">close</dfn> a <code class="idl"><a data-link-type="idl" href="#writablestream" id="ref-for-writablestream④⑤">WritableStream</a></code> <var>stream</var>, return ! <a data-link-type="abstract-op" href="#writable-stream-close" id="ref-for-writable-stream-close②">WritableStreamClose</a>(<var>stream</var>). The return value will be a promise that either fulfills with undefined, or rejects with a failure reason. </p> <p class="algorithm" data-algorithm="abort" data-algorithm-for="WritableStream">To <dfn class="dfn-paneled" data-dfn-for="WritableStream" data-dfn-type="dfn" data-export data-lt="abort|aborting" id="writablestream-abort">abort</dfn> a <code class="idl"><a data-link-type="idl" href="#writablestream" id="ref-for-writablestream④⑥">WritableStream</a></code> <var>stream</var> with <var>reason</var>, return ! <a data-link-type="abstract-op" href="#writable-stream-abort" id="ref-for-writable-stream-abort⑦">WritableStreamAbort</a>(<var>stream</var>, <var>reason</var>). The return value will be a promise that either fulfills with undefined, or rejects with a failure reason. </p> <h3 class="heading settled" data-level="9.3" id="other-specs-ts"><span class="secno">9.3. </span><span class="content">Transform streams</span><a class="self-link" href="#other-specs-ts"></a></h3> <h4 class="heading settled" data-level="9.3.1" id="other-specs-ts-creation"><span class="secno">9.3.1. </span><span class="content">Creation and manipulation</span><a class="self-link" href="#other-specs-ts-creation"></a></h4> <div class="algorithm" data-algorithm="create a TransformStream"> To <dfn class="dfn-paneled" data-dfn-for="TransformStream" data-dfn-type="dfn" data-export data-lt="set up|setting up" id="transformstream-set-up">set up</dfn> a newly-<a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#new" id="ref-for-new③⓪">created-via-Web IDL</a> <code class="idl"><a data-link-type="idl" href="#transformstream" id="ref-for-transformstream①⑧">TransformStream</a></code> <var>stream</var> given an algorithm <dfn class="dfn-paneled" data-dfn-for="TransformStream/set up" data-dfn-type="dfn" data-export id="transformstream-set-up-transformalgorithm"><var>transformAlgorithm</var></dfn>, an optional algorithm <dfn class="dfn-paneled" data-dfn-for="TransformStream/set up" data-dfn-type="dfn" data-export id="transformstream-set-up-flushalgorithm"><var>flushAlgorithm</var></dfn>, and an optional algorithm <dfn class="dfn-paneled" data-dfn-for="TransformStream/set up" data-dfn-type="dfn" data-export id="transformstream-set-up-cancelalgorithm"><var>cancelAlgorithm</var></dfn>, perform the following steps. <var>transformAlgorithm</var> and, if given, <var>flushAlgorithm</var> and <var>cancelAlgorithm</var>, may return a promise. <ol> <li data-md> <p>Let <var>writableHighWaterMark</var> be 1.</p> <li data-md> <p>Let <var>writableSizeAlgorithm</var> be an algorithm that returns 1.</p> <li data-md> <p>Let <var>readableHighWaterMark</var> be 0.</p> <li data-md> <p>Let <var>readableSizeAlgorithm</var> be an algorithm that returns 1.</p> <li data-md> <p>Let <var>transformAlgorithmWrapper</var> be an algorithm that runs these steps given a value <var>chunk</var>:</p> <ol> <li data-md> <p>Let <var>result</var> be the result of running <var>transformAlgorithm</var> given <var>chunk</var>. If this throws an exception <var>e</var>, return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-rejected-with" id="ref-for-a-promise-rejected-with④⑥">a promise rejected with</a> <var>e</var>.</p> <li data-md> <p>If <var>result</var> is a <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#idl-promise" id="ref-for-idl-promise②⑦">Promise</a></code>, then return <var>result</var>.</p> <li data-md> <p>Return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-resolved-with" id="ref-for-a-promise-resolved-with④⑤">a promise resolved with</a> undefined.</p> </ol> <li data-md> <p>Let <var>flushAlgorithmWrapper</var> be an algorithm that runs these steps:</p> <ol> <li data-md> <p>Let <var>result</var> be the result of running <var>flushAlgorithm</var>, if <var>flushAlgorithm</var> was given, or null otherwise. If this throws an exception <var>e</var>, return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-rejected-with" id="ref-for-a-promise-rejected-with④⑦">a promise rejected with</a> <var>e</var>.</p> <li data-md> <p>If <var>result</var> is a <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#idl-promise" id="ref-for-idl-promise②⑧">Promise</a></code>, then return <var>result</var>.</p> <li data-md> <p>Return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-resolved-with" id="ref-for-a-promise-resolved-with④⑥">a promise resolved with</a> undefined.</p> </ol> <li data-md> <p>Let <var>cancelAlgorithmWrapper</var> be an algorithm that runs these steps given a value <var>reason</var>:</p> <ol> <li data-md> <p>Let <var>result</var> be the result of running <var>cancelAlgorithm</var> given <var>reason</var>, if <var>cancelAlgorithm</var> was given, or null otherwise. If this throws an exception <var>e</var>, return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-rejected-with" id="ref-for-a-promise-rejected-with④⑧">a promise rejected with</a> <var>e</var>.</p> <li data-md> <p>If <var>result</var> is a <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#idl-promise" id="ref-for-idl-promise②⑨">Promise</a></code>, then return <var>result</var>.</p> <li data-md> <p>Return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-resolved-with" id="ref-for-a-promise-resolved-with④⑦">a promise resolved with</a> undefined.</p> </ol> <li data-md> <p>Let <var>startPromise</var> be <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#a-promise-resolved-with" id="ref-for-a-promise-resolved-with④⑧">a promise resolved with</a> undefined.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#initialize-transform-stream" id="ref-for-initialize-transform-stream①">InitializeTransformStream</a>(<var>stream</var>, <var>startPromise</var>, <var>writableHighWaterMark</var>, <var>writableSizeAlgorithm</var>, <var>readableHighWaterMark</var>, <var>readableSizeAlgorithm</var>).</p> <li data-md> <p>Let <var>controller</var> be a <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#new" id="ref-for-new③①">new</a> <code class="idl"><a data-link-type="idl" href="#transformstreamdefaultcontroller" id="ref-for-transformstreamdefaultcontroller①②">TransformStreamDefaultController</a></code>.</p> <li data-md> <p>Perform ! <a data-link-type="abstract-op" href="#set-up-transform-stream-default-controller" id="ref-for-set-up-transform-stream-default-controller①">SetUpTransformStreamDefaultController</a>(<var>stream</var>, <var>controller</var>, <var>transformAlgorithmWrapper</var>, <var>flushAlgorithmWrapper</var>, <var>cancelAlgorithmWrapper</var>).</p> </ol> <p>Other specifications should be careful when constructing their <i><a data-link-type="dfn" href="#transformstream-set-up-transformalgorithm" id="ref-for-transformstream-set-up-transformalgorithm">transformAlgorithm</a></i> to avoid <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/infrastructure.html#in-parallel" id="ref-for-in-parallel②">in parallel</a> reads from the given <a data-link-type="dfn" href="#chunk" id="ref-for-chunk⑧⑥">chunk</a>, as such reads can violate the run-to-completion semantics of JavaScript. To avoid this, they can make a synchronous copy or transfer of the given value, using operations such as <a data-link-type="abstract-op" href="https://html.spec.whatwg.org/multipage/structured-data.html#structuredserializewithtransfer" id="ref-for-structuredserializewithtransfer⑤">StructuredSerializeWithTransfer</a>, <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-get-buffer-source-copy" id="ref-for-dfn-get-buffer-source-copy①">get a copy of the bytes held by the buffer source</a>, or <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#arraybuffer-transfer" id="ref-for-arraybuffer-transfer②">transferring an <code>ArrayBuffer</code></a>. An exception is when the <a data-link-type="dfn" href="#chunk" id="ref-for-chunk⑧⑦">chunk</a> is a <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-sharedarraybuffer-objects" id="ref-for-sec-sharedarraybuffer-objects①">SharedArrayBuffer</a></code>, for which it is understood that parallel mutations are a fact of life.</p> <div class="example" id="example-set-up-ts"> <a class="self-link" href="#example-set-up-ts"></a> Creating a <code class="idl"><a data-link-type="idl" href="#transformstream" id="ref-for-transformstream①⑨">TransformStream</a></code> from other specifications is thus a two-step process, like so: <ol> <li data-md> <p>Let <var>transformStream</var> be a <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#new" id="ref-for-new③②">new</a> <code class="idl"><a data-link-type="idl" href="#transformstream" id="ref-for-transformstream②⓪">TransformStream</a></code>.</p> <li data-md> <p><a data-link-type="dfn" href="#transformstream-set-up" id="ref-for-transformstream-set-up">Set up</a> <var>transformStream</var> given….</p> </ol> </div> <p class="note" role="note">Subclasses of <code class="idl"><a data-link-type="idl" href="#transformstream" id="ref-for-transformstream②①">TransformStream</a></code> will use the <a data-link-type="dfn" href="#transformstream-set-up" id="ref-for-transformstream-set-up①">set up</a> operation directly on the <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this①①⑨">this</a> value inside their constructor steps.</p> </div> <div class="algorithm" data-algorithm="create an identity TransformStream"> To <dfn class="dfn-paneled" data-dfn-type="dfn" data-export data-lt="create an identity TransformStream|creating an identity TransformStream" id="create-an-identity-transformstream">create an identity <code class="idl"><a data-link-type="idl" href="#transformstream" id="ref-for-transformstream②②">TransformStream</a></code></dfn>: <ol> <li data-md> <p>Let <var>transformStream</var> be a <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#new" id="ref-for-new③③">new</a> <code class="idl"><a data-link-type="idl" href="#transformstream" id="ref-for-transformstream②③">TransformStream</a></code>.</p> <li data-md> <p><a data-link-type="dfn" href="#transformstream-set-up" id="ref-for-transformstream-set-up②">Set up</a> <var>transformStream</var> with <var><a data-link-type="dfn" href="#transformstream-set-up-transformalgorithm" id="ref-for-transformstream-set-up-transformalgorithm①">transformAlgorithm</a></var> set to an algorithm which, given <var>chunk</var>, <a data-link-type="dfn" href="#transformstream-enqueue" id="ref-for-transformstream-enqueue">enqueues</a> <var>chunk</var> in <var>transformStream</var>.</p> <li data-md> <p>Return <var>transformStream</var>.</p> </ol> </div> <hr> <p>The following algorithms must only be used on <code class="idl"><a data-link-type="idl" href="#transformstream" id="ref-for-transformstream②④">TransformStream</a></code> instances initialized via the above <a data-link-type="dfn" href="#transformstream-set-up" id="ref-for-transformstream-set-up③">set up</a> algorithm. Usually they are called as part of <var><a data-link-type="dfn" href="#transformstream-set-up-transformalgorithm" id="ref-for-transformstream-set-up-transformalgorithm②">transformAlgorithm</a></var> or <var><a data-link-type="dfn" href="#transformstream-set-up-flushalgorithm" id="ref-for-transformstream-set-up-flushalgorithm">flushAlgorithm</a></var>.</p> <p class="algorithm" data-algorithm="enqueue" data-algorithm-for="TransformStream">To <dfn class="dfn-paneled" data-dfn-for="TransformStream" data-dfn-type="dfn" data-export id="transformstream-enqueue">enqueue</dfn> the JavaScript value <var>chunk</var> into a <code class="idl"><a data-link-type="idl" href="#transformstream" id="ref-for-transformstream②⑤">TransformStream</a></code> <var>stream</var>, perform ! <a data-link-type="abstract-op" href="#transform-stream-default-controller-enqueue" id="ref-for-transform-stream-default-controller-enqueue②">TransformStreamDefaultControllerEnqueue</a>(<var>stream</var>.<a data-link-type="dfn" href="#transformstream-controller" id="ref-for-transformstream-controller①①">[[controller]]</a>, <var>chunk</var>). </p> <p class="algorithm" data-algorithm="terminate" data-algorithm-for="TransformStream">To <dfn class="dfn-paneled" data-dfn-for="TransformStream" data-dfn-type="dfn" data-export id="transformstream-terminate">terminate</dfn> a <code class="idl"><a data-link-type="idl" href="#transformstream" id="ref-for-transformstream②⑥">TransformStream</a></code> <var>stream</var>, perform ! <a data-link-type="abstract-op" href="#transform-stream-default-controller-terminate" id="ref-for-transform-stream-default-controller-terminate①">TransformStreamDefaultControllerTerminate</a>(<var>stream</var>.<a data-link-type="dfn" href="#transformstream-controller" id="ref-for-transformstream-controller①②">[[controller]]</a>). </p> <p class="algorithm" data-algorithm="error" data-algorithm-for="TransformStream">To <dfn class="dfn-paneled" data-dfn-for="TransformStream" data-dfn-type="dfn" data-export id="transformstream-error">error</dfn> a <code class="idl"><a data-link-type="idl" href="#transformstream" id="ref-for-transformstream②⑦">TransformStream</a></code> <var>stream</var> given a JavaScript value <var>e</var>, perform ! <a data-link-type="abstract-op" href="#transform-stream-default-controller-error" id="ref-for-transform-stream-default-controller-error①">TransformStreamDefaultControllerError</a>(<var>stream</var>.<a data-link-type="dfn" href="#transformstream-controller" id="ref-for-transformstream-controller①③">[[controller]]</a>, <var>e</var>). </p> <h4 class="heading settled" data-level="9.3.2" id="other-specs-ts-wrapping"><span class="secno">9.3.2. </span><span class="content">Wrapping into a custom class</span><a class="self-link" href="#other-specs-ts-wrapping"></a></h4> <p>Other specifications which mean to define custom <a data-link-type="dfn" href="#transform-stream" id="ref-for-transform-stream⑤">transform streams</a> might not want to subclass from the <code class="idl"><a data-link-type="idl" href="#transformstream" id="ref-for-transformstream②⑧">TransformStream</a></code> interface directly. Instead, if they need a new class, they can create their own independent Web IDL interfaces, and use the following mixin:</p> <pre class="idl highlight def"><c- b>interface</c-> <c- b>mixin</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="interface" data-export id="generictransformstream"><code><c- g>GenericTransformStream</c-></code></dfn> { <c- b>readonly</c-> <c- b>attribute</c-> <a data-link-type="idl-name" href="#readablestream" id="ref-for-readablestream⑧⓪"><c- n>ReadableStream</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="ReadableStream" href="#dom-generictransformstream-readable" id="ref-for-dom-generictransformstream-readable"><c- g>readable</c-></a>; <c- b>readonly</c-> <c- b>attribute</c-> <a data-link-type="idl-name" href="#writablestream" id="ref-for-writablestream④⑦"><c- n>WritableStream</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="WritableStream" href="#dom-generictransformstream-writable" id="ref-for-dom-generictransformstream-writable"><c- g>writable</c-></a>; }; </pre> <p>Any <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-platform-object" id="ref-for-dfn-platform-object①">platform object</a> that <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#include" id="ref-for-include">includes</a> the <code class="idl"><a data-link-type="idl" href="#generictransformstream" id="ref-for-generictransformstream①">GenericTransformStream</a></code> mixin has an associated <dfn class="dfn-paneled" data-dfn-for="GenericTransformStream" data-dfn-type="dfn" data-export id="generictransformstream-transform">transform</dfn>, which is an actual <code class="idl"><a data-link-type="idl" href="#transformstream" id="ref-for-transformstream②⑨">TransformStream</a></code>.</p> <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="GenericTransformStream" data-dfn-type="attribute" data-export id="dom-generictransformstream-readable"><code>readable</code></dfn> getter steps are to return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this①②⓪">this</a>'s <a data-link-type="dfn" href="#generictransformstream-transform" id="ref-for-generictransformstream-transform">transform</a>.<a data-link-type="dfn" href="#transformstream-readable" id="ref-for-transformstream-readable①③">[[readable]]</a>.</p> <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="GenericTransformStream" data-dfn-type="attribute" data-export id="dom-generictransformstream-writable"><code>writable</code></dfn> getter steps are to return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this①②①">this</a>'s <a data-link-type="dfn" href="#generictransformstream-transform" id="ref-for-generictransformstream-transform①">transform</a>.<a data-link-type="dfn" href="#transformstream-writable" id="ref-for-transformstream-writable⑨">[[writable]]</a>.</p> <hr> <p>Including the <code class="idl"><a data-link-type="idl" href="#generictransformstream" id="ref-for-generictransformstream②">GenericTransformStream</a></code> mixin will give an IDL interface the appropriate <code class="idl"><a data-link-type="idl" href="#dom-generictransformstream-readable" id="ref-for-dom-generictransformstream-readable①">readable</a></code> and <code class="idl"><a data-link-type="idl" href="#dom-generictransformstream-writable" id="ref-for-dom-generictransformstream-writable①">writable</a></code> properties. To customize the behavior of the resulting interface, its constructor (or other initialization code) must set each instance’s <a data-link-type="dfn" href="#generictransformstream-transform" id="ref-for-generictransformstream-transform②">transform</a> to a <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#new" id="ref-for-new③④">new</a> <code class="idl"><a data-link-type="idl" href="#transformstream" id="ref-for-transformstream③⓪">TransformStream</a></code>, and then <a data-link-type="dfn" href="#transformstream-set-up" id="ref-for-transformstream-set-up④">set it up</a> with appropriate customizations via the <var><a data-link-type="dfn" href="#transformstream-set-up-transformalgorithm" id="ref-for-transformstream-set-up-transformalgorithm③">transformAlgorithm</a></var> and optionally <var><a data-link-type="dfn" href="#transformstream-set-up-flushalgorithm" id="ref-for-transformstream-set-up-flushalgorithm①">flushAlgorithm</a></var> arguments.</p> <p class="note" role="note"><span class="marker">Note:</span> Existing examples of this pattern on the web platform include <code class="idl"><a data-link-type="idl" href="https://compression.spec.whatwg.org/#compressionstream" id="ref-for-compressionstream">CompressionStream</a></code> and <code class="idl"><a data-link-type="idl" href="https://encoding.spec.whatwg.org/#textdecoderstream" id="ref-for-textdecoderstream">TextDecoderStream</a></code>. <a data-link-type="biblio" href="#biblio-compression" title="Compression Standard">[COMPRESSION]</a> <a data-link-type="biblio" href="#biblio-encoding" title="Encoding Standard">[ENCODING]</a></p> <p class="note" role="note">There’s no need to create a wrapper class if you don’t need any API beyond what the base <code class="idl"><a data-link-type="idl" href="#transformstream" id="ref-for-transformstream③①">TransformStream</a></code> class provides. The most common driver for such a wrapper is needing custom <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#constructor-steps" id="ref-for-constructor-steps">constructor steps</a>, but if your conceptual transform stream isn’t meant to be constructed, then using <code class="idl"><a data-link-type="idl" href="#transformstream" id="ref-for-transformstream③②">TransformStream</a></code> directly is fine. </p> <h3 class="heading settled" data-level="9.4" id="other-specs-pairs"><span class="secno">9.4. </span><span class="content">Other stream pairs</span><a class="self-link" href="#other-specs-pairs"></a></h3> <p>Apart from <a data-link-type="dfn" href="#transform-stream" id="ref-for-transform-stream⑥">transform streams</a>, discussed above, specifications often create pairs of <a data-link-type="dfn" href="#readable-stream" id="ref-for-readable-stream②⓪">readable</a> and <a data-link-type="dfn" href="#writable-stream" id="ref-for-writable-stream①③">writable</a> streams. This section gives some guidance for such situations.</p> <p>In all such cases, specifications should use the names <code>readable</code> and <code>writable</code> for the two properties exposing the streams in question. They should not use other names (such as <code>input</code>/<code>output</code> or <code>readableStream</code>/<code>writableStream</code>), and they should not use methods or other non-property means of access to the streams.</p> <h4 class="heading settled" data-level="9.4.1" id="other-specs-duplex"><span class="secno">9.4.1. </span><span class="content">Duplex streams</span><a class="self-link" href="#other-specs-duplex"></a></h4> <p>The most common readable/writable pair is a <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="duplex-stream">duplex stream</dfn>, where the readable and writable streams represent two sides of a single shared resource, such as a socket, connection, or device.</p> <p>The trickiest thing to consider when specifying duplex streams is how to handle operations like <a data-link-type="dfn" href="#cancel-a-readable-stream" id="ref-for-cancel-a-readable-stream①②">canceling</a> the readable side, or closing or <a data-link-type="dfn" href="#abort-a-writable-stream" id="ref-for-abort-a-writable-stream⑧">aborting</a> the writable side. It might make sense to leave duplex streams "half open", with such operations one one side not impacting the other side. Or it might be best to carry over their effects to the other side, e.g. by specifying that your readable side’s <var><a data-link-type="dfn" href="#readablestream-set-up-cancelalgorithm" id="ref-for-readablestream-set-up-cancelalgorithm">cancelAlgorithm</a></var> will <a data-link-type="dfn" href="#writablestream-close" id="ref-for-writablestream-close">close</a> the writable side.</p> <p class="example" id="example-basic-duplex"><a class="self-link" href="#example-basic-duplex"></a>A basic example of a duplex stream, created through JavaScript instead of through specification prose, is found in <a href="#example-both">§ 10.8 A { readable, writable } stream pair wrapping the same underlying resource</a>. It illustrates this carry-over behavior. </p> <p>Another consideration is how to handle the creation of duplex streams which need to be acquired asynchronously, e.g. via establishing a connection. The preferred pattern here is to have a constructible class with a promise-returning property that fulfills with the actual duplex stream object. That duplex stream object can also then expose any information that is only available asynchronously, e.g. connection data. The container class can then provide convenience APIs, such as a function to close the entire connection instead of only closing individual sides.</p> <p class="example" id="example-duplex-with-container"><a class="self-link" href="#example-duplex-with-container"></a>An example of this more complex type of duplex stream is the still-being-specified <code>WebSocketStream</code>. See its <a href="https://github.com/ricea/websocketstream-explainer/blob/master/README.md">explainer</a> and <a href="https://docs.google.com/document/d/1La1ehXw76HP6n1uUeks-WJGFgAnpX2tCjKts7QFJ57Y/edit#">design notes</a>. </p> <p>Because duplex streams obey the <code>readable</code>/<code>writable</code> property contract, they can be used with <code class="idl"><a data-link-type="idl" href="#rs-pipe-through" id="ref-for-rs-pipe-through④">pipeThrough()</a></code>. This doesn’t always make sense, but it could in cases where the underlying resource is in fact performing some sort of transformation.</p> <p class="example" id="example-duplex-pipethrough"><a class="self-link" href="#example-duplex-pipethrough"></a>For an arbitrary WebSocket, piping through a WebSocket-derived duplex stream doesn’t make sense. However, if the WebSocket server is specifically written so that it responds to incoming messages by sending the same data back in some transformed form, then this could be useful and convenient. </p> <h4 class="heading settled" data-level="9.4.2" id="other-specs-endpoints"><span class="secno">9.4.2. </span><span class="content">Endpoint pairs</span><a class="self-link" href="#other-specs-endpoints"></a></h4> <p>Another type of readable/writable pair is an <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="endpoint-pair">endpoint pair</dfn>. In these cases the readable and writable streams represent the two ends of a longer pipeline, with the intention that web developer code insert <a data-link-type="dfn" href="#transform-stream" id="ref-for-transform-stream⑦">transform streams</a> into the middle of them.</p> <div class="example" id="example-endpoint-pair-usage"> <a class="self-link" href="#example-endpoint-pair-usage"></a> Assuming we had a web-platform-provided function <code>createEndpointPair()</code>, web developers would write code like so: <pre class="highlight"><c- a>const</c-> <c- p>{</c-> readable<c- p>,</c-> writable <c- p>}</c-> <c- o>=</c-> createEndpointPair<c- p>();</c-> <c- k>await</c-> readable<c- p>.</c->pipeThrough<c- p>(</c-><c- ow>new</c-> TransformStream<c- p>(...)).</c->pipeTo<c- p>(</c->writable<c- p>);</c-> </pre> </div> <p class="example" id="example-endpoint-pair-webrtc"><a class="self-link" href="#example-endpoint-pair-webrtc"></a><cite>WebRTC Encoded Transform</cite> is an example of this technique, with its <code class="idl"><a data-link-type="idl" href="https://w3c.github.io/webrtc-encoded-transform/#rtcrtpscripttransformer" id="ref-for-rtcrtpscripttransformer">RTCRtpScriptTransformer</a></code> interface which has both <code>readable</code> and <code>writable</code> attributes. </p> <p>Despite such endpoint pairs obeying the <code>readable</code>/<code>writable</code> property contract, it never makes sense to pass them to <code class="idl"><a data-link-type="idl" href="#rs-pipe-through" id="ref-for-rs-pipe-through⑤">pipeThrough()</a></code>.</p> <h3 class="heading settled" data-level="9.5" id="other-specs-piping"><span class="secno">9.5. </span><span class="content">Piping</span><a class="self-link" href="#other-specs-piping"></a></h3> <div class="algorithm" data-algorithm="ReadableStream pipe to"> The result of a <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream⑧①">ReadableStream</a></code> <var>readable</var> <dfn class="dfn-paneled" data-dfn-for="ReadableStream" data-dfn-type="dfn" data-export data-lt="pipe|pipe to|piped to|piping to" id="readablestream-pipe">piped to</dfn> a <code class="idl"><a data-link-type="idl" href="#writablestream" id="ref-for-writablestream④⑧">WritableStream</a></code> <var>writable</var>, given an optional boolean <dfn class="dfn-paneled" data-dfn-for="ReadableStream/pipe to,ReadableStream/piped to" data-dfn-type="dfn" data-export id="readablestream-pipe-to-preventclose"><var>preventClose</var></dfn> (default false), an optional boolean <dfn class="dfn-paneled" data-dfn-for="ReadableStream/pipe to,ReadableStream/piped to" data-dfn-type="dfn" data-export id="readablestream-pipe-to-preventabort"><var>preventAbort</var></dfn> (default false), an optional boolean <dfn class="dfn-paneled" data-dfn-for="ReadableStream/pipe to,ReadableStream/piped to" data-dfn-type="dfn" data-export id="readablestream-pipe-to-preventcancel"><var>preventCancel</var></dfn> (default false), and an optional <code class="idl"><a data-link-type="idl" href="https://dom.spec.whatwg.org/#abortsignal" id="ref-for-abortsignal⑥">AbortSignal</a></code> <dfn class="dfn-paneled" data-dfn-for="ReadableStream/pipe to,ReadableStream/piped to" data-dfn-type="dfn" data-export id="readablestream-pipe-to-signal"><var>signal</var></dfn>, is given by performing the following steps. They will return a <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#idl-promise" id="ref-for-idl-promise③⓪">Promise</a></code> that fulfills when the pipe completes, or rejects with an exception if it fails. <ol> <li data-md> <p class="assertion">Assert: ! <a data-link-type="abstract-op" href="#is-readable-stream-locked" id="ref-for-is-readable-stream-locked①③">IsReadableStreamLocked</a>(<var>readable</var>) is false.</p> <li data-md> <p class="assertion">Assert: ! <a data-link-type="abstract-op" href="#is-writable-stream-locked" id="ref-for-is-writable-stream-locked①⓪">IsWritableStreamLocked</a>(<var>writable</var>) is false.</p> <li data-md> <p>Let <var>signalArg</var> be <var>signal</var> if <var>signal</var> was given, or undefined otherwise.</p> <li data-md> <p>Return ! <a data-link-type="abstract-op" href="#readable-stream-pipe-to" id="ref-for-readable-stream-pipe-to④">ReadableStreamPipeTo</a>(<var>readable</var>, <var>writable</var>, <var>preventClose</var>, <var>preventAbort</var>, <var>preventCancel</var>, <var>signalArg</var>).</p> </ol> <p class="note" role="note">If one doesn’t care about the promise returned, referencing this concept can be a bit awkward. The best we can suggest is "<a data-link-type="dfn" href="#readablestream-pipe" id="ref-for-readablestream-pipe③">pipe</a> <var>readable</var> to <var>writable</var>".</p> </div> <div class="algorithm" data-algorithm="ReadableStream pipe through"> The result of a <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream⑧②">ReadableStream</a></code> <var>readable</var> <dfn class="dfn-paneled" data-dfn-for="ReadableStream" data-dfn-type="dfn" data-export data-lt="pipe through|piped through|piping through" id="readablestream-pipe-through">piped through</dfn> a <code class="idl"><a data-link-type="idl" href="#transformstream" id="ref-for-transformstream③③">TransformStream</a></code> <var>transform</var>, given an optional boolean <dfn class="dfn-paneled" data-dfn-for="ReadableStream/pipe through,ReadableStream/piped through" data-dfn-type="dfn" data-export id="readablestream-pipe-through-preventclose"><var>preventClose</var></dfn> (default false), an optional boolean <dfn class="dfn-paneled" data-dfn-for="ReadableStream/pipe through,ReadableStream/piped through" data-dfn-type="dfn" data-export id="readablestream-pipe-through-preventabort"><var>preventAbort</var></dfn> (default false), an optional boolean <dfn class="dfn-paneled" data-dfn-for="ReadableStream/pipe through,ReadableStream/piped through" data-dfn-type="dfn" data-export id="readablestream-pipe-through-preventcancel"><var>preventCancel</var></dfn> (default false), and an optional <code class="idl"><a data-link-type="idl" href="https://dom.spec.whatwg.org/#abortsignal" id="ref-for-abortsignal⑦">AbortSignal</a></code> <dfn class="dfn-paneled" data-dfn-for="ReadableStream/pipe through,ReadableStream/piped through" data-dfn-type="dfn" data-export id="readablestream-pipe-through-signal"><var>signal</var></dfn>, is given by performing the following steps. The result will be the <a data-link-type="dfn" href="#readable-side" id="ref-for-readable-side①⑤">readable side</a> of <var>transform</var>. <ol> <li data-md> <p class="assertion">Assert: ! <a data-link-type="abstract-op" href="#is-readable-stream-locked" id="ref-for-is-readable-stream-locked①④">IsReadableStreamLocked</a>(<var>readable</var>) is false.</p> <li data-md> <p class="assertion">Assert: ! <a data-link-type="abstract-op" href="#is-writable-stream-locked" id="ref-for-is-writable-stream-locked①①">IsWritableStreamLocked</a>(<var>transform</var>.<a data-link-type="dfn" href="#transformstream-writable" id="ref-for-transformstream-writable①⓪">[[writable]]</a>) is false.</p> <li data-md> <p>Let <var>signalArg</var> be <var>signal</var> if <var>signal</var> was given, or undefined otherwise.</p> <li data-md> <p>Let <var>promise</var> be ! <a data-link-type="abstract-op" href="#readable-stream-pipe-to" id="ref-for-readable-stream-pipe-to⑤">ReadableStreamPipeTo</a>(<var>readable</var>, <var>transform</var>.<a data-link-type="dfn" href="#transformstream-writable" id="ref-for-transformstream-writable①①">[[writable]]</a>, <var>preventClose</var>, <var>preventAbort</var>, <var>preventCancel</var>, <var>signalArg</var>).</p> <li data-md> <p>Set <var>promise</var>.[[PromiseIsHandled]] to true.</p> <li data-md> <p>Return <var>transform</var>.<a data-link-type="dfn" href="#transformstream-readable" id="ref-for-transformstream-readable①④">[[readable]]</a>.</p> </ol> </div> <div class="algorithm" data-algorithm="create a proxy" data-algorithm-for="ReadableStream"> To <dfn class="dfn-paneled" data-dfn-for="ReadableStream" data-dfn-type="dfn" data-export data-lt="create a proxy|creating a proxy" id="readablestream-create-a-proxy">create a proxy</dfn> for a <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream⑧③">ReadableStream</a></code> <var>stream</var>, perform the following steps. The result will be a new <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream⑧④">ReadableStream</a></code> object which pulls its data from <var>stream</var>, while <var>stream</var> itself becomes immediately <a data-link-type="dfn" href="#readablestream-locked" id="ref-for-readablestream-locked②">locked</a> and <a data-link-type="dfn" href="#is-readable-stream-disturbed" id="ref-for-is-readable-stream-disturbed">disturbed</a>. <ol> <li data-md> <p>Let <var>identityTransform</var> be the result of <a data-link-type="dfn" href="#create-an-identity-transformstream" id="ref-for-create-an-identity-transformstream">creating an identity <code>TransformStream</code></a>.</p> <li data-md> <p>Return the result of <var>stream</var> <a data-link-type="dfn" href="#readablestream-pipe-through" id="ref-for-readablestream-pipe-through">piped through</a> <var>identityTransform</var>.</p> </ol> </div> <h2 class="heading settled" data-level="10" id="creating-examples"><span class="secno">10. </span><span class="content">Examples of creating streams</span><a class="self-link" href="#creating-examples"></a></h2> <div class="non-normative"> <p><em>This section, and all its subsections, are non-normative.</em></p> <p>The previous examples throughout the standard have focused on how to use streams. Here we show how to create a stream, using the <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream⑧⑤">ReadableStream</a></code>, <code class="idl"><a data-link-type="idl" href="#writablestream" id="ref-for-writablestream④⑨">WritableStream</a></code>, and <code class="idl"><a data-link-type="idl" href="#transformstream" id="ref-for-transformstream③④">TransformStream</a></code> constructors.</p> <h3 class="heading settled" data-level="10.1" id="example-rs-push-no-backpressure"><span class="secno">10.1. </span><span class="content">A readable stream with an underlying push source (no backpressure support)</span><a class="self-link" href="#example-rs-push-no-backpressure"></a></h3> <p>The following function creates <a data-link-type="dfn" href="#readable-stream" id="ref-for-readable-stream②①">readable streams</a> that wrap <code class="idl"><a data-link-type="idl" href="https://websockets.spec.whatwg.org/#websocket" id="ref-for-websocket">WebSocket</a></code> instances <a data-link-type="biblio" href="#biblio-websockets" title="WebSockets Standard">[WEBSOCKETS]</a>, which are <a data-link-type="dfn" href="#push-source" id="ref-for-push-source②">push sources</a> that do not support backpressure signals. It illustrates how, when adapting a push source, usually most of the work happens in the <code class="idl"><a data-link-type="idl" href="#dom-underlyingsource-start" id="ref-for-dom-underlyingsource-start⑧">start()</a></code> method.</p> <pre class="highlight"><c- a>function</c-> makeReadableWebSocketStream<c- p>(</c->url<c- p>,</c-> protocols<c- p>)</c-> <c- p>{</c-> <c- a>const</c-> ws <c- o>=</c-> <c- ow>new</c-> WebSocket<c- p>(</c->url<c- p>,</c-> protocols<c- p>);</c-> ws<c- p>.</c->binaryType <c- o>=</c-> <c- u>"arraybuffer"</c-><c- p>;</c-> <c- k>return</c-> <c- ow>new</c-> ReadableStream<c- p>({</c-> start<c- p>(</c->controller<c- p>)</c-> <c- p>{</c-> ws<c- p>.</c->onmessage <c- o>=</c-> event <c- p>=></c-> controller<c- p>.</c->enqueue<c- p>(</c->event<c- p>.</c->data<c- p>);</c-> ws<c- p>.</c->onclose <c- o>=</c-> <c- p>()</c-> <c- p>=></c-> controller<c- p>.</c->close<c- p>();</c-> ws<c- p>.</c->onerror <c- o>=</c-> <c- p>()</c-> <c- p>=></c-> controller<c- p>.</c->error<c- p>(</c-><c- ow>new</c-> <c- ne>Error</c-><c- p>(</c-><c- u>"The WebSocket errored!"</c-><c- p>));</c-> <c- p>},</c-> cancel<c- p>()</c-> <c- p>{</c-> ws<c- p>.</c->close<c- p>();</c-> <c- p>}</c-> <c- p>});</c-> <c- p>}</c-> </pre> <p>We can then use this function to create readable streams for a web socket, and pipe that stream to an arbitrary writable stream:</p> <pre class="highlight"><c- a>const</c-> webSocketStream <c- o>=</c-> makeReadableWebSocketStream<c- p>(</c-><c- u>"wss://example.com:443/"</c-><c- p>,</c-> <c- u>"protocol"</c-><c- p>);</c-> webSocketStream<c- p>.</c->pipeTo<c- p>(</c->writableStream<c- p>)</c-> <c- p>.</c->then<c- p>(()</c-> <c- p>=></c-> console<c- p>.</c->log<c- p>(</c-><c- u>"All data successfully written!"</c-><c- p>))</c-> <c- p>.</c-><c- k>catch</c-><c- p>(</c->e <c- p>=></c-> console<c- p>.</c->error<c- p>(</c-><c- u>"Something went wrong!"</c-><c- p>,</c-> e<c- p>));</c-> </pre> <div class="note" id="note-web-socket-wrapping-examples" role="note"> <a class="self-link" href="#note-web-socket-wrapping-examples"></a> This specific style of wrapping a web socket interprets web socket messages directly as <a data-link-type="dfn" href="#chunk" id="ref-for-chunk⑧⑧">chunks</a>. This can be a convenient abstraction, for example when <a data-link-type="dfn" href="#piping" id="ref-for-piping①①">piping</a> to a <a data-link-type="dfn" href="#writable-stream" id="ref-for-writable-stream①④">writable stream</a> or <a data-link-type="dfn" href="#transform-stream" id="ref-for-transform-stream⑧">transform stream</a> for which each web socket message makes sense as a chunk to consume or transform. <p>However, often when people talk about "adding streams support to web sockets", they are hoping instead for a new capability to send an individual web socket message in a streaming fashion, so that e.g. a file could be transferred in a single message without holding all of its contents in memory on the client side. To accomplish this goal, we’d instead want to allow individual web socket messages to themselves be <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream⑧⑥">ReadableStream</a></code> instances. That isn’t what we show in the above example.</p> <p>For more background, see <a href="https://github.com/w3c/webrtc-pc/issues/1732#issuecomment-358428651">this discussion</a>.</p> </div> <h3 class="heading settled" data-level="10.2" id="example-rs-push-backpressure"><span class="secno">10.2. </span><span class="content">A readable stream with an underlying push source and backpressure support</span><a class="self-link" href="#example-rs-push-backpressure"></a></h3> <p>The following function returns <a data-link-type="dfn" href="#readable-stream" id="ref-for-readable-stream②②">readable streams</a> that wrap "backpressure sockets," which are hypothetical objects that have the same API as web sockets, but also provide the ability to pause and resume the flow of data with their <code>readStop</code> and <code>readStart</code> methods. In doing so, this example shows how to apply <a data-link-type="dfn" href="#backpressure" id="ref-for-backpressure②②">backpressure</a> to <a data-link-type="dfn" href="#underlying-source" id="ref-for-underlying-source③②">underlying sources</a> that support it.</p> <pre class="highlight"><c- a>function</c-> makeReadableBackpressureSocketStream<c- p>(</c->host<c- p>,</c-> port<c- p>)</c-> <c- p>{</c-> <c- a>const</c-> socket <c- o>=</c-> createBackpressureSocket<c- p>(</c->host<c- p>,</c-> port<c- p>);</c-> <c- k>return</c-> <c- ow>new</c-> ReadableStream<c- p>({</c-> start<c- p>(</c->controller<c- p>)</c-> <c- p>{</c-> socket<c- p>.</c->ondata <c- o>=</c-> event <c- p>=></c-> <c- p>{</c-> controller<c- p>.</c->enqueue<c- p>(</c->event<c- p>.</c->data<c- p>);</c-> <c- k>if</c-> <c- p>(</c->controller<c- p>.</c->desiredSize <c- o><=</c-> <c- mf>0</c-><c- p>)</c-> <c- p>{</c-> <c- c1>// The internal queue is full, so propagate</c-> <c- c1>// the backpressure signal to the underlying source.</c-> socket<c- p>.</c->readStop<c- p>();</c-> <c- p>}</c-> <c- p>};</c-> socket<c- p>.</c->onend <c- o>=</c-> <c- p>()</c-> <c- p>=></c-> controller<c- p>.</c->close<c- p>();</c-> socket<c- p>.</c->onerror <c- o>=</c-> <c- p>()</c-> <c- p>=></c-> controller<c- p>.</c->error<c- p>(</c-><c- ow>new</c-> <c- ne>Error</c-><c- p>(</c-><c- u>"The socket errored!"</c-><c- p>));</c-> <c- p>},</c-> pull<c- p>()</c-> <c- p>{</c-> <c- c1>// This is called if the internal queue has been emptied, but the</c-> <c- c1>// stream's consumer still wants more data. In that case, restart</c-> <c- c1>// the flow of data if we have previously paused it.</c-> socket<c- p>.</c->readStart<c- p>();</c-> <c- p>},</c-> cancel<c- p>()</c-> <c- p>{</c-> socket<c- p>.</c->close<c- p>();</c-> <c- p>}</c-> <c- p>});</c-> <c- p>}</c-> </pre> <p>We can then use this function to create readable streams for such "backpressure sockets" in the same way we do for web sockets. This time, however, when we pipe to a destination that cannot accept data as fast as the socket is producing it, or if we leave the stream alone without reading from it for some time, a backpressure signal will be sent to the socket.</p> <h3 class="heading settled" data-level="10.3" id="example-rbs-push"><span class="secno">10.3. </span><span class="content">A readable byte stream with an underlying push source (no backpressure support)</span><a class="self-link" href="#example-rbs-push"></a></h3> <p>The following function returns <a data-link-type="dfn" href="#readable-byte-stream" id="ref-for-readable-byte-stream①⑦">readable byte streams</a> that wraps a hypothetical UDP socket API, including a promise-returning <code>select2()</code> method that is meant to be evocative of the POSIX select(2) system call.</p> <p>Since the UDP protocol does not have any built-in backpressure support, the backpressure signal given by <code class="idl"><a data-link-type="idl" href="#rbs-controller-desired-size" id="ref-for-rbs-controller-desired-size④">desiredSize</a></code> is ignored, and the stream ensures that when data is available from the socket but not yet requested by the developer, it is enqueued in the stream’s <a data-link-type="dfn" href="#internal-queues" id="ref-for-internal-queues①②">internal queue</a>, to avoid overflow of the kernel-space queue and a consequent loss of data.</p> <p>This has some interesting consequences for how <a data-link-type="dfn" href="#consumer" id="ref-for-consumer①⓪">consumers</a> interact with the stream. If the consumer does not read data as fast as the socket produces it, the <a data-link-type="dfn" href="#chunk" id="ref-for-chunk⑧⑨">chunks</a> will remain in the stream’s <a data-link-type="dfn" href="#internal-queues" id="ref-for-internal-queues①③">internal queue</a> indefinitely. In this case, using a <a data-link-type="dfn" href="#byob-reader" id="ref-for-byob-reader⑦">BYOB reader</a> will cause an extra copy, to move the data from the stream’s internal queue to the developer-supplied buffer. However, if the consumer consumes the data quickly enough, a <a data-link-type="dfn" href="#byob-reader" id="ref-for-byob-reader⑧">BYOB reader</a> will allow zero-copy reading directly into developer-supplied buffers.</p> <p>(You can imagine a more complex version of this example which uses <code class="idl"><a data-link-type="idl" href="#rbs-controller-desired-size" id="ref-for-rbs-controller-desired-size⑤">desiredSize</a></code> to inform an out-of-band backpressure signaling mechanism, for example by sending a message down the socket to adjust the rate of data being sent. That is left as an exercise for the reader.)</p> <pre class="highlight"><c- a>const</c-> DEFAULT_CHUNK_SIZE <c- o>=</c-> <c- mf>65536</c-><c- p>;</c-> <c- a>function</c-> makeUDPSocketStream<c- p>(</c->host<c- p>,</c-> port<c- p>)</c-> <c- p>{</c-> <c- a>const</c-> socket <c- o>=</c-> createUDPSocket<c- p>(</c->host<c- p>,</c-> port<c- p>);</c-> <c- k>return</c-> <c- ow>new</c-> ReadableStream<c- p>({</c-> type<c- o>:</c-> <c- u>"bytes"</c-><c- p>,</c-> start<c- p>(</c->controller<c- p>)</c-> <c- p>{</c-> readRepeatedly<c- p>().</c-><c- k>catch</c-><c- p>(</c->e <c- p>=></c-> controller<c- p>.</c->error<c- p>(</c->e<c- p>));</c-> <c- a>function</c-> readRepeatedly<c- p>()</c-> <c- p>{</c-> <c- k>return</c-> socket<c- p>.</c->select2<c- p>().</c->then<c- p>(()</c-> <c- p>=></c-> <c- p>{</c-> <c- c1>// Since the socket can become readable even when there’s</c-> <c- c1>// no pending BYOB requests, we need to handle both cases.</c-> <c- a>let</c-> bytesRead<c- p>;</c-> <c- k>if</c-> <c- p>(</c->controller<c- p>.</c->byobRequest<c- p>)</c-> <c- p>{</c-> <c- a>const</c-> v <c- o>=</c-> controller<c- p>.</c->byobRequest<c- p>.</c->view<c- p>;</c-> bytesRead <c- o>=</c-> socket<c- p>.</c->readInto<c- p>(</c->v<c- p>.</c->buffer<c- p>,</c-> v<c- p>.</c->byteOffset<c- p>,</c-> v<c- p>.</c->byteLength<c- p>);</c-> <c- k>if</c-> <c- p>(</c->bytesRead <c- o>===</c-> <c- mf>0</c-><c- p>)</c-> <c- p>{</c-> controller<c- p>.</c->close<c- p>();</c-> <c- p>}</c-> controller<c- p>.</c->byobRequest<c- p>.</c->respond<c- p>(</c->bytesRead<c- p>);</c-> <c- p>}</c-> <c- k>else</c-> <c- p>{</c-> <c- a>const</c-> buffer <c- o>=</c-> <c- ow>new</c-> ArrayBuffer<c- p>(</c->DEFAULT_CHUNK_SIZE<c- p>);</c-> bytesRead <c- o>=</c-> socket<c- p>.</c->readInto<c- p>(</c->buffer<c- p>,</c-> <c- mf>0</c-><c- p>,</c-> DEFAULT_CHUNK_SIZE<c- p>);</c-> <c- k>if</c-> <c- p>(</c->bytesRead <c- o>===</c-> <c- mf>0</c-><c- p>)</c-> <c- p>{</c-> controller<c- p>.</c->close<c- p>();</c-> <c- p>}</c-> <c- k>else</c-> <c- p>{</c-> controller<c- p>.</c->enqueue<c- p>(</c-><c- ow>new</c-> Uint8Array<c- p>(</c->buffer<c- p>,</c-> <c- mf>0</c-><c- p>,</c-> bytesRead<c- p>));</c-> <c- p>}</c-> <c- p>}</c-> <c- k>if</c-> <c- p>(</c->bytesRead <c- o>===</c-> <c- mf>0</c-><c- p>)</c-> <c- p>{</c-> <c- k>return</c-><c- p>;</c-> <c- p>}</c-> <c- k>return</c-> readRepeatedly<c- p>();</c-> <c- p>});</c-> <c- p>}</c-> <c- p>},</c-> cancel<c- p>()</c-> <c- p>{</c-> socket<c- p>.</c->close<c- p>();</c-> <c- p>}</c-> <c- p>});</c-> <c- p>}</c-> </pre> <p><code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream⑧⑦">ReadableStream</a></code> instances returned from this function can now vend <a data-link-type="dfn" href="#byob-reader" id="ref-for-byob-reader⑨">BYOB readers</a>, with all of the aforementioned benefits and caveats.</p> <h3 class="heading settled" data-level="10.4" id="example-rs-pull"><span class="secno">10.4. </span><span class="content">A readable stream with an underlying pull source</span><a class="self-link" href="#example-rs-pull"></a></h3> <p>The following function returns <a data-link-type="dfn" href="#readable-stream" id="ref-for-readable-stream②③">readable streams</a> that wrap portions of the <a href="https://nodejs.org/api/fs.html">Node.js file system API</a> (which themselves map fairly directly to C’s <code>fopen</code>, <code>fread</code>, and <code>fclose</code> trio). Files are a typical example of <a data-link-type="dfn" href="#pull-source" id="ref-for-pull-source②">pull sources</a>. Note how in contrast to the examples with push sources, most of the work here happens on-demand in the <code class="idl"><a data-link-type="idl" href="#dom-underlyingsource-pull" id="ref-for-dom-underlyingsource-pull⑨">pull()</a></code> function, and not at startup time in the <code class="idl"><a data-link-type="idl" href="#dom-underlyingsource-start" id="ref-for-dom-underlyingsource-start⑨">start()</a></code> function.</p> <pre class="highlight"><c- a>const</c-> fs <c- o>=</c-> require<c- p>(</c-><c- u>"fs"</c-><c- p>).</c->promises<c- p>;</c-> <c- a>const</c-> CHUNK_SIZE <c- o>=</c-> <c- mf>1024</c-><c- p>;</c-> <c- a>function</c-> makeReadableFileStream<c- p>(</c->filename<c- p>)</c-> <c- p>{</c-> <c- a>let</c-> fileHandle<c- p>;</c-> <c- a>let</c-> position <c- o>=</c-> <c- mf>0</c-><c- p>;</c-> <c- k>return</c-> <c- ow>new</c-> ReadableStream<c- p>({</c-> <c- k>async</c-> start<c- p>()</c-> <c- p>{</c-> fileHandle <c- o>=</c-> <c- k>await</c-> fs<c- p>.</c->open<c- p>(</c->filename<c- p>,</c-> <c- u>"r"</c-><c- p>);</c-> <c- p>},</c-> <c- k>async</c-> pull<c- p>(</c->controller<c- p>)</c-> <c- p>{</c-> <c- a>const</c-> buffer <c- o>=</c-> <c- ow>new</c-> Uint8Array<c- p>(</c->CHUNK_SIZE<c- p>);</c-> <c- a>const</c-> <c- p>{</c-> bytesRead <c- p>}</c-> <c- o>=</c-> <c- k>await</c-> fileHandle<c- p>.</c->read<c- p>(</c->buffer<c- p>,</c-> <c- mf>0</c-><c- p>,</c-> CHUNK_SIZE<c- p>,</c-> position<c- p>);</c-> <c- k>if</c-> <c- p>(</c->bytesRead <c- o>===</c-> <c- mf>0</c-><c- p>)</c-> <c- p>{</c-> <c- k>await</c-> fileHandle<c- p>.</c->close<c- p>();</c-> controller<c- p>.</c->close<c- p>();</c-> <c- p>}</c-> <c- k>else</c-> <c- p>{</c-> position <c- o>+=</c-> bytesRead<c- p>;</c-> controller<c- p>.</c->enqueue<c- p>(</c->buffer<c- p>.</c->subarray<c- p>(</c-><c- mf>0</c-><c- p>,</c-> bytesRead<c- p>));</c-> <c- p>}</c-> <c- p>},</c-> cancel<c- p>()</c-> <c- p>{</c-> <c- k>return</c-> fileHandle<c- p>.</c->close<c- p>();</c-> <c- p>}</c-> <c- p>});</c-> <c- p>}</c-> </pre> <p>We can then create and use readable streams for files just as we could before for sockets.</p> <h3 class="heading settled" data-level="10.5" id="example-rbs-pull"><span class="secno">10.5. </span><span class="content">A readable byte stream with an underlying pull source</span><a class="self-link" href="#example-rbs-pull"></a></h3> <p>The following function returns <a data-link-type="dfn" href="#readable-byte-stream" id="ref-for-readable-byte-stream①⑧">readable byte streams</a> that allow efficient zero-copy reading of files, again using the <a href="https://nodejs.org/api/fs.html">Node.js file system API</a>. Instead of using a predetermined chunk size of 1024, it attempts to fill the developer-supplied buffer, allowing full control.</p> <pre class="highlight"><c- a>const</c-> fs <c- o>=</c-> require<c- p>(</c-><c- u>"fs"</c-><c- p>).</c->promises<c- p>;</c-> <c- a>const</c-> DEFAULT_CHUNK_SIZE <c- o>=</c-> <c- mf>1024</c-><c- p>;</c-> <c- a>function</c-> makeReadableByteFileStream<c- p>(</c->filename<c- p>)</c-> <c- p>{</c-> <c- a>let</c-> fileHandle<c- p>;</c-> <c- a>let</c-> position <c- o>=</c-> <c- mf>0</c-><c- p>;</c-> <c- k>return</c-> <c- ow>new</c-> ReadableStream<c- p>({</c-> type<c- o>:</c-> <c- u>"bytes"</c-><c- p>,</c-> <c- k>async</c-> start<c- p>()</c-> <c- p>{</c-> fileHandle <c- o>=</c-> <c- k>await</c-> fs<c- p>.</c->open<c- p>(</c->filename<c- p>,</c-> <c- u>"r"</c-><c- p>);</c-> <c- p>},</c-> <c- k>async</c-> pull<c- p>(</c->controller<c- p>)</c-> <c- p>{</c-> <c- c1>// Even when the consumer is using the default reader, the auto-allocation</c-> <c- c1>// feature allocates a buffer and passes it to us via byobRequest.</c-> <c- a>const</c-> v <c- o>=</c-> controller<c- p>.</c->byobRequest<c- p>.</c->view<c- p>;</c-> <c- a>const</c-> <c- p>{</c-> bytesRead <c- p>}</c-> <c- o>=</c-> <c- k>await</c-> fileHandle<c- p>.</c->read<c- p>(</c->v<c- p>,</c-> <c- mf>0</c-><c- p>,</c-> v<c- p>.</c->byteLength<c- p>,</c-> position<c- p>);</c-> <c- k>if</c-> <c- p>(</c->bytesRead <c- o>===</c-> <c- mf>0</c-><c- p>)</c-> <c- p>{</c-> <c- k>await</c-> fileHandle<c- p>.</c->close<c- p>();</c-> controller<c- p>.</c->close<c- p>();</c-> controller<c- p>.</c->byobRequest<c- p>.</c->respond<c- p>(</c-><c- mf>0</c-><c- p>);</c-> <c- p>}</c-> <c- k>else</c-> <c- p>{</c-> position <c- o>+=</c-> bytesRead<c- p>;</c-> controller<c- p>.</c->byobRequest<c- p>.</c->respond<c- p>(</c->bytesRead<c- p>);</c-> <c- p>}</c-> <c- p>},</c-> cancel<c- p>()</c-> <c- p>{</c-> <c- k>return</c-> fileHandle<c- p>.</c->close<c- p>();</c-> <c- p>},</c-> autoAllocateChunkSize<c- o>:</c-> DEFAULT_CHUNK_SIZE <c- p>});</c-> <c- p>}</c-> </pre> <p>With this in hand, we can create and use <a data-link-type="dfn" href="#byob-reader" id="ref-for-byob-reader①⓪">BYOB readers</a> for the returned <code class="idl"><a data-link-type="idl" href="#readablestream" id="ref-for-readablestream⑧⑧">ReadableStream</a></code>. But we can also create <a data-link-type="dfn" href="#default-reader" id="ref-for-default-reader④">default readers</a>, using them in the same simple and generic manner as usual. The adaptation between the low-level byte tracking of the <a data-link-type="dfn" href="#underlying-byte-source" id="ref-for-underlying-byte-source①⑥">underlying byte source</a> shown here, and the higher-level chunk-based consumption of a <a data-link-type="dfn" href="#default-reader" id="ref-for-default-reader⑤">default reader</a>, is all taken care of automatically by the streams implementation. The auto-allocation feature, via the <code class="idl"><a data-link-type="idl" href="#dom-underlyingsource-autoallocatechunksize" id="ref-for-dom-underlyingsource-autoallocatechunksize②">autoAllocateChunkSize</a></code> option, even allows us to write less code, compared to the manual branching in <a href="#example-rbs-push">§ 10.3 A readable byte stream with an underlying push source (no backpressure support)</a>.</p> <h3 class="heading settled" data-level="10.6" id="example-ws-no-backpressure"><span class="secno">10.6. </span><span class="content">A writable stream with no backpressure or success signals</span><a class="self-link" href="#example-ws-no-backpressure"></a></h3> <p>The following function returns a <a data-link-type="dfn" href="#writable-stream" id="ref-for-writable-stream①⑤">writable stream</a> that wraps a <code class="idl"><a data-link-type="idl" href="https://websockets.spec.whatwg.org/#websocket" id="ref-for-websocket①">WebSocket</a></code> <a data-link-type="biblio" href="#biblio-websockets" title="WebSockets Standard">[WEBSOCKETS]</a>. Web sockets do not provide any way to tell when a given chunk of data has been successfully sent (without awkward polling of <code class="idl"><a data-link-type="idl" href="https://websockets.spec.whatwg.org/#dom-websocket-bufferedamount" id="ref-for-dom-websocket-bufferedamount">bufferedAmount</a></code>, which we leave as an exercise to the reader). As such, this writable stream has no ability to communicate accurate <a data-link-type="dfn" href="#backpressure" id="ref-for-backpressure②③">backpressure</a> signals or write success/failure to its <a data-link-type="dfn" href="#producer" id="ref-for-producer①④">producers</a>. That is, the promises returned by its <a data-link-type="dfn" href="#writer" id="ref-for-writer⑥">writer</a>'s <code class="idl"><a data-link-type="idl" href="#default-writer-write" id="ref-for-default-writer-write①⑥">write()</a></code> method and <code class="idl"><a data-link-type="idl" href="#default-writer-ready" id="ref-for-default-writer-ready①⓪">ready</a></code> getter will always fulfill immediately.</p> <pre class="highlight"><c- a>function</c-> makeWritableWebSocketStream<c- p>(</c->url<c- p>,</c-> protocols<c- p>)</c-> <c- p>{</c-> <c- a>const</c-> ws <c- o>=</c-> <c- ow>new</c-> WebSocket<c- p>(</c->url<c- p>,</c-> protocols<c- p>);</c-> <c- k>return</c-> <c- ow>new</c-> WritableStream<c- p>({</c-> start<c- p>(</c->controller<c- p>)</c-> <c- p>{</c-> ws<c- p>.</c->onerror <c- o>=</c-> <c- p>()</c-> <c- p>=></c-> <c- p>{</c-> controller<c- p>.</c->error<c- p>(</c-><c- ow>new</c-> <c- ne>Error</c-><c- p>(</c-><c- u>"The WebSocket errored!"</c-><c- p>));</c-> ws<c- p>.</c->onclose <c- o>=</c-> <c- kc>null</c-><c- p>;</c-> <c- p>};</c-> ws<c- p>.</c->onclose <c- o>=</c-> <c- p>()</c-> <c- p>=></c-> controller<c- p>.</c->error<c- p>(</c-><c- ow>new</c-> <c- ne>Error</c-><c- p>(</c-><c- u>"The server closed the connection unexpectedly!"</c-><c- p>));</c-> <c- k>return</c-> <c- ow>new</c-> Promise<c- p>(</c->resolve <c- p>=></c-> ws<c- p>.</c->onopen <c- o>=</c-> resolve<c- p>);</c-> <c- p>},</c-> write<c- p>(</c->chunk<c- p>)</c-> <c- p>{</c-> ws<c- p>.</c->send<c- p>(</c->chunk<c- p>);</c-> <c- c1>// Return immediately, since the web socket gives us no easy way to tell</c-> <c- c1>// when the write completes.</c-> <c- p>},</c-> close<c- p>()</c-> <c- p>{</c-> <c- k>return</c-> closeWS<c- p>(</c-><c- mf>1000</c-><c- p>);</c-> <c- p>},</c-> abort<c- p>(</c->reason<c- p>)</c-> <c- p>{</c-> <c- k>return</c-> closeWS<c- p>(</c-><c- mf>4000</c-><c- p>,</c-> reason <c- o>&&</c-> reason<c- p>.</c->message<c- p>);</c-> <c- p>},</c-> <c- p>});</c-> <c- a>function</c-> closeWS<c- p>(</c->code<c- p>,</c-> reasonString<c- p>)</c-> <c- p>{</c-> <c- k>return</c-> <c- ow>new</c-> Promise<c- p>((</c->resolve<c- p>,</c-> reject<c- p>)</c-> <c- p>=></c-> <c- p>{</c-> ws<c- p>.</c->onclose <c- o>=</c-> e <c- p>=></c-> <c- p>{</c-> <c- k>if</c-> <c- p>(</c->e<c- p>.</c->wasClean<c- p>)</c-> <c- p>{</c-> resolve<c- p>();</c-> <c- p>}</c-> <c- k>else</c-> <c- p>{</c-> reject<c- p>(</c-><c- ow>new</c-> <c- ne>Error</c-><c- p>(</c-><c- u>"The connection was not closed cleanly"</c-><c- p>));</c-> <c- p>}</c-> <c- p>};</c-> ws<c- p>.</c->close<c- p>(</c->code<c- p>,</c-> reasonString<c- p>);</c-> <c- p>});</c-> <c- p>}</c-> <c- p>}</c-> </pre> <p>We can then use this function to create writable streams for a web socket, and pipe an arbitrary readable stream to it:</p> <pre class="highlight"><c- a>const</c-> webSocketStream <c- o>=</c-> makeWritableWebSocketStream<c- p>(</c-><c- u>"wss://example.com:443/"</c-><c- p>,</c-> <c- u>"protocol"</c-><c- p>);</c-> readableStream<c- p>.</c->pipeTo<c- p>(</c->webSocketStream<c- p>)</c-> <c- p>.</c->then<c- p>(()</c-> <c- p>=></c-> console<c- p>.</c->log<c- p>(</c-><c- u>"All data successfully written!"</c-><c- p>))</c-> <c- p>.</c-><c- k>catch</c-><c- p>(</c->e <c- p>=></c-> console<c- p>.</c->error<c- p>(</c-><c- u>"Something went wrong!"</c-><c- p>,</c-> e<c- p>));</c-> </pre> <p class="note" role="note">See <a href="#note-web-socket-wrapping-examples">the earlier note</a> about this style of wrapping web sockets into streams. </p> <h3 class="heading settled" data-level="10.7" id="example-ws-backpressure"><span class="secno">10.7. </span><span class="content">A writable stream with backpressure and success signals</span><a class="self-link" href="#example-ws-backpressure"></a></h3> <p>The following function returns <a data-link-type="dfn" href="#writable-stream" id="ref-for-writable-stream①⑥">writable streams</a> that wrap portions of the <a href="https://nodejs.org/api/fs.html">Node.js file system API</a> (which themselves map fairly directly to C’s <code>fopen</code>, <code>fwrite</code>, and <code>fclose</code> trio). Since the API we are wrapping provides a way to tell when a given write succeeds, this stream will be able to communicate <a data-link-type="dfn" href="#backpressure" id="ref-for-backpressure②④">backpressure</a> signals as well as whether an individual write succeeded or failed.</p> <pre class="highlight"><c- a>const</c-> fs <c- o>=</c-> require<c- p>(</c-><c- u>"fs"</c-><c- p>).</c->promises<c- p>;</c-> <c- a>function</c-> makeWritableFileStream<c- p>(</c->filename<c- p>)</c-> <c- p>{</c-> <c- a>let</c-> fileHandle<c- p>;</c-> <c- k>return</c-> <c- ow>new</c-> WritableStream<c- p>({</c-> <c- k>async</c-> start<c- p>()</c-> <c- p>{</c-> fileHandle <c- o>=</c-> <c- k>await</c-> fs<c- p>.</c->open<c- p>(</c->filename<c- p>,</c-> <c- u>"w"</c-><c- p>);</c-> <c- p>},</c-> write<c- p>(</c->chunk<c- p>)</c-> <c- p>{</c-> <c- k>return</c-> fileHandle<c- p>.</c->write<c- p>(</c->chunk<c- p>,</c-> <c- mf>0</c-><c- p>,</c-> chunk<c- p>.</c->length<c- p>);</c-> <c- p>},</c-> close<c- p>()</c-> <c- p>{</c-> <c- k>return</c-> fileHandle<c- p>.</c->close<c- p>();</c-> <c- p>},</c-> abort<c- p>()</c-> <c- p>{</c-> <c- k>return</c-> fileHandle<c- p>.</c->close<c- p>();</c-> <c- p>}</c-> <c- p>});</c-> <c- p>}</c-> </pre> <p>We can then use this function to create a writable stream for a file, and write individual <a data-link-type="dfn" href="#chunk" id="ref-for-chunk⑨⓪">chunks</a> of data to it:</p> <pre class="highlight"><c- a>const</c-> fileStream <c- o>=</c-> makeWritableFileStream<c- p>(</c-><c- u>"/example/path/on/fs.txt"</c-><c- p>);</c-> <c- a>const</c-> writer <c- o>=</c-> fileStream<c- p>.</c->getWriter<c- p>();</c-> writer<c- p>.</c->write<c- p>(</c-><c- u>"To stream, or not to stream\n"</c-><c- p>);</c-> writer<c- p>.</c->write<c- p>(</c-><c- u>"That is the question\n"</c-><c- p>);</c-> writer<c- p>.</c->close<c- p>()</c-> <c- p>.</c->then<c- p>(()</c-> <c- p>=></c-> console<c- p>.</c->log<c- p>(</c-><c- u>"chunks written and stream closed successfully!"</c-><c- p>))</c-> <c- p>.</c-><c- k>catch</c-><c- p>(</c->e <c- p>=></c-> console<c- p>.</c->error<c- p>(</c->e<c- p>));</c-> </pre> <p>Note that if a particular call to <code>fileHandle.write</code> takes a longer time, the returned promise will fulfill later. In the meantime, additional writes can be queued up, which are stored in the stream’s internal queue. The accumulation of chunks in this queue can change the stream to return a pending promise from the <code class="idl"><a data-link-type="idl" href="#default-writer-ready" id="ref-for-default-writer-ready①①">ready</a></code> getter, which is a signal to <a data-link-type="dfn" href="#producer" id="ref-for-producer①⑤">producers</a> that they would benefit from backing off and stopping writing, if possible.</p> <p>The way in which the writable stream queues up writes is especially important in this case, since as stated in <a href="https://nodejs.org/api/fs.html#fs_filehandle_write_buffer_offset_length_position">the documentation for <code>fileHandle.write</code></a>, "it is unsafe to use <code>filehandle.write</code> multiple times on the same file without waiting for the promise." But we don’t have to worry about that when writing the <code>makeWritableFileStream</code> function, since the stream implementation guarantees that the <a data-link-type="dfn" href="#underlying-sink" id="ref-for-underlying-sink③⑧">underlying sink</a>'s <code class="idl"><a data-link-type="idl" href="#dom-underlyingsink-write" id="ref-for-dom-underlyingsink-write⑥">write()</a></code> method will not be called until any promises returned by previous calls have fulfilled!</p> <h3 class="heading settled" data-level="10.8" id="example-both"><span class="secno">10.8. </span><span class="content">A { readable, writable } stream pair wrapping the same underlying resource</span><a class="self-link" href="#example-both"></a></h3> <p>The following function returns an object of the form <code>{ readable, writable }</code>, with the <code>readable</code> property containing a readable stream and the <code>writable</code> property containing a writable stream, where both streams wrap the same underlying web socket resource. In essence, this combines <a href="#example-rs-push-no-backpressure">§ 10.1 A readable stream with an underlying push source (no backpressure support)</a> and <a href="#example-ws-no-backpressure">§ 10.6 A writable stream with no backpressure or success signals</a>.</p> <p>While doing so, it illustrates how you can use JavaScript classes to create reusable underlying sink and underlying source abstractions.</p> <pre class="highlight"><c- a>function</c-> streamifyWebSocket<c- p>(</c->url<c- p>,</c-> protocol<c- p>)</c-> <c- p>{</c-> <c- a>const</c-> ws <c- o>=</c-> <c- ow>new</c-> WebSocket<c- p>(</c->url<c- p>,</c-> protocols<c- p>);</c-> ws<c- p>.</c->binaryType <c- o>=</c-> <c- u>"arraybuffer"</c-><c- p>;</c-> <c- k>return</c-> <c- p>{</c-> readable<c- o>:</c-> <c- ow>new</c-> ReadableStream<c- p>(</c-><c- ow>new</c-> WebSocketSource<c- p>(</c->ws<c- p>)),</c-> writable<c- o>:</c-> <c- ow>new</c-> WritableStream<c- p>(</c-><c- ow>new</c-> WebSocketSink<c- p>(</c->ws<c- p>))</c-> <c- p>};</c-> <c- p>}</c-> <c- a>class</c-> WebSocketSource <c- p>{</c-> <c- kr>constructor</c-><c- p>(</c->ws<c- p>)</c-> <c- p>{</c-> <c- k>this</c-><c- p>.</c->_ws <c- o>=</c-> ws<c- p>;</c-> <c- p>}</c-> start<c- p>(</c->controller<c- p>)</c-> <c- p>{</c-> <c- k>this</c-><c- p>.</c->_ws<c- p>.</c->onmessage <c- o>=</c-> event <c- p>=></c-> controller<c- p>.</c->enqueue<c- p>(</c->event<c- p>.</c->data<c- p>);</c-> <c- k>this</c-><c- p>.</c->_ws<c- p>.</c->onclose <c- o>=</c-> <c- p>()</c-> <c- p>=></c-> controller<c- p>.</c->close<c- p>();</c-> <c- k>this</c-><c- p>.</c->_ws<c- p>.</c->addEventListener<c- p>(</c-><c- u>"error"</c-><c- p>,</c-> <c- p>()</c-> <c- p>=></c-> <c- p>{</c-> controller<c- p>.</c->error<c- p>(</c-><c- ow>new</c-> <c- ne>Error</c-><c- p>(</c-><c- u>"The WebSocket errored!"</c-><c- p>));</c-> <c- p>});</c-> <c- p>}</c-> cancel<c- p>()</c-> <c- p>{</c-> <c- k>this</c-><c- p>.</c->_ws<c- p>.</c->close<c- p>();</c-> <c- p>}</c-> <c- p>}</c-> <c- a>class</c-> WebSocketSink <c- p>{</c-> <c- kr>constructor</c-><c- p>(</c->ws<c- p>)</c-> <c- p>{</c-> <c- k>this</c-><c- p>.</c->_ws <c- o>=</c-> ws<c- p>;</c-> <c- p>}</c-> start<c- p>(</c->controller<c- p>)</c-> <c- p>{</c-> <c- k>this</c-><c- p>.</c->_ws<c- p>.</c->onclose <c- o>=</c-> <c- p>()</c-> <c- p>=></c-> controller<c- p>.</c->error<c- p>(</c-><c- ow>new</c-> <c- ne>Error</c-><c- p>(</c-><c- u>"The server closed the connection unexpectedly!"</c-><c- p>));</c-> <c- k>this</c-><c- p>.</c->_ws<c- p>.</c->addEventListener<c- p>(</c-><c- u>"error"</c-><c- p>,</c-> <c- p>()</c-> <c- p>=></c-> <c- p>{</c-> controller<c- p>.</c->error<c- p>(</c-><c- ow>new</c-> <c- ne>Error</c-><c- p>(</c-><c- u>"The WebSocket errored!"</c-><c- p>));</c-> <c- k>this</c-><c- p>.</c->_ws<c- p>.</c->onclose <c- o>=</c-> <c- kc>null</c-><c- p>;</c-> <c- p>});</c-> <c- k>return</c-> <c- ow>new</c-> Promise<c- p>(</c->resolve <c- p>=></c-> <c- k>this</c-><c- p>.</c->_ws<c- p>.</c->onopen <c- o>=</c-> resolve<c- p>);</c-> <c- p>}</c-> write<c- p>(</c->chunk<c- p>)</c-> <c- p>{</c-> <c- k>this</c-><c- p>.</c->_ws<c- p>.</c->send<c- p>(</c->chunk<c- p>);</c-> <c- p>}</c-> close<c- p>()</c-> <c- p>{</c-> <c- k>return</c-> <c- k>this</c-><c- p>.</c->_closeWS<c- p>(</c-><c- mf>1000</c-><c- p>);</c-> <c- p>}</c-> abort<c- p>(</c->reason<c- p>)</c-> <c- p>{</c-> <c- k>return</c-> <c- k>this</c-><c- p>.</c->_closeWS<c- p>(</c-><c- mf>4000</c-><c- p>,</c-> reason <c- o>&&</c-> reason<c- p>.</c->message<c- p>);</c-> <c- p>}</c-> _closeWS<c- p>(</c->code<c- p>,</c-> reasonString<c- p>)</c-> <c- p>{</c-> <c- k>return</c-> <c- ow>new</c-> Promise<c- p>((</c->resolve<c- p>,</c-> reject<c- p>)</c-> <c- p>=></c-> <c- p>{</c-> <c- k>this</c-><c- p>.</c->_ws<c- p>.</c->onclose <c- o>=</c-> e <c- p>=></c-> <c- p>{</c-> <c- k>if</c-> <c- p>(</c->e<c- p>.</c->wasClean<c- p>)</c-> <c- p>{</c-> resolve<c- p>();</c-> <c- p>}</c-> <c- k>else</c-> <c- p>{</c-> reject<c- p>(</c-><c- ow>new</c-> <c- ne>Error</c-><c- p>(</c-><c- u>"The connection was not closed cleanly"</c-><c- p>));</c-> <c- p>}</c-> <c- p>};</c-> <c- k>this</c-><c- p>.</c->_ws<c- p>.</c->close<c- p>(</c->code<c- p>,</c-> reasonString<c- p>);</c-> <c- p>});</c-> <c- p>}</c-> <c- p>}</c-> </pre> <p>We can then use the objects created by this function to communicate with a remote web socket, using the standard stream APIs:</p> <pre class="highlight"><c- a>const</c-> streamyWS <c- o>=</c-> streamifyWebSocket<c- p>(</c-><c- u>"wss://example.com:443/"</c-><c- p>,</c-> <c- u>"protocol"</c-><c- p>);</c-> <c- a>const</c-> writer <c- o>=</c-> streamyWS<c- p>.</c->writable<c- p>.</c->getWriter<c- p>();</c-> <c- a>const</c-> reader <c- o>=</c-> streamyWS<c- p>.</c->readable<c- p>.</c->getReader<c- p>();</c-> writer<c- p>.</c->write<c- p>(</c-><c- u>"Hello"</c-><c- p>);</c-> writer<c- p>.</c->write<c- p>(</c-><c- u>"web socket!"</c-><c- p>);</c-> reader<c- p>.</c->read<c- p>().</c->then<c- p>(({</c-> value<c- p>,</c-> done <c- p>})</c-> <c- p>=></c-> <c- p>{</c-> console<c- p>.</c->log<c- p>(</c-><c- u>"The web socket says: "</c-><c- p>,</c-> value<c- p>);</c-> <c- p>});</c-> </pre> <p>Note how in this setup canceling the <code>readable</code> side will implicitly close the <code>writable</code> side, and similarly, closing or aborting the <code>writable</code> side will implicitly close the <code>readable</code> side.</p> <p class="note" role="note">See <a href="#note-web-socket-wrapping-examples">the earlier note</a> about this style of wrapping web sockets into streams. </p> </div> <h3 class="heading settled" data-level="10.9" id="example-ts-lipfuzz"><span class="secno">10.9. </span><span class="content">A transform stream that replaces template tags</span><a class="self-link" href="#example-ts-lipfuzz"></a></h3> <p>It’s often useful to substitute tags with variables on a stream of data, where the parts that need to be replaced are small compared to the overall data size. This example presents a simple way to do that. It maps strings to strings, transforming a template like <code>"Time: {{time}} Message: {{message}}"</code> to <code>"Time: 15:36 Message: hello"</code> assuming that <code>{ time: "15:36", message: "hello" }</code> was passed in the <code>substitutions</code> parameter to <code>LipFuzzTransformer</code>.</p> <p>This example also demonstrates one way to deal with a situation where a chunk contains partial data that cannot be transformed until more data is received. In this case, a partial template tag will be accumulated in the <code>partialChunk</code> property until either the end of the tag is found or the end of the stream is reached.</p> <pre class="highlight"><c- a>class</c-> LipFuzzTransformer <c- p>{</c-> <c- kr>constructor</c-><c- p>(</c->substitutions<c- p>)</c-> <c- p>{</c-> <c- k>this</c-><c- p>.</c->substitutions <c- o>=</c-> substitutions<c- p>;</c-> <c- k>this</c-><c- p>.</c->partialChunk <c- o>=</c-> <c- u>""</c-><c- p>;</c-> <c- k>this</c-><c- p>.</c->lastIndex <c- o>=</c-> <c- kc>undefined</c-><c- p>;</c-> <c- p>}</c-> transform<c- p>(</c->chunk<c- p>,</c-> controller<c- p>)</c-> <c- p>{</c-> chunk <c- o>=</c-> <c- k>this</c-><c- p>.</c->partialChunk <c- o>+</c-> chunk<c- p>;</c-> <c- k>this</c-><c- p>.</c->partialChunk <c- o>=</c-> <c- u>""</c-><c- p>;</c-> <c- c1>// lastIndex is the index of the first character after the last substitution.</c-> <c- k>this</c-><c- p>.</c->lastIndex <c- o>=</c-> <c- mf>0</c-><c- p>;</c-> chunk <c- o>=</c-> chunk<c- p>.</c->replace<c- p>(</c-><c- sr>/\{\{([a-zA-Z0-9_-]+)\}\}/g</c-><c- p>,</c-> <c- k>this</c-><c- p>.</c->replaceTag<c- p>.</c->bind<c- p>(</c-><c- k>this</c-><c- p>));</c-> <c- c1>// Regular expression for an incomplete template at the end of a string.</c-> <c- a>const</c-> partialAtEndRegexp <c- o>=</c-> <c- sr>/\{(\{([a-zA-Z0-9_-]+(\})?)?)?$/g</c-><c- p>;</c-> <c- c1>// Avoid looking at any characters that have already been substituted.</c-> partialAtEndRegexp<c- p>.</c->lastIndex <c- o>=</c-> <c- k>this</c-><c- p>.</c->lastIndex<c- p>;</c-> <c- k>this</c-><c- p>.</c->lastIndex <c- o>=</c-> <c- kc>undefined</c-><c- p>;</c-> <c- a>const</c-> match <c- o>=</c-> partialAtEndRegexp<c- p>.</c->exec<c- p>(</c->chunk<c- p>);</c-> <c- k>if</c-> <c- p>(</c->match<c- p>)</c-> <c- p>{</c-> <c- k>this</c-><c- p>.</c->partialChunk <c- o>=</c-> chunk<c- p>.</c->substring<c- p>(</c->match<c- p>.</c->index<c- p>);</c-> chunk <c- o>=</c-> chunk<c- p>.</c->substring<c- p>(</c-><c- mf>0</c-><c- p>,</c-> match<c- p>.</c->index<c- p>);</c-> <c- p>}</c-> controller<c- p>.</c->enqueue<c- p>(</c->chunk<c- p>);</c-> <c- p>}</c-> flush<c- p>(</c->controller<c- p>)</c-> <c- p>{</c-> <c- k>if</c-> <c- p>(</c-><c- k>this</c-><c- p>.</c->partialChunk<c- p>.</c->length <c- o>></c-> <c- mf>0</c-><c- p>)</c-> <c- p>{</c-> controller<c- p>.</c->enqueue<c- p>(</c-><c- k>this</c-><c- p>.</c->partialChunk<c- p>);</c-> <c- p>}</c-> <c- p>}</c-> replaceTag<c- p>(</c->match<c- p>,</c-> p1<c- p>,</c-> offset<c- p>)</c-> <c- p>{</c-> <c- a>let</c-> replacement <c- o>=</c-> <c- k>this</c-><c- p>.</c->substitutions<c- p>[</c->p1<c- p>];</c-> <c- k>if</c-> <c- p>(</c->replacement <c- o>===</c-> <c- kc>undefined</c-><c- p>)</c-> <c- p>{</c-> replacement <c- o>=</c-> <c- u>""</c-><c- p>;</c-> <c- p>}</c-> <c- k>this</c-><c- p>.</c->lastIndex <c- o>=</c-> offset <c- o>+</c-> replacement<c- p>.</c->length<c- p>;</c-> <c- k>return</c-> replacement<c- p>;</c-> <c- p>}</c-> <c- p>}</c-> </pre> <p>In this case we define the <a data-link-type="dfn" href="#transformer" id="ref-for-transformer①⓪">transformer</a> to be passed to the <code class="idl"><a data-link-type="idl" href="#transformstream" id="ref-for-transformstream③⑤">TransformStream</a></code> constructor as a class. This is useful when there is instance data to track.</p> <p>The class would be used in code like:</p> <pre class="highlight"><c- a>const</c-> data <c- o>=</c-> <c- p>{</c-> userName<c- p>,</c-> displayName<c- p>,</c-> icon<c- p>,</c-> date <c- p>};</c-> <c- a>const</c-> ts <c- o>=</c-> <c- ow>new</c-> TransformStream<c- p>(</c-><c- ow>new</c-> LipFuzzTransformer<c- p>(</c->data<c- p>));</c-> fetchEvent<c- p>.</c->respondWith<c- p>(</c-> fetch<c- p>(</c->fetchEvent<c- p>.</c->request<c- p>.</c->url<c- p>).</c->then<c- p>(</c->response <c- p>=></c-> <c- p>{</c-> <c- a>const</c-> transformedBody <c- o>=</c-> response<c- p>.</c->body <c- c1>// Decode the binary-encoded response to string</c-> <c- p>.</c->pipeThrough<c- p>(</c-><c- ow>new</c-> TextDecoderStream<c- p>())</c-> <c- c1>// Apply the LipFuzzTransformer</c-> <c- p>.</c->pipeThrough<c- p>(</c->ts<c- p>)</c-> <c- c1>// Encode the transformed string</c-> <c- p>.</c->pipeThrough<c- p>(</c-><c- ow>new</c-> TextEncoderStream<c- p>());</c-> <c- k>return</c-> <c- ow>new</c-> Response<c- p>(</c->transformedBody<c- p>);</c-> <c- p>})</c-> <c- p>);</c-> </pre> <p class="warning">For simplicity, <code>LipFuzzTransformer</code> performs unescaped text substitutions. In real applications, a template system that performs context-aware escaping is good practice for security and robustness. </p> <h3 class="heading settled" data-level="10.10" id="example-ts-sync-mapper"><span class="secno">10.10. </span><span class="content">A transform stream created from a sync mapper function</span><a class="self-link" href="#example-ts-sync-mapper"></a></h3> <p>The following function allows creating new <code class="idl"><a data-link-type="idl" href="#transformstream" id="ref-for-transformstream③⑥">TransformStream</a></code> instances from synchronous "mapper" functions, of the type you would normally pass to <code class="idl"><a data-link-type="idl" href="https://tc39.es/ecma262/#sec-array.prototype.map" id="ref-for-sec-array.prototype.map">Array.prototype.map</a></code>. It demonstrates that the API is concise even for trivial transforms.</p> <pre class="highlight"><c- a>function</c-> mapperTransformStream<c- p>(</c->mapperFunction<c- p>)</c-> <c- p>{</c-> <c- k>return</c-> <c- ow>new</c-> TransformStream<c- p>({</c-> transform<c- p>(</c->chunk<c- p>,</c-> controller<c- p>)</c-> <c- p>{</c-> controller<c- p>.</c->enqueue<c- p>(</c->mapperFunction<c- p>(</c->chunk<c- p>));</c-> <c- p>}</c-> <c- p>});</c-> <c- p>}</c-> </pre> <p>This function can then be used to create a <code class="idl"><a data-link-type="idl" href="#transformstream" id="ref-for-transformstream③⑦">TransformStream</a></code> that uppercases all its inputs:</p> <pre class="highlight"><c- a>const</c-> ts <c- o>=</c-> mapperTransformStream<c- p>(</c->chunk <c- p>=></c-> chunk<c- p>.</c->toUpperCase<c- p>());</c-> <c- a>const</c-> writer <c- o>=</c-> ts<c- p>.</c->writable<c- p>.</c->getWriter<c- p>();</c-> <c- a>const</c-> reader <c- o>=</c-> ts<c- p>.</c->readable<c- p>.</c->getReader<c- p>();</c-> writer<c- p>.</c->write<c- p>(</c-><c- u>"No need to shout"</c-><c- p>);</c-> <c- c1>// Logs "NO NEED TO SHOUT":</c-> reader<c- p>.</c->read<c- p>().</c->then<c- p>(({</c-> value <c- p>})</c-> <c- p>=></c-> console<c- p>.</c->log<c- p>(</c->value<c- p>));</c-> </pre> <p>Although a synchronous transform never causes backpressure itself, it will only transform chunks as long as there is no backpressure, so resources will not be wasted.</p> <p>Exceptions error the stream in a natural way:</p> <pre class="highlight"><c- a>const</c-> ts <c- o>=</c-> mapperTransformStream<c- p>(</c->chunk <c- p>=></c-> JSON<c- p>.</c->parse<c- p>(</c->chunk<c- p>));</c-> <c- a>const</c-> writer <c- o>=</c-> ts<c- p>.</c->writable<c- p>.</c->getWriter<c- p>();</c-> <c- a>const</c-> reader <c- o>=</c-> ts<c- p>.</c->readable<c- p>.</c->getReader<c- p>();</c-> writer<c- p>.</c->write<c- p>(</c-><c- u>"[1, "</c-><c- p>);</c-> <c- c1>// Logs a SyntaxError, twice:</c-> reader<c- p>.</c->read<c- p>().</c-><c- k>catch</c-><c- p>(</c->e <c- p>=></c-> console<c- p>.</c->error<c- p>(</c->e<c- p>));</c-> writer<c- p>.</c->write<c- p>(</c-><c- u>"{}"</c-><c- p>).</c-><c- k>catch</c-><c- p>(</c->e <c- p>=></c-> console<c- p>.</c->error<c- p>(</c->e<c- p>));</c-> </pre> <h3 class="heading settled" data-level="10.11" id="example-identity-transform-usages"><span class="secno">10.11. </span><span class="content">Using an identity transform stream as a primitive to create new readable streams</span><a class="self-link" href="#example-identity-transform-usages"></a></h3> <p>Combining an <a data-link-type="dfn" href="#identity-transform-stream" id="ref-for-identity-transform-stream②">identity transform stream</a> with <code class="idl"><a data-link-type="idl" href="#rs-pipe-to" id="ref-for-rs-pipe-to⑧">pipeTo()</a></code> is a powerful way to manipulate streams. This section contains a couple of examples of this general technique.</p> <p>It’s sometimes natural to treat a promise for a <a data-link-type="dfn" href="#readable-stream" id="ref-for-readable-stream②④">readable stream</a> as if it were a readable stream. A simple adapter function is all that’s needed:</p> <pre class="highlight"><c- a>function</c-> promiseToReadable<c- p>(</c->promiseForReadable<c- p>)</c-> <c- p>{</c-> <c- a>const</c-> ts <c- o>=</c-> <c- ow>new</c-> TransformStream<c- p>();</c-> promiseForReadable <c- p>.</c->then<c- p>(</c->readable <c- p>=></c-> readable<c- p>.</c->pipeTo<c- p>(</c->ts<c- p>.</c->writable<c- p>))</c-> <c- p>.</c-><c- k>catch</c-><c- p>(</c->reason <c- p>=></c-> ts<c- p>.</c->writable<c- p>.</c->abort<c- p>(</c->reason<c- p>))</c-> <c- p>.</c-><c- k>catch</c-><c- p>(()</c-> <c- p>=></c-> <c- p>{});</c-> <c- k>return</c-> ts<c- p>.</c->readable<c- p>;</c-> <c- p>}</c-> </pre> <p>Here, we pipe the data to the <a data-link-type="dfn" href="#writable-side" id="ref-for-writable-side①④">writable side</a> and return the <a data-link-type="dfn" href="#readable-side" id="ref-for-readable-side①⑥">readable side</a>. If the pipe errors, we <a data-link-type="dfn" href="#abort-a-writable-stream" id="ref-for-abort-a-writable-stream⑨">abort</a> the writable side, which automatically propagates the error to the returned readable side. If the writable side had already been errored by <code class="idl"><a data-link-type="idl" href="#rs-pipe-to" id="ref-for-rs-pipe-to⑨">pipeTo()</a></code>, then the <code class="idl"><a data-link-type="idl" href="#ws-abort" id="ref-for-ws-abort⑥">abort()</a></code> call will return a rejection, which we can safely ignore.</p> <p>A more complex extension of this is concatenating multiple readable streams into one:</p> <pre class="highlight"><c- a>function</c-> concatenateReadables<c- p>(</c->readables<c- p>)</c-> <c- p>{</c-> <c- a>const</c-> ts <c- o>=</c-> <c- ow>new</c-> TransformStream<c- p>();</c-> <c- a>let</c-> promise <c- o>=</c-> Promise<c- p>.</c->resolve<c- p>();</c-> <c- k>for</c-> <c- p>(</c-><c- a>const</c-> readable <c- k>of</c-> readables<c- p>)</c-> <c- p>{</c-> promise <c- o>=</c-> promise<c- p>.</c->then<c- p>(</c-> <c- p>()</c-> <c- p>=></c-> readable<c- p>.</c->pipeTo<c- p>(</c->ts<c- p>.</c->writable<c- p>,</c-> <c- p>{</c-> preventClose<c- o>:</c-> <c- kc>true</c-> <c- p>}),</c-> reason <c- p>=></c-> <c- p>{</c-> <c- k>return</c-> Promise<c- p>.</c->all<c- p>([</c-> ts<c- p>.</c->writable<c- p>.</c->abort<c- p>(</c->reason<c- p>),</c-> readable<c- p>.</c->cancel<c- p>(</c->reason<c- p>)</c-> <c- p>]);</c-> <c- p>}</c-> <c- p>);</c-> <c- p>}</c-> promise<c- p>.</c->then<c- p>(()</c-> <c- p>=></c-> ts<c- p>.</c->writable<c- p>.</c->close<c- p>(),</c-> reason <c- p>=></c-> ts<c- p>.</c->writable<c- p>.</c->abort<c- p>(</c->reason<c- p>))</c-> <c- p>.</c-><c- k>catch</c-><c- p>(()</c-> <c- p>=></c-> <c- p>{});</c-> <c- k>return</c-> ts<c- p>.</c->readable<c- p>;</c-> <c- p>}</c-> </pre> <p>The error handling here is subtle because canceling the concatenated stream has to cancel all the input streams. However, the success case is simple enough. We just pipe each stream in the <code>readables</code> iterable one at a time to the <a data-link-type="dfn" href="#identity-transform-stream" id="ref-for-identity-transform-stream③">identity transform stream</a>'s <a data-link-type="dfn" href="#writable-side" id="ref-for-writable-side①⑤">writable side</a>, and then close it when we are done. The <a data-link-type="dfn" href="#readable-side" id="ref-for-readable-side①⑦">readable side</a> is then a concatenation of all the chunks from all of of the streams. We return it from the function. Backpressure is applied as usual.</p> <h2 class="no-num heading settled" id="acks"><span class="content">Acknowledgments</span><a class="self-link" href="#acks"></a></h2> <p>The editors would like to thank Anne van Kesteren, AnthumChris, Arthur Langereis, Ben Kelly, Bert Belder, Brian di Palma, Calvin Metcalf, Dominic Tarr, Ed Hager, Eric Skoglund, Forbes Lindesay, Forrest Norvell, Gary Blackwood, Gorgi Kosev, Gus Caplan, 贺师俊 (hax), Isaac Schlueter, isonmad, Jake Archibald, Jake Verbaten, James Pryor, Janessa Det, Jason Orendorff, Jeffrey Yasskin, Jeremy Roman, Jens Nockert, Lennart Grahl, Luca Casonato, Mangala Sadhu Sangeet Singh Khalsa, Marcos Caceres, Marvin Hagemeister, Mattias Buelens, Michael Mior, Mihai Potra, Nidhi Jaju, Romain Bellessort, Simon Menke, Stephen Sugden, Surma, Tab Atkins, Tanguy Krotoff, Thorsten Lorenz, Till Schneidereit, Tim Caswell, Trevor Norris, tzik, Will Chan, Youenn Fablet, 平野裕 (Yutaka Hirano), and Xabier Rodríguez for their contributions to this specification. Community involvement in this specification has been above and beyond; we couldn’t have done it without you.</p> <p>This standard is written by Adam Rice (<a href="https://google.com">Google</a>, <a href="mailto:ricea@chromium.org">ricea@chromium.org</a>), <a href="https://domenic.me/">Domenic Denicola</a> (<a href="https://google.com">Google</a>, <a href="mailto:d@domenic.me">d@domenic.me</a>), Mattias Buelens, and 吉野剛史 (Takeshi Yoshino, <a href="mailto:tyoshino@chromium.org">tyoshino@chromium.org</a>).</p> <h2 class="no-num heading settled" id="ipr"><span class="content">Intellectual property rights</span><a class="self-link" href="#ipr"></a></h2> <p>Copyright © WHATWG (Apple, Google, Mozilla, Microsoft). This work is licensed under a <a href="https://creativecommons.org/licenses/by/4.0/" rel="license">Creative Commons Attribution 4.0 International License</a>. To the extent portions of it are incorporated into source code, such portions in the source code are licensed under the <a href="https://opensource.org/licenses/BSD-3-Clause" rel="license">BSD 3-Clause License</a> instead.</p> <p>This is the Living Standard. Those interested in the patent-review version should view the <a href="/review-drafts/2024-08/">Living Standard Review Draft</a>.</p> </main> <script> "use strict"; if ("serviceWorker" in navigator) { navigator.serviceWorker.register("/service-worker.js"); } </script> <h2 class="no-num no-ref heading settled" id="index"><span class="content">Index</span><a class="self-link" href="#index"></a></h2> <h3 class="no-num no-ref heading settled" id="index-defined-here"><span class="content">Terms defined by this specification</span><a class="self-link" href="#index-defined-here"></a></h3> <ul class="index"> <li> abort <ul> <li><a href="#writablestream-abort">dfn for WritableStream</a><span>, in § 9.2.2</span> <li><a href="#dom-underlyingsink-abort">dict-member for UnderlyingSink</a><span>, in § 5.2.3</span> </ul> <li> abort() <ul> <li><a href="#ws-abort">method for WritableStream</a><span>, in § 5.2.4</span> <li><a href="#default-writer-abort">method for WritableStreamDefaultWriter</a><span>, in § 5.3.3</span> </ul> <li><a href="#writablestreamdefaultcontroller-abortalgorithm">[[abortAlgorithm]]</a><span>, in § 5.4.2</span> <li><a href="#writablestream-set-up-abortalgorithm">abortAlgorithm</a><span>, in § 9.2.1</span> <li><a href="#abort-a-writable-stream">abort a writable stream</a><span>, in § 2.2</span> <li><a href="#writablestreamdefaultcontroller-abortcontroller">[[abortController]]</a><span>, in § 5.4.2</span> <li><a href="#writablestream-abort">aborting</a><span>, in § 9.2.2</span> <li> abort(reason) <ul> <li><a href="#ws-abort">method for WritableStream</a><span>, in § 5.2.4</span> <li><a href="#default-writer-abort">method for WritableStreamDefaultWriter</a><span>, in § 5.3.3</span> </ul> <li> [[AbortSteps]] <ul> <li><a href="#abstract-opdef-writablestreamcontroller-abortsteps">abstract-op for WritableStreamController</a><span>, in § 5.5.2</span> <li><a href="#ws-default-controller-private-abort">abstract-op for WritableStreamDefaultController</a><span>, in § 5.4.4</span> </ul> <li><a href="#acquire-readable-stream-byob-reader">AcquireReadableStreamBYOBReader</a><span>, in § 4.9.1</span> <li><a href="#acquire-readable-stream-reader">AcquireReadableStreamDefaultReader</a><span>, in § 4.9.1</span> <li><a href="#acquire-writable-stream-default-writer">AcquireWritableStreamDefaultWriter</a><span>, in § 5.5.1</span> <li><a href="#active">active</a><span>, in § 2.6</span> <li><a href="#active">active reader</a><span>, in § 2.6</span> <li><a href="#active">active writer</a><span>, in § 2.6</span> <li><a href="#readablebytestreamcontroller-autoallocatechunksize">[[autoAllocateChunkSize]]</a><span>, in § 4.7.2</span> <li><a href="#dom-underlyingsource-autoallocatechunksize">autoAllocateChunkSize</a><span>, in § 4.2.3</span> <li> [[backpressure]] <ul> <li><a href="#transformstream-backpressure">dfn for TransformStream</a><span>, in § 6.2.2</span> <li><a href="#writablestream-backpressure">dfn for WritableStream</a><span>, in § 5.2.2</span> </ul> <li><a href="#backpressure">backpressure</a><span>, in § 2.4</span> <li><a href="#transformstream-backpressurechangepromise">[[backpressureChangePromise]]</a><span>, in § 6.2.2</span> <li><a href="#branches-of-a-readable-stream-tee">branches of a readable stream tee</a><span>, in § 2.1</span> <li> buffer <ul> <li><a href="#pull-into-descriptor-buffer">dfn for pull-into descriptor</a><span>, in § 4.7.2</span> <li><a href="#readable-byte-stream-queue-entry-buffer">dfn for readable byte stream queue entry</a><span>, in § 4.7.2</span> </ul> <li><a href="#pull-into-descriptor-buffer-byte-length">buffer byte length</a><span>, in § 4.7.2</span> <li><a href="#dom-readablestreamreadermode-byob">"byob"</a><span>, in § 4.2.1</span> <li><a href="#byob-reader">BYOB reader</a><span>, in § 2.6</span> <li><a href="#readablebytestreamcontroller-byobrequest">[[byobRequest]]</a><span>, in § 4.7.2</span> <li><a href="#rbs-controller-byob-request">byobRequest</a><span>, in § 4.7.3</span> <li> byte length <ul> <li><a href="#pull-into-descriptor-byte-length">dfn for pull-into descriptor</a><span>, in § 4.7.2</span> <li><a href="#readable-byte-stream-queue-entry-byte-length">dfn for readable byte stream queue entry</a><span>, in § 4.7.2</span> </ul> <li><a href="#bytelengthqueuingstrategy">ByteLengthQueuingStrategy</a><span>, in § 7.2.1</span> <li><a href="#blqs-constructor">ByteLengthQueuingStrategy(init)</a><span>, in § 7.2.3</span> <li><a href="#byte-length-queuing-strategy-size-function">byte length queuing strategy size function</a><span>, in § 7.2.2</span> <li> byte offset <ul> <li><a href="#pull-into-descriptor-byte-offset">dfn for pull-into descriptor</a><span>, in § 4.7.2</span> <li><a href="#readable-byte-stream-queue-entry-byte-offset">dfn for readable byte stream queue entry</a><span>, in § 4.7.2</span> </ul> <li><a href="#dom-readablestreamtype-bytes">"bytes"</a><span>, in § 4.2.3</span> <li><a href="#dom-readablestreamtype-bytes">bytes</a><span>, in § 4.2.3</span> <li><a href="#pull-into-descriptor-bytes-filled">bytes filled</a><span>, in § 4.7.2</span> <li> cancel <ul> <li><a href="#readablestream-cancel">dfn for ReadableStream</a><span>, in § 9.1.2</span> <li><a href="#readablestreamdefaultreader-cancel">dfn for ReadableStreamDefaultReader</a><span>, in § 9.1.2</span> <li><a href="#dom-transformer-cancel">dict-member for Transformer</a><span>, in § 6.2.3</span> <li><a href="#dom-underlyingsource-cancel">dict-member for UnderlyingSource</a><span>, in § 4.2.3</span> </ul> <li> cancel() <ul> <li><a href="#rs-cancel">method for ReadableStream</a><span>, in § 4.2.4</span> <li><a href="#generic-reader-cancel">method for ReadableStreamGenericReader</a><span>, in § 4.3.3</span> </ul> <li> [[cancelAlgorithm]] <ul> <li><a href="#readablebytestreamcontroller-cancelalgorithm">dfn for ReadableByteStreamController</a><span>, in § 4.7.2</span> <li><a href="#readablestreamdefaultcontroller-cancelalgorithm">dfn for ReadableStreamDefaultController</a><span>, in § 4.6.2</span> <li><a href="#transformstreamdefaultcontroller-cancelalgorithm">dfn for TransformStreamDefaultController</a><span>, in § 6.3.2</span> </ul> <li> cancelAlgorithm <ul> <li><a href="#readablestream-set-up-cancelalgorithm">dfn for ReadableStream/set up</a><span>, in § 9.1.1</span> <li><a href="#readablestream-set-up-with-byte-reading-support-cancelalgorithm">dfn for ReadableStream/set up with byte reading support</a><span>, in § 9.1.1</span> <li><a href="#transformstream-set-up-cancelalgorithm">dfn for TransformStream/set up</a><span>, in § 9.3.1</span> </ul> <li><a href="#cancel-a-readable-stream">cancel a readable stream</a><span>, in § 2.1</span> <li> cancel(reason) <ul> <li><a href="#rs-cancel">method for ReadableStream</a><span>, in § 4.2.4</span> <li><a href="#generic-reader-cancel">method for ReadableStreamGenericReader</a><span>, in § 4.3.3</span> </ul> <li> [[CancelSteps]] <ul> <li><a href="#rbs-controller-private-cancel">abstract-op for ReadableByteStreamController</a><span>, in § 4.7.4</span> <li><a href="#abstract-opdef-readablestreamcontroller-cancelsteps">abstract-op for ReadableStreamController</a><span>, in § 4.9.2</span> <li><a href="#rs-default-controller-private-cancel">abstract-op for ReadableStreamDefaultController</a><span>, in § 4.6.4</span> </ul> <li><a href="#abstract-opdef-cancopydatablockbytes">CanCopyDataBlockBytes</a><span>, in § 8.3</span> <li><a href="#can-transfer-array-buffer">CanTransferArrayBuffer</a><span>, in § 8.3</span> <li><a href="#chunk">chunk</a><span>, in § 2</span> <li> chunk steps <ul> <li><a href="#read-request-chunk-steps">dfn for read request</a><span>, in § 4.4.2</span> <li><a href="#read-into-request-chunk-steps">dfn for read-into request</a><span>, in § 4.5.2</span> </ul> <li><a href="#abstract-opdef-cloneasuint8array">CloneAsUint8Array</a><span>, in § 8.3</span> <li> close <ul> <li><a href="#readablestream-close">dfn for ReadableStream</a><span>, in § 9.1.1</span> <li><a href="#writablestream-close">dfn for WritableStream</a><span>, in § 9.2.2</span> <li><a href="#dom-underlyingsink-close">dict-member for UnderlyingSink</a><span>, in § 5.2.3</span> </ul> <li> close() <ul> <li><a href="#rbs-controller-close">method for ReadableByteStreamController</a><span>, in § 4.7.3</span> <li><a href="#rs-default-controller-close">method for ReadableStreamDefaultController</a><span>, in § 4.6.3</span> <li><a href="#ws-close">method for WritableStream</a><span>, in § 5.2.4</span> <li><a href="#default-writer-close">method for WritableStreamDefaultWriter</a><span>, in § 5.3.3</span> </ul> <li><a href="#writablestreamdefaultcontroller-closealgorithm">[[closeAlgorithm]]</a><span>, in § 5.4.2</span> <li><a href="#writablestream-set-up-closealgorithm">closeAlgorithm</a><span>, in § 9.2.1</span> <li> closed <ul> <li><a href="#generic-reader-closed">attribute for ReadableStreamGenericReader</a><span>, in § 4.3.3</span> <li><a href="#default-writer-closed">attribute for WritableStreamDefaultWriter</a><span>, in § 5.3.3</span> <li><a href="#readablestream-closed">dfn for ReadableStream</a><span>, in § 9.1.3</span> </ul> <li> [[closedPromise]] <ul> <li><a href="#readablestreamgenericreader-closedpromise">dfn for ReadableStreamGenericReader</a><span>, in § 4.3.2</span> <li><a href="#writablestreamdefaultwriter-closedpromise">dfn for WritableStreamDefaultWriter</a><span>, in § 5.3.2</span> </ul> <li><a href="#writablestream-closerequest">[[closeRequest]]</a><span>, in § 5.2.2</span> <li> [[closeRequested]] <ul> <li><a href="#readablebytestreamcontroller-closerequested">dfn for ReadableByteStreamController</a><span>, in § 4.7.2</span> <li><a href="#readablestreamdefaultcontroller-closerequested">dfn for ReadableStreamDefaultController</a><span>, in § 4.6.2</span> </ul> <li><a href="#close-sentinel">close sentinel</a><span>, in § 5.4.2</span> <li> close steps <ul> <li><a href="#read-request-close-steps">dfn for read request</a><span>, in § 4.4.2</span> <li><a href="#read-into-request-close-steps">dfn for read-into request</a><span>, in § 4.5.2</span> </ul> <li><a href="#writablestream-close">closing</a><span>, in § 9.2.2</span> <li> constructor() <ul> <li><a href="#rs-constructor">constructor for ReadableStream</a><span>, in § 4.2.4</span> <li><a href="#ts-constructor">constructor for TransformStream</a><span>, in § 6.2.4</span> <li><a href="#ws-constructor">constructor for WritableStream</a><span>, in § 5.2.4</span> </ul> <li> constructor(init) <ul> <li><a href="#blqs-constructor">constructor for ByteLengthQueuingStrategy</a><span>, in § 7.2.3</span> <li><a href="#cqs-constructor">constructor for CountQueuingStrategy</a><span>, in § 7.3.3</span> </ul> <li> constructor(stream) <ul> <li><a href="#byob-reader-constructor">constructor for ReadableStreamBYOBReader</a><span>, in § 4.5.3</span> <li><a href="#default-reader-constructor">constructor for ReadableStreamDefaultReader</a><span>, in § 4.4.3</span> <li><a href="#default-writer-constructor">constructor for WritableStreamDefaultWriter</a><span>, in § 5.3.3</span> </ul> <li><a href="#ts-constructor">constructor(transformer)</a><span>, in § 6.2.4</span> <li><a href="#ts-constructor">constructor(transformer, writableStrategy)</a><span>, in § 6.2.4</span> <li><a href="#ts-constructor">constructor(transformer, writableStrategy, readableStrategy)</a><span>, in § 6.2.4</span> <li><a href="#ws-constructor">constructor(underlyingSink)</a><span>, in § 5.2.4</span> <li><a href="#ws-constructor">constructor(underlyingSink, strategy)</a><span>, in § 5.2.4</span> <li><a href="#rs-constructor">constructor(underlyingSource)</a><span>, in § 4.2.4</span> <li><a href="#rs-constructor">constructor(underlyingSource, strategy)</a><span>, in § 4.2.4</span> <li><a href="#consumer">consumer</a><span>, in § 2.1</span> <li> [[controller]] <ul> <li><a href="#readablestream-controller">dfn for ReadableStream</a><span>, in § 4.2.2</span> <li><a href="#readablestreambyobrequest-controller">dfn for ReadableStreamBYOBRequest</a><span>, in § 4.8.2</span> <li><a href="#transformstream-controller">dfn for TransformStream</a><span>, in § 6.2.2</span> <li><a href="#writablestream-controller">dfn for WritableStream</a><span>, in § 5.2.2</span> </ul> <li><a href="#countqueuingstrategy">CountQueuingStrategy</a><span>, in § 7.3.1</span> <li><a href="#cqs-constructor">CountQueuingStrategy(init)</a><span>, in § 7.3.3</span> <li><a href="#count-queuing-strategy-size-function">count queuing strategy size function</a><span>, in § 7.3.2</span> <li><a href="#create-an-identity-transformstream">create an identity TransformStream</a><span>, in § 9.3.1</span> <li><a href="#readablestream-create-a-proxy">create a proxy</a><span>, in § 9.5</span> <li><a href="#abstract-opdef-createreadablebytestream">CreateReadableByteStream</a><span>, in § 4.9.1</span> <li><a href="#create-readable-stream">CreateReadableStream</a><span>, in § 4.9.1</span> <li><a href="#create-writable-stream">CreateWritableStream</a><span>, in § 5.5.1</span> <li><a href="#create-an-identity-transformstream">creating an identity TransformStream</a><span>, in § 9.3.1</span> <li><a href="#readablestream-create-a-proxy">creating a proxy</a><span>, in § 9.5</span> <li><a href="#abstract-opdef-crossrealmtransformsenderror">CrossRealmTransformSendError</a><span>, in § 8.2</span> <li><a href="#readablestream-current-byob-request-view">current BYOB request view</a><span>, in § 9.1.1</span> <li><a href="#default-reader">default reader</a><span>, in § 2.6</span> <li><a href="#dequeue-value">DequeueValue</a><span>, in § 8.1</span> <li> desiredSize <ul> <li><a href="#rbs-controller-desired-size">attribute for ReadableByteStreamController</a><span>, in § 4.7.3</span> <li><a href="#rs-default-controller-desired-size">attribute for ReadableStreamDefaultController</a><span>, in § 4.6.3</span> <li><a href="#ts-default-controller-desired-size">attribute for TransformStreamDefaultController</a><span>, in § 6.3.3</span> <li><a href="#default-writer-desired-size">attribute for WritableStreamDefaultWriter</a><span>, in § 5.3.3</span> </ul> <li><a href="#desired-size-to-fill-a-streams-internal-queue">desired size to fill a stream's internal queue</a><span>, in § 2.5</span> <li><a href="#readablestream-desired-size-to-fill-up-to-the-high-water-mark">desired size to fill up to the high water mark</a><span>, in § 9.1.1</span> <li> [[Detached]] <ul> <li><a href="#readablestream-detached">dfn for ReadableStream</a><span>, in § 4.2.2</span> <li><a href="#transformstream-detached">dfn for TransformStream</a><span>, in § 6.2.2</span> <li><a href="#writablestream-detached">dfn for WritableStream</a><span>, in § 5.2.2</span> </ul> <li><a href="#readablestream-disturbed">[[disturbed]]</a><span>, in § 4.2.2</span> <li><a href="#is-readable-stream-disturbed">disturbed</a><span>, in § 9.1.3</span> <li><a href="#dom-readablestreamreadresult-done">done</a><span>, in § 4.4.1</span> <li><a href="#duplex-stream">duplex stream</a><span>, in § 9.4.1</span> <li><a href="#pull-into-descriptor-element-size">element size</a><span>, in § 4.7.2</span> <li><a href="#endpoint-pair">endpoint pair</a><span>, in § 9.4.2</span> <li> enqueue <ul> <li><a href="#readablestream-enqueue">dfn for ReadableStream</a><span>, in § 9.1.1</span> <li><a href="#transformstream-enqueue">dfn for TransformStream</a><span>, in § 9.3.1</span> </ul> <li> enqueue() <ul> <li><a href="#rs-default-controller-enqueue">method for ReadableStreamDefaultController</a><span>, in § 4.6.3</span> <li><a href="#ts-default-controller-enqueue">method for TransformStreamDefaultController</a><span>, in § 6.3.3</span> </ul> <li> enqueue(chunk) <ul> <li><a href="#rbs-controller-enqueue">method for ReadableByteStreamController</a><span>, in § 4.7.3</span> <li><a href="#rs-default-controller-enqueue">method for ReadableStreamDefaultController</a><span>, in § 4.6.3</span> <li><a href="#ts-default-controller-enqueue">method for TransformStreamDefaultController</a><span>, in § 6.3.3</span> </ul> <li><a href="#enqueue-value-with-size">EnqueueValueWithSize</a><span>, in § 8.1</span> <li> error <ul> <li><a href="#readablestream-error">dfn for ReadableStream</a><span>, in § 9.1.1</span> <li><a href="#transformstream-error">dfn for TransformStream</a><span>, in § 9.3.1</span> <li><a href="#writablestream-error">dfn for WritableStream</a><span>, in § 9.2.1</span> </ul> <li> error() <ul> <li><a href="#rbs-controller-error">method for ReadableByteStreamController</a><span>, in § 4.7.3</span> <li><a href="#rs-default-controller-error">method for ReadableStreamDefaultController</a><span>, in § 4.6.3</span> <li><a href="#ts-default-controller-error">method for TransformStreamDefaultController</a><span>, in § 6.3.3</span> <li><a href="#ws-default-controller-error">method for WritableStreamDefaultController</a><span>, in § 5.4.3</span> </ul> <li> error(e) <ul> <li><a href="#rbs-controller-error">method for ReadableByteStreamController</a><span>, in § 4.7.3</span> <li><a href="#rs-default-controller-error">method for ReadableStreamDefaultController</a><span>, in § 4.6.3</span> <li><a href="#ts-default-controller-error">method for TransformStreamDefaultController</a><span>, in § 6.3.3</span> <li><a href="#ws-default-controller-error">method for WritableStreamDefaultController</a><span>, in § 5.4.3</span> </ul> <li><a href="#readablestream-errored">errored</a><span>, in § 9.1.3</span> <li><a href="#writablestream-error">erroring</a><span>, in § 9.2.1</span> <li><a href="#ts-default-controller-error">error(reason)</a><span>, in § 6.3.3</span> <li> [[ErrorSteps]] <ul> <li><a href="#abstract-opdef-writablestreamcontroller-errorsteps">abstract-op for WritableStreamController</a><span>, in § 5.5.2</span> <li><a href="#ws-default-controller-private-error">abstract-op for WritableStreamDefaultController</a><span>, in § 5.4.4</span> </ul> <li> error steps <ul> <li><a href="#read-request-error-steps">dfn for read request</a><span>, in § 4.4.2</span> <li><a href="#read-into-request-error-steps">dfn for read-into request</a><span>, in § 4.5.2</span> </ul> <li><a href="#validate-and-normalize-high-water-mark">ExtractHighWaterMark</a><span>, in § 7.4</span> <li><a href="#make-size-algorithm-from-size-function">ExtractSizeAlgorithm</a><span>, in § 7.4</span> <li><a href="#rs-pipeTo-finalize">Finalize</a><span>, in § 4.9.1</span> <li><a href="#transformstreamdefaultcontroller-finishpromise">[[finishPromise]]</a><span>, in § 6.3.2</span> <li><a href="#dom-transformer-flush">flush</a><span>, in § 6.2.3</span> <li><a href="#transformstreamdefaultcontroller-flushalgorithm">[[flushAlgorithm]]</a><span>, in § 6.3.2</span> <li><a href="#transformstream-set-up-flushalgorithm">flushAlgorithm</a><span>, in § 9.3.1</span> <li><a href="#rs-from">from(asyncIterable)</a><span>, in § 4.2.4</span> <li><a href="#generictransformstream">GenericTransformStream</a><span>, in § 9.3.2</span> <li><a href="#readablestream-get-a-reader">get a reader</a><span>, in § 9.1.2</span> <li><a href="#writablestream-get-a-writer">get a writer</a><span>, in § 9.2.2</span> <li><a href="#rs-get-reader">getReader()</a><span>, in § 4.2.4</span> <li><a href="#rs-get-reader">getReader(options)</a><span>, in § 4.2.4</span> <li><a href="#readablestream-get-a-reader">getting a reader</a><span>, in § 9.1.2</span> <li><a href="#writablestream-get-a-writer">getting a writer</a><span>, in § 9.2.2</span> <li><a href="#ws-get-writer">getWriter()</a><span>, in § 5.2.4</span> <li> [[highWaterMark]] <ul> <li><a href="#bytelengthqueuingstrategy-highwatermark">dfn for ByteLengthQueuingStrategy</a><span>, in § 7.2.2</span> <li><a href="#countqueuingstrategy-highwatermark">dfn for CountQueuingStrategy</a><span>, in § 7.3.2</span> </ul> <li><a href="#high-water-mark">high water mark</a><span>, in § 2.5</span> <li> highWaterMark <ul> <li><a href="#blqs-high-water-mark">attribute for ByteLengthQueuingStrategy</a><span>, in § 7.2.3</span> <li><a href="#cqs-high-water-mark">attribute for CountQueuingStrategy</a><span>, in § 7.3.3</span> <li><a href="#readablestream-set-up-highwatermark">dfn for ReadableStream/set up</a><span>, in § 9.1.1</span> <li><a href="#readablestream-set-up-with-byte-reading-support-highwatermark">dfn for ReadableStream/set up with byte reading support</a><span>, in § 9.1.1</span> <li><a href="#writablestream-set-up-highwatermark">dfn for WritableStream/set up</a><span>, in § 9.2.1</span> <li><a href="#dom-queuingstrategy-highwatermark">dict-member for QueuingStrategy</a><span>, in § 7.1</span> <li><a href="#dom-queuingstrategyinit-highwatermark">dict-member for QueuingStrategyInit</a><span>, in § 7.1</span> </ul> <li><a href="#identity-transform-stream">identity transform stream</a><span>, in § 2.3</span> <li><a href="#writablestream-inflightcloserequest">[[inFlightCloseRequest]]</a><span>, in § 5.2.2</span> <li><a href="#writablestream-inflightwriterequest">[[inFlightWriteRequest]]</a><span>, in § 5.2.2</span> <li><a href="#initialize-readable-stream">InitializeReadableStream</a><span>, in § 4.9.1</span> <li><a href="#initialize-transform-stream">InitializeTransformStream</a><span>, in § 6.4.1</span> <li><a href="#initialize-writable-stream">InitializeWritableStream</a><span>, in § 5.5.1</span> <li><a href="#internal-queues">internal queues</a><span>, in § 2.5</span> <li><a href="#is-non-negative-number">IsNonNegativeNumber</a><span>, in § 8.3</span> <li><a href="#is-readable-stream-locked">IsReadableStreamLocked</a><span>, in § 4.9.1</span> <li><a href="#is-writable-stream-locked">IsWritableStreamLocked</a><span>, in § 5.5.1</span> <li><a href="#lock">lock</a><span>, in § 2.6</span> <li> locked <ul> <li><a href="#rs-locked">attribute for ReadableStream</a><span>, in § 4.2.4</span> <li><a href="#ws-locked">attribute for WritableStream</a><span>, in § 5.2.4</span> <li><a href="#readablestream-locked">dfn for ReadableStream</a><span>, in § 9.1.3</span> </ul> <li><a href="#lock">locked to a reader</a><span>, in § 2.6</span> <li><a href="#lock">locked to a writer</a><span>, in § 2.6</span> <li><a href="#dom-readablestreambyobreaderreadoptions-min">min</a><span>, in § 4.5.1</span> <li><a href="#pull-into-descriptor-minimum-fill">minimum fill</a><span>, in § 4.7.2</span> <li><a href="#dom-readablestreamgetreaderoptions-mode">mode</a><span>, in § 4.2.1</span> <li><a href="#readablestream-need-more-data">need more data</a><span>, in § 9.1.1</span> <li><a href="#readablestream-need-more-data">needs more data</a><span>, in § 9.1.1</span> <li><a href="#original-source">original source</a><span>, in § 2.4</span> <li><a href="#abstract-opdef-packandpostmessage">PackAndPostMessage</a><span>, in § 8.2</span> <li><a href="#abstract-opdef-packandpostmessagehandlingerror">PackAndPostMessageHandlingError</a><span>, in § 8.2</span> <li><a href="#peek-queue-value">PeekQueueValue</a><span>, in § 8.1</span> <li><a href="#writablestream-pendingabortrequest">[[pendingAbortRequest]]</a><span>, in § 5.2.2</span> <li><a href="#pending-abort-request">pending abort request</a><span>, in § 5.2.2</span> <li><a href="#readablebytestreamcontroller-pendingpullintos">[[pendingPullIntos]]</a><span>, in § 4.7.2</span> <li><a href="#readablestream-pipe">pipe</a><span>, in § 9.5</span> <li><a href="#pipe-chain">pipe chain</a><span>, in § 2.4</span> <li><a href="#readablestream-pipe-through">piped through</a><span>, in § 9.5</span> <li><a href="#readablestream-pipe">piped to</a><span>, in § 9.5</span> <li><a href="#readablestream-pipe-through">pipe through</a><span>, in § 9.5</span> <li><a href="#rs-pipe-through">pipeThrough(transform)</a><span>, in § 4.2.4</span> <li><a href="#rs-pipe-through">pipeThrough(transform, options)</a><span>, in § 4.2.4</span> <li><a href="#readablestream-pipe">pipe to</a><span>, in § 9.5</span> <li><a href="#rs-pipe-to">pipeTo(destination)</a><span>, in § 4.2.4</span> <li><a href="#rs-pipe-to">pipeTo(destination, options)</a><span>, in § 4.2.4</span> <li><a href="#piping">piping</a><span>, in § 2.4</span> <li><a href="#readablestream-pipe-through">piping through</a><span>, in § 9.5</span> <li><a href="#readablestream-pipe">piping to</a><span>, in § 9.5</span> <li> preventAbort <ul> <li><a href="#readablestream-pipe-through-preventabort">dfn for ReadableStream/pipe through, ReadableStream/piped through</a><span>, in § 9.5</span> <li><a href="#readablestream-pipe-to-preventabort">dfn for ReadableStream/pipe to, ReadableStream/piped to</a><span>, in § 9.5</span> <li><a href="#dom-streampipeoptions-preventabort">dict-member for StreamPipeOptions</a><span>, in § 4.2.1</span> </ul> <li><a href="#readablestream-async-iterator-prevent-cancel">prevent cancel</a><span>, in § 4.2.5</span> <li> preventCancel <ul> <li><a href="#readablestream-pipe-through-preventcancel">dfn for ReadableStream/pipe through, ReadableStream/piped through</a><span>, in § 9.5</span> <li><a href="#readablestream-pipe-to-preventcancel">dfn for ReadableStream/pipe to, ReadableStream/piped to</a><span>, in § 9.5</span> <li><a href="#dom-readablestreamiteratoroptions-preventcancel">dict-member for ReadableStreamIteratorOptions</a><span>, in § 4.2.1</span> <li><a href="#dom-streampipeoptions-preventcancel">dict-member for StreamPipeOptions</a><span>, in § 4.2.1</span> </ul> <li> preventClose <ul> <li><a href="#readablestream-pipe-through-preventclose">dfn for ReadableStream/pipe through, ReadableStream/piped through</a><span>, in § 9.5</span> <li><a href="#readablestream-pipe-to-preventclose">dfn for ReadableStream/pipe to, ReadableStream/piped to</a><span>, in § 9.5</span> <li><a href="#dom-streampipeoptions-preventclose">dict-member for StreamPipeOptions</a><span>, in § 4.2.1</span> </ul> <li><a href="#producer">producer</a><span>, in § 2.2</span> <li><a href="#pending-abort-request-promise">promise</a><span>, in § 5.2.2</span> <li><a href="#dom-underlyingsource-pull">pull</a><span>, in § 4.2.3</span> <li> [[pullAgain]] <ul> <li><a href="#readablebytestreamcontroller-pullagain">dfn for ReadableByteStreamController</a><span>, in § 4.7.2</span> <li><a href="#readablestreamdefaultcontroller-pullagain">dfn for ReadableStreamDefaultController</a><span>, in § 4.6.2</span> </ul> <li> [[pullAlgorithm]] <ul> <li><a href="#readablebytestreamcontroller-pullalgorithm">dfn for ReadableByteStreamController</a><span>, in § 4.7.2</span> <li><a href="#readablestreamdefaultcontroller-pullalgorithm">dfn for ReadableStreamDefaultController</a><span>, in § 4.6.2</span> </ul> <li> pullAlgorithm <ul> <li><a href="#readablestream-set-up-pullalgorithm">dfn for ReadableStream/set up</a><span>, in § 9.1.1</span> <li><a href="#readablestream-set-up-with-byte-reading-support-pullalgorithm">dfn for ReadableStream/set up with byte reading support</a><span>, in § 9.1.1</span> </ul> <li><a href="#readablestream-pull-from-bytes">pull from bytes</a><span>, in § 9.1.1</span> <li> [[pulling]] <ul> <li><a href="#readablebytestreamcontroller-pulling">dfn for ReadableByteStreamController</a><span>, in § 4.7.2</span> <li><a href="#readablestreamdefaultcontroller-pulling">dfn for ReadableStreamDefaultController</a><span>, in § 4.6.2</span> </ul> <li><a href="#pull-into-descriptor">pull-into descriptor</a><span>, in § 4.7.2</span> <li><a href="#pull-source">pull source</a><span>, in § 2.1</span> <li> [[PullSteps]] <ul> <li><a href="#rbs-controller-private-pull">abstract-op for ReadableByteStreamController</a><span>, in § 4.7.4</span> <li><a href="#abstract-opdef-readablestreamcontroller-pullsteps">abstract-op for ReadableStreamController</a><span>, in § 4.9.2</span> <li><a href="#rs-default-controller-private-pull">abstract-op for ReadableStreamDefaultController</a><span>, in § 4.6.4</span> </ul> <li><a href="#push-source">push source</a><span>, in § 2.1</span> <li> [[queue]] <ul> <li><a href="#readablebytestreamcontroller-queue">dfn for ReadableByteStreamController</a><span>, in § 4.7.2</span> <li><a href="#readablestreamdefaultcontroller-queue">dfn for ReadableStreamDefaultController</a><span>, in § 4.6.2</span> <li><a href="#writablestreamdefaultcontroller-queue">dfn for WritableStreamDefaultController</a><span>, in § 5.4.2</span> </ul> <li> [[queueTotalSize]] <ul> <li><a href="#readablebytestreamcontroller-queuetotalsize">dfn for ReadableByteStreamController</a><span>, in § 4.7.2</span> <li><a href="#readablestreamdefaultcontroller-queuetotalsize">dfn for ReadableStreamDefaultController</a><span>, in § 4.6.2</span> <li><a href="#writablestreamdefaultcontroller-queuetotalsize">dfn for WritableStreamDefaultController</a><span>, in § 5.4.2</span> </ul> <li><a href="#queuing-strategy">queuing strategy</a><span>, in § 2.5</span> <li><a href="#dictdef-queuingstrategy">QueuingStrategy</a><span>, in § 7.1</span> <li><a href="#dictdef-queuingstrategyinit">QueuingStrategyInit</a><span>, in § 7.1</span> <li><a href="#callbackdef-queuingstrategysize">QueuingStrategySize</a><span>, in § 7.1</span> <li><a href="#default-reader-read">read()</a><span>, in § 4.4.3</span> <li><a href="#transformstream-readable">[[readable]]</a><span>, in § 6.2.2</span> <li> readable <ul> <li><a href="#dom-generictransformstream-readable">attribute for GenericTransformStream</a><span>, in § 9.3.2</span> <li><a href="#ts-readable">attribute for TransformStream</a><span>, in § 6.2.4</span> <li><a href="#readablestream-readable">dfn for ReadableStream</a><span>, in § 9.1.3</span> <li><a href="#dom-readablewritablepair-readable">dict-member for ReadableWritablePair</a><span>, in § 4.2.1</span> </ul> <li><a href="#readable-byte-stream">readable byte stream</a><span>, in § 2.1</span> <li><a href="#readablebytestreamcontroller">ReadableByteStreamController</a><span>, in § 4.7.1</span> <li><a href="#readable-byte-stream-controller-call-pull-if-needed">ReadableByteStreamControllerCallPullIfNeeded</a><span>, in § 4.9.5</span> <li><a href="#readable-byte-stream-controller-clear-algorithms">ReadableByteStreamControllerClearAlgorithms</a><span>, in § 4.9.5</span> <li><a href="#readable-byte-stream-controller-clear-pending-pull-intos">ReadableByteStreamControllerClearPendingPullIntos</a><span>, in § 4.9.5</span> <li><a href="#readable-byte-stream-controller-close">ReadableByteStreamControllerClose</a><span>, in § 4.9.5</span> <li><a href="#readable-byte-stream-controller-commit-pull-into-descriptor">ReadableByteStreamControllerCommitPullIntoDescriptor</a><span>, in § 4.9.5</span> <li><a href="#readable-byte-stream-controller-convert-pull-into-descriptor">ReadableByteStreamControllerConvertPullIntoDescriptor</a><span>, in § 4.9.5</span> <li><a href="#readable-byte-stream-controller-enqueue">ReadableByteStreamControllerEnqueue</a><span>, in § 4.9.5</span> <li><a href="#readable-byte-stream-controller-enqueue-chunk-to-queue">ReadableByteStreamControllerEnqueueChunkToQueue</a><span>, in § 4.9.5</span> <li><a href="#abstract-opdef-readablebytestreamcontrollerenqueueclonedchunktoqueue">ReadableByteStreamControllerEnqueueClonedChunkToQueue</a><span>, in § 4.9.5</span> <li><a href="#abstract-opdef-readablebytestreamcontrollerenqueuedetachedpullintotoqueue">ReadableByteStreamControllerEnqueueDetachedPullIntoToQueue</a><span>, in § 4.9.5</span> <li><a href="#readable-byte-stream-controller-error">ReadableByteStreamControllerError</a><span>, in § 4.9.5</span> <li><a href="#readable-byte-stream-controller-fill-head-pull-into-descriptor">ReadableByteStreamControllerFillHeadPullIntoDescriptor</a><span>, in § 4.9.5</span> <li><a href="#readable-byte-stream-controller-fill-pull-into-descriptor-from-queue">ReadableByteStreamControllerFillPullIntoDescriptorFromQueue</a><span>, in § 4.9.5</span> <li><a href="#abstract-opdef-readablebytestreamcontrollerfillreadrequestfromqueue">ReadableByteStreamControllerFillReadRequestFromQueue</a><span>, in § 4.9.5</span> <li><a href="#abstract-opdef-readablebytestreamcontrollergetbyobrequest">ReadableByteStreamControllerGetBYOBRequest</a><span>, in § 4.9.5</span> <li><a href="#readable-byte-stream-controller-get-desired-size">ReadableByteStreamControllerGetDesiredSize</a><span>, in § 4.9.5</span> <li><a href="#readable-byte-stream-controller-handle-queue-drain">ReadableByteStreamControllerHandleQueueDrain</a><span>, in § 4.9.5</span> <li><a href="#readable-byte-stream-controller-invalidate-byob-request">ReadableByteStreamControllerInvalidateBYOBRequest</a><span>, in § 4.9.5</span> <li><a href="#readable-byte-stream-controller-process-pull-into-descriptors-using-queue">ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue</a><span>, in § 4.9.5</span> <li><a href="#abstract-opdef-readablebytestreamcontrollerprocessreadrequestsusingqueue">ReadableByteStreamControllerProcessReadRequestsUsingQueue</a><span>, in § 4.9.5</span> <li><a href="#readable-byte-stream-controller-pull-into">ReadableByteStreamControllerPullInto</a><span>, in § 4.9.5</span> <li><a href="#readable-byte-stream-controller-respond">ReadableByteStreamControllerRespond</a><span>, in § 4.9.5</span> <li><a href="#readable-byte-stream-controller-respond-in-closed-state">ReadableByteStreamControllerRespondInClosedState</a><span>, in § 4.9.5</span> <li><a href="#readable-byte-stream-controller-respond-in-readable-state">ReadableByteStreamControllerRespondInReadableState</a><span>, in § 4.9.5</span> <li><a href="#readable-byte-stream-controller-respond-internal">ReadableByteStreamControllerRespondInternal</a><span>, in § 4.9.5</span> <li><a href="#readable-byte-stream-controller-respond-with-new-view">ReadableByteStreamControllerRespondWithNewView</a><span>, in § 4.9.5</span> <li><a href="#readable-byte-stream-controller-shift-pending-pull-into">ReadableByteStreamControllerShiftPendingPullInto</a><span>, in § 4.9.5</span> <li><a href="#readable-byte-stream-controller-should-call-pull">ReadableByteStreamControllerShouldCallPull</a><span>, in § 4.9.5</span> <li><a href="#readable-byte-stream-queue-entry">readable byte stream queue entry</a><span>, in § 4.7.2</span> <li><a href="#abstract-opdef-readablebytestreamtee">ReadableByteStreamTee</a><span>, in § 4.9.1</span> <li><a href="#readable-side">readable side</a><span>, in § 2.3</span> <li><a href="#readable-stream">readable stream</a><span>, in § 2.1</span> <li><a href="#readablestream">ReadableStream</a><span>, in § 4.2.1</span> <li><a href="#rs-constructor">ReadableStream()</a><span>, in § 4.2.4</span> <li><a href="#readable-stream-add-read-into-request">ReadableStreamAddReadIntoRequest</a><span>, in § 4.9.2</span> <li><a href="#readable-stream-add-read-request">ReadableStreamAddReadRequest</a><span>, in § 4.9.2</span> <li><a href="#readablestreambyobreader">ReadableStreamBYOBReader</a><span>, in § 4.5.1</span> <li><a href="#abstract-opdef-readablestreambyobreadererrorreadintorequests">ReadableStreamBYOBReaderErrorReadIntoRequests</a><span>, in § 4.9.3</span> <li><a href="#readable-stream-byob-reader-read">ReadableStreamBYOBReaderRead</a><span>, in § 4.9.3</span> <li><a href="#dictdef-readablestreambyobreaderreadoptions">ReadableStreamBYOBReaderReadOptions</a><span>, in § 4.5.1</span> <li><a href="#abstract-opdef-readablestreambyobreaderrelease">ReadableStreamBYOBReaderRelease</a><span>, in § 4.9.3</span> <li><a href="#byob-reader-constructor">ReadableStreamBYOBReader(stream)</a><span>, in § 4.5.3</span> <li><a href="#readablestreambyobrequest">ReadableStreamBYOBRequest</a><span>, in § 4.8.1</span> <li><a href="#readable-stream-cancel">ReadableStreamCancel</a><span>, in § 4.9.2</span> <li><a href="#readable-stream-close">ReadableStreamClose</a><span>, in § 4.9.2</span> <li><a href="#typedefdef-readablestreamcontroller">ReadableStreamController</a><span>, in § 4.2.3</span> <li><a href="#readablestreamdefaultcontroller">ReadableStreamDefaultController</a><span>, in § 4.6.1</span> <li><a href="#readable-stream-default-controller-call-pull-if-needed">ReadableStreamDefaultControllerCallPullIfNeeded</a><span>, in § 4.9.4</span> <li><a href="#readable-stream-default-controller-can-close-or-enqueue">ReadableStreamDefaultControllerCanCloseOrEnqueue</a><span>, in § 4.9.4</span> <li><a href="#readable-stream-default-controller-clear-algorithms">ReadableStreamDefaultControllerClearAlgorithms</a><span>, in § 4.9.4</span> <li><a href="#readable-stream-default-controller-close">ReadableStreamDefaultControllerClose</a><span>, in § 4.9.4</span> <li><a href="#readable-stream-default-controller-enqueue">ReadableStreamDefaultControllerEnqueue</a><span>, in § 4.9.4</span> <li><a href="#readable-stream-default-controller-error">ReadableStreamDefaultControllerError</a><span>, in § 4.9.4</span> <li><a href="#readable-stream-default-controller-get-desired-size">ReadableStreamDefaultControllerGetDesiredSize</a><span>, in § 4.9.4</span> <li><a href="#rs-default-controller-has-backpressure">ReadableStreamDefaultControllerHasBackpressure</a><span>, in § 4.9.4</span> <li><a href="#readable-stream-default-controller-should-call-pull">ReadableStreamDefaultControllerShouldCallPull</a><span>, in § 4.9.4</span> <li><a href="#readablestreamdefaultreader">ReadableStreamDefaultReader</a><span>, in § 4.4.1</span> <li><a href="#abstract-opdef-readablestreamdefaultreadererrorreadrequests">ReadableStreamDefaultReaderErrorReadRequests</a><span>, in § 4.9.3</span> <li><a href="#readable-stream-default-reader-read">ReadableStreamDefaultReaderRead</a><span>, in § 4.9.3</span> <li><a href="#abstract-opdef-readablestreamdefaultreaderrelease">ReadableStreamDefaultReaderRelease</a><span>, in § 4.9.3</span> <li><a href="#default-reader-constructor">ReadableStreamDefaultReader(stream)</a><span>, in § 4.4.3</span> <li><a href="#abstract-opdef-readablestreamdefaulttee">ReadableStreamDefaultTee</a><span>, in § 4.9.1</span> <li><a href="#readable-stream-error">ReadableStreamError</a><span>, in § 4.9.2</span> <li><a href="#readable-stream-from-iterable">ReadableStreamFromIterable</a><span>, in § 4.9.1</span> <li><a href="#readable-stream-fulfill-read-into-request">ReadableStreamFulfillReadIntoRequest</a><span>, in § 4.9.2</span> <li><a href="#readable-stream-fulfill-read-request">ReadableStreamFulfillReadRequest</a><span>, in § 4.9.2</span> <li><a href="#readablestreamgenericreader">ReadableStreamGenericReader</a><span>, in § 4.3.1</span> <li><a href="#readable-stream-get-num-read-into-requests">ReadableStreamGetNumReadIntoRequests</a><span>, in § 4.9.2</span> <li><a href="#readable-stream-get-num-read-requests">ReadableStreamGetNumReadRequests</a><span>, in § 4.9.2</span> <li><a href="#dictdef-readablestreamgetreaderoptions">ReadableStreamGetReaderOptions</a><span>, in § 4.2.1</span> <li><a href="#readable-stream-has-byob-reader">ReadableStreamHasBYOBReader</a><span>, in § 4.9.2</span> <li><a href="#readable-stream-has-default-reader">ReadableStreamHasDefaultReader</a><span>, in § 4.9.2</span> <li><a href="#dictdef-readablestreamiteratoroptions">ReadableStreamIteratorOptions</a><span>, in § 4.2.1</span> <li><a href="#readable-stream-pipe-to">ReadableStreamPipeTo</a><span>, in § 4.9.1</span> <li><a href="#reader">readable stream reader</a><span>, in § 2.6</span> <li><a href="#typedefdef-readablestreamreader">ReadableStreamReader</a><span>, in § 4.2.1</span> <li><a href="#readable-stream-reader-generic-cancel">ReadableStreamReaderGenericCancel</a><span>, in § 4.9.3</span> <li><a href="#readable-stream-reader-generic-initialize">ReadableStreamReaderGenericInitialize</a><span>, in § 4.9.3</span> <li><a href="#readable-stream-reader-generic-release">ReadableStreamReaderGenericRelease</a><span>, in § 4.9.3</span> <li><a href="#enumdef-readablestreamreadermode">ReadableStreamReaderMode</a><span>, in § 4.2.1</span> <li><a href="#dictdef-readablestreamreadresult">ReadableStreamReadResult</a><span>, in § 4.4.1</span> <li><a href="#readable-stream-tee">ReadableStreamTee</a><span>, in § 4.9.1</span> <li><a href="#enumdef-readablestreamtype">ReadableStreamType</a><span>, in § 4.2.3</span> <li><a href="#rs-constructor">ReadableStream(underlyingSource)</a><span>, in § 4.2.4</span> <li><a href="#rs-constructor">ReadableStream(underlyingSource, strategy)</a><span>, in § 4.2.4</span> <li><a href="#dom-transformer-readabletype">readableType</a><span>, in § 6.2.3</span> <li><a href="#dictdef-readablewritablepair">ReadableWritablePair</a><span>, in § 4.2.1</span> <li><a href="#readablestreamdefaultreader-read-a-chunk">read a chunk</a><span>, in § 9.1.2</span> <li><a href="#readablestreamdefaultreader-read-all-bytes">read all bytes</a><span>, in § 9.1.2</span> <li><a href="#readablestream-reader">[[reader]]</a><span>, in § 4.2.2</span> <li> reader <ul> <li><a href="#reader">definition of</a><span>, in § 2.6</span> <li><a href="#readablestream-async-iterator-reader">dfn for ReadableStream async iterator</a><span>, in § 4.2.5</span> </ul> <li><a href="#pull-into-descriptor-reader-type">reader type</a><span>, in § 4.7.2</span> <li><a href="#readablestreamdefaultreader-read-a-chunk">reading a chunk</a><span>, in § 9.1.2</span> <li><a href="#readablestreamdefaultreader-read-all-bytes">reading all bytes</a><span>, in § 9.1.2</span> <li><a href="#read-into-request">read-into request</a><span>, in § 4.5.2</span> <li><a href="#readablestreambyobreader-readintorequests">[[readIntoRequests]]</a><span>, in § 4.5.2</span> <li><a href="#read-loop">read-loop</a><span>, in § 9.1.2</span> <li><a href="#read-request">read request</a><span>, in § 4.4.2</span> <li><a href="#readablestreamdefaultreader-readrequests">[[readRequests]]</a><span>, in § 4.4.2</span> <li><a href="#byob-reader-read">read(view)</a><span>, in § 4.5.3</span> <li><a href="#byob-reader-read">read(view, options)</a><span>, in § 4.5.3</span> <li><a href="#default-writer-ready">ready</a><span>, in § 5.3.3</span> <li><a href="#writablestreamdefaultwriter-readypromise">[[readyPromise]]</a><span>, in § 5.3.2</span> <li><a href="#pending-abort-request-reason">reason</a><span>, in § 5.2.2</span> <li> release <ul> <li><a href="#readablestreamdefaultreader-release">dfn for ReadableStreamDefaultReader</a><span>, in § 9.1.2</span> <li><a href="#writablestreamdefaultwriter-release">dfn for WritableStreamDefaultWriter</a><span>, in § 9.2.2</span> </ul> <li><a href="#release-a-lock">release a lock</a><span>, in § 2.6</span> <li><a href="#release-a-lock">release a read lock</a><span>, in § 2.6</span> <li><a href="#release-a-lock">release a write lock</a><span>, in § 2.6</span> <li> releaseLock() <ul> <li><a href="#byob-reader-release-lock">method for ReadableStreamBYOBReader</a><span>, in § 4.5.3</span> <li><a href="#default-reader-release-lock">method for ReadableStreamDefaultReader</a><span>, in § 4.4.3</span> <li><a href="#default-writer-release-lock">method for WritableStreamDefaultWriter</a><span>, in § 5.3.3</span> </ul> <li> [[ReleaseSteps]] <ul> <li><a href="#abstract-opdef-readablebytestreamcontroller-releasesteps">abstract-op for ReadableByteStreamController</a><span>, in § 4.7.4</span> <li><a href="#abstract-opdef-readablestreamcontroller-releasesteps">abstract-op for ReadableStreamController</a><span>, in § 4.9.2</span> <li><a href="#abstract-opdef-readablestreamdefaultcontroller-releasesteps">abstract-op for ReadableStreamDefaultController</a><span>, in § 4.6.4</span> </ul> <li><a href="#reset-queue">ResetQueue</a><span>, in § 8.1</span> <li><a href="#rs-byob-request-respond">respond(bytesWritten)</a><span>, in § 4.8.3</span> <li><a href="#rs-byob-request-respond-with-new-view">respondWithNewView(view)</a><span>, in § 4.8.3</span> <li><a href="#transformstream-set-up">setting up</a><span>, in § 9.3.1</span> <li> set up <ul> <li><a href="#readablestream-set-up">dfn for ReadableStream</a><span>, in § 9.1.1</span> <li><a href="#transformstream-set-up">dfn for TransformStream</a><span>, in § 9.3.1</span> <li><a href="#writablestream-set-up">dfn for WritableStream</a><span>, in § 9.2.1</span> </ul> <li><a href="#abstract-opdef-setupcrossrealmtransformreadable">SetUpCrossRealmTransformReadable</a><span>, in § 8.2</span> <li><a href="#abstract-opdef-setupcrossrealmtransformwritable">SetUpCrossRealmTransformWritable</a><span>, in § 8.2</span> <li><a href="#set-up-readable-byte-stream-controller">SetUpReadableByteStreamController</a><span>, in § 4.9.5</span> <li><a href="#set-up-readable-byte-stream-controller-from-underlying-source">SetUpReadableByteStreamControllerFromUnderlyingSource</a><span>, in § 4.9.5</span> <li><a href="#set-up-readable-stream-byob-reader">SetUpReadableStreamBYOBReader</a><span>, in § 4.9.3</span> <li><a href="#set-up-readable-stream-default-controller">SetUpReadableStreamDefaultController</a><span>, in § 4.9.4</span> <li><a href="#set-up-readable-stream-default-controller-from-underlying-source">SetUpReadableStreamDefaultControllerFromUnderlyingSource</a><span>, in § 4.9.4</span> <li><a href="#set-up-readable-stream-default-reader">SetUpReadableStreamDefaultReader</a><span>, in § 4.9.3</span> <li><a href="#set-up-transform-stream-default-controller">SetUpTransformStreamDefaultController</a><span>, in § 6.4.2</span> <li><a href="#set-up-transform-stream-default-controller-from-transformer">SetUpTransformStreamDefaultControllerFromTransformer</a><span>, in § 6.4.2</span> <li><a href="#readablestream-set-up-with-byte-reading-support">set up with byte reading support</a><span>, in § 9.1.1</span> <li><a href="#set-up-writable-stream-default-controller">SetUpWritableStreamDefaultController</a><span>, in § 5.5.4</span> <li><a href="#set-up-writable-stream-default-controller-from-underlying-sink">SetUpWritableStreamDefaultControllerFromUnderlyingSink</a><span>, in § 5.5.4</span> <li><a href="#set-up-writable-stream-default-writer">SetUpWritableStreamDefaultWriter</a><span>, in § 5.5.1</span> <li><a href="#rs-pipeTo-shutdown">Shutdown</a><span>, in § 4.9.1</span> <li><a href="#rs-pipeTo-shutdown-with-action">Shutdown with an action</a><span>, in § 4.9.1</span> <li> signal <ul> <li><a href="#ws-default-controller-signal">attribute for WritableStreamDefaultController</a><span>, in § 5.4.3</span> <li><a href="#readablestream-pipe-through-signal">dfn for ReadableStream/pipe through, ReadableStream/piped through</a><span>, in § 9.5</span> <li><a href="#readablestream-pipe-to-signal">dfn for ReadableStream/pipe to, ReadableStream/piped to</a><span>, in § 9.5</span> <li><a href="#writablestream-signal">dfn for WritableStream</a><span>, in § 9.2.1</span> <li><a href="#dom-streampipeoptions-signal">dict-member for StreamPipeOptions</a><span>, in § 4.2.1</span> </ul> <li> size <ul> <li><a href="#blqs-size">attribute for ByteLengthQueuingStrategy</a><span>, in § 7.2.3</span> <li><a href="#cqs-size">attribute for CountQueuingStrategy</a><span>, in § 7.3.3</span> <li><a href="#value-with-size-size">dfn for value-with-size</a><span>, in § 8.1</span> <li><a href="#dom-queuingstrategy-size">dict-member for QueuingStrategy</a><span>, in § 7.1</span> </ul> <li> sizeAlgorithm <ul> <li><a href="#readablestream-set-up-sizealgorithm">dfn for ReadableStream/set up</a><span>, in § 9.1.1</span> <li><a href="#writablestream-set-up-sizealgorithm">dfn for WritableStream/set up</a><span>, in § 9.2.1</span> </ul> <li> start <ul> <li><a href="#dom-transformer-start">dict-member for Transformer</a><span>, in § 6.2.3</span> <li><a href="#dom-underlyingsink-start">dict-member for UnderlyingSink</a><span>, in § 5.2.3</span> <li><a href="#dom-underlyingsource-start">dict-member for UnderlyingSource</a><span>, in § 4.2.3</span> </ul> <li> [[started]] <ul> <li><a href="#readablebytestreamcontroller-started">dfn for ReadableByteStreamController</a><span>, in § 4.7.2</span> <li><a href="#readablestreamdefaultcontroller-started">dfn for ReadableStreamDefaultController</a><span>, in § 4.6.2</span> <li><a href="#writablestreamdefaultcontroller-started">dfn for WritableStreamDefaultController</a><span>, in § 5.4.2</span> </ul> <li> [[state]] <ul> <li><a href="#readablestream-state">dfn for ReadableStream</a><span>, in § 4.2.2</span> <li><a href="#writablestream-state">dfn for WritableStream</a><span>, in § 5.2.2</span> </ul> <li> [[storedError]] <ul> <li><a href="#readablestream-storederror">dfn for ReadableStream</a><span>, in § 4.2.2</span> <li><a href="#writablestream-storederror">dfn for WritableStream</a><span>, in § 5.2.2</span> </ul> <li> [[strategyHWM]] <ul> <li><a href="#readablebytestreamcontroller-strategyhwm">dfn for ReadableByteStreamController</a><span>, in § 4.7.2</span> <li><a href="#readablestreamdefaultcontroller-strategyhwm">dfn for ReadableStreamDefaultController</a><span>, in § 4.6.2</span> <li><a href="#writablestreamdefaultcontroller-strategyhwm">dfn for WritableStreamDefaultController</a><span>, in § 5.4.2</span> </ul> <li> [[strategySizeAlgorithm]] <ul> <li><a href="#readablestreamdefaultcontroller-strategysizealgorithm">dfn for ReadableStreamDefaultController</a><span>, in § 4.6.2</span> <li><a href="#writablestreamdefaultcontroller-strategysizealgorithm">dfn for WritableStreamDefaultController</a><span>, in § 5.4.2</span> </ul> <li> [[stream]] <ul> <li><a href="#readablebytestreamcontroller-stream">dfn for ReadableByteStreamController</a><span>, in § 4.7.2</span> <li><a href="#readablestreamdefaultcontroller-stream">dfn for ReadableStreamDefaultController</a><span>, in § 4.6.2</span> <li><a href="#readablestreamgenericreader-stream">dfn for ReadableStreamGenericReader</a><span>, in § 4.3.2</span> <li><a href="#transformstreamdefaultcontroller-stream">dfn for TransformStreamDefaultController</a><span>, in § 6.3.2</span> <li><a href="#writablestreamdefaultcontroller-stream">dfn for WritableStreamDefaultController</a><span>, in § 5.4.2</span> <li><a href="#writablestreamdefaultwriter-stream">dfn for WritableStreamDefaultWriter</a><span>, in § 5.3.2</span> </ul> <li><a href="#dictdef-streampipeoptions">StreamPipeOptions</a><span>, in § 4.2.1</span> <li><a href="#abstract-opdef-structuredclone">StructuredClone</a><span>, in § 8.3</span> <li><a href="#readablestream-tee">tee</a><span>, in § 9.1.2</span> <li><a href="#rs-tee">tee()</a><span>, in § 4.2.4</span> <li><a href="#tee-a-readable-stream">tee a readable stream</a><span>, in § 2.1</span> <li><a href="#readablestream-tee">teeing</a><span>, in § 9.1.2</span> <li><a href="#transformstream-terminate">terminate</a><span>, in § 9.3.1</span> <li><a href="#ts-default-controller-terminate">terminate()</a><span>, in § 6.3.3</span> <li><a href="#transfer-array-buffer">TransferArrayBuffer</a><span>, in § 8.3</span> <li> transform <ul> <li><a href="#generictransformstream-transform">dfn for GenericTransformStream</a><span>, in § 9.3.2</span> <li><a href="#dom-transformer-transform">dict-member for Transformer</a><span>, in § 6.2.3</span> </ul> <li><a href="#transformstreamdefaultcontroller-transformalgorithm">[[transformAlgorithm]]</a><span>, in § 6.3.2</span> <li><a href="#transformstream-set-up-transformalgorithm">transformAlgorithm</a><span>, in § 9.3.1</span> <li><a href="#dictdef-transformer">Transformer</a><span>, in § 6.2.3</span> <li><a href="#transformer">transformer</a><span>, in § 2.3</span> <li><a href="#callbackdef-transformercancelcallback">TransformerCancelCallback</a><span>, in § 6.2.3</span> <li><a href="#callbackdef-transformerflushcallback">TransformerFlushCallback</a><span>, in § 6.2.3</span> <li><a href="#callbackdef-transformerstartcallback">TransformerStartCallback</a><span>, in § 6.2.3</span> <li><a href="#callbackdef-transformertransformcallback">TransformerTransformCallback</a><span>, in § 6.2.3</span> <li><a href="#transform-stream">transform stream</a><span>, in § 2.3</span> <li><a href="#transformstream">TransformStream</a><span>, in § 6.2.1</span> <li><a href="#ts-constructor">TransformStream()</a><span>, in § 6.2.4</span> <li><a href="#transformstreamdefaultcontroller">TransformStreamDefaultController</a><span>, in § 6.3.1</span> <li><a href="#transform-stream-default-controller-clear-algorithms">TransformStreamDefaultControllerClearAlgorithms</a><span>, in § 6.4.2</span> <li><a href="#transform-stream-default-controller-enqueue">TransformStreamDefaultControllerEnqueue</a><span>, in § 6.4.2</span> <li><a href="#transform-stream-default-controller-error">TransformStreamDefaultControllerError</a><span>, in § 6.4.2</span> <li><a href="#transform-stream-default-controller-perform-transform">TransformStreamDefaultControllerPerformTransform</a><span>, in § 6.4.2</span> <li><a href="#transform-stream-default-controller-terminate">TransformStreamDefaultControllerTerminate</a><span>, in § 6.4.2</span> <li><a href="#transform-stream-default-sink-abort-algorithm">TransformStreamDefaultSinkAbortAlgorithm</a><span>, in § 6.4.3</span> <li><a href="#transform-stream-default-sink-close-algorithm">TransformStreamDefaultSinkCloseAlgorithm</a><span>, in § 6.4.3</span> <li><a href="#transform-stream-default-sink-write-algorithm">TransformStreamDefaultSinkWriteAlgorithm</a><span>, in § 6.4.3</span> <li><a href="#transform-stream-default-source-cancel">TransformStreamDefaultSourceCancelAlgorithm</a><span>, in § 6.4.4</span> <li><a href="#transform-stream-default-source-pull">TransformStreamDefaultSourcePullAlgorithm</a><span>, in § 6.4.4</span> <li><a href="#transform-stream-error">TransformStreamError</a><span>, in § 6.4.1</span> <li><a href="#transform-stream-error-writable-and-unblock-write">TransformStreamErrorWritableAndUnblockWrite</a><span>, in § 6.4.1</span> <li><a href="#transform-stream-set-backpressure">TransformStreamSetBackpressure</a><span>, in § 6.4.1</span> <li><a href="#ts-constructor">TransformStream(transformer)</a><span>, in § 6.2.4</span> <li><a href="#ts-constructor">TransformStream(transformer, writableStrategy)</a><span>, in § 6.2.4</span> <li><a href="#ts-constructor">TransformStream(transformer, writableStrategy, readableStrategy)</a><span>, in § 6.2.4</span> <li><a href="#transform-stream-unblock-write">TransformStreamUnblockWrite</a><span>, in § 6.4.1</span> <li> type <ul> <li><a href="#dom-underlyingsink-type">dict-member for UnderlyingSink</a><span>, in § 5.2.3</span> <li><a href="#dom-underlyingsource-type">dict-member for UnderlyingSource</a><span>, in § 4.2.3</span> </ul> <li><a href="#ultimate-sink">ultimate sink</a><span>, in § 2.4</span> <li><a href="#underlying-byte-source">underlying byte source</a><span>, in § 2.1</span> <li><a href="#underlying-sink">underlying sink</a><span>, in § 2.2</span> <li><a href="#dictdef-underlyingsink">UnderlyingSink</a><span>, in § 5.2.3</span> <li><a href="#callbackdef-underlyingsinkabortcallback">UnderlyingSinkAbortCallback</a><span>, in § 5.2.3</span> <li><a href="#callbackdef-underlyingsinkclosecallback">UnderlyingSinkCloseCallback</a><span>, in § 5.2.3</span> <li><a href="#callbackdef-underlyingsinkstartcallback">UnderlyingSinkStartCallback</a><span>, in § 5.2.3</span> <li><a href="#callbackdef-underlyingsinkwritecallback">UnderlyingSinkWriteCallback</a><span>, in § 5.2.3</span> <li><a href="#underlying-source">underlying source</a><span>, in § 2.1</span> <li><a href="#dictdef-underlyingsource">UnderlyingSource</a><span>, in § 4.2.3</span> <li><a href="#callbackdef-underlyingsourcecancelcallback">UnderlyingSourceCancelCallback</a><span>, in § 4.2.3</span> <li><a href="#callbackdef-underlyingsourcepullcallback">UnderlyingSourcePullCallback</a><span>, in § 4.2.3</span> <li><a href="#callbackdef-underlyingsourcestartcallback">UnderlyingSourceStartCallback</a><span>, in § 4.2.3</span> <li> value <ul> <li><a href="#value-with-size-value">dfn for value-with-size</a><span>, in § 8.1</span> <li><a href="#dom-readablestreamreadresult-value">dict-member for ReadableStreamReadResult</a><span>, in § 4.4.1</span> </ul> <li><a href="#value-with-size">value-with-size</a><span>, in § 8.1</span> <li><a href="#readablestreambyobrequest-view">[[view]]</a><span>, in § 4.8.2</span> <li><a href="#rs-byob-request-view">view</a><span>, in § 4.8.3</span> <li><a href="#pull-into-descriptor-view-constructor">view constructor</a><span>, in § 4.7.2</span> <li><a href="#pending-abort-request-was-already-erroring">was already erroring</a><span>, in § 5.2.2</span> <li><a href="#transformstream-writable">[[writable]]</a><span>, in § 6.2.2</span> <li> writable <ul> <li><a href="#dom-generictransformstream-writable">attribute for GenericTransformStream</a><span>, in § 9.3.2</span> <li><a href="#ts-writable">attribute for TransformStream</a><span>, in § 6.2.4</span> <li><a href="#dom-readablewritablepair-writable">dict-member for ReadableWritablePair</a><span>, in § 4.2.1</span> </ul> <li><a href="#writable-side">writable side</a><span>, in § 2.3</span> <li><a href="#writable-stream">writable stream</a><span>, in § 2.2</span> <li><a href="#writablestream">WritableStream</a><span>, in § 5.2.1</span> <li><a href="#ws-constructor">WritableStream()</a><span>, in § 5.2.4</span> <li><a href="#writable-stream-abort">WritableStreamAbort</a><span>, in § 5.5.1</span> <li><a href="#writable-stream-add-write-request">WritableStreamAddWriteRequest</a><span>, in § 5.5.2</span> <li><a href="#writable-stream-close">WritableStreamClose</a><span>, in § 5.5.1</span> <li><a href="#writable-stream-close-queued-or-in-flight">WritableStreamCloseQueuedOrInFlight</a><span>, in § 5.5.2</span> <li><a href="#writable-stream-deal-with-rejection">WritableStreamDealWithRejection</a><span>, in § 5.5.2</span> <li><a href="#writablestreamdefaultcontroller">WritableStreamDefaultController</a><span>, in § 5.4.1</span> <li><a href="#writable-stream-default-controller-advance-queue-if-needed">WritableStreamDefaultControllerAdvanceQueueIfNeeded</a><span>, in § 5.5.4</span> <li><a href="#writable-stream-default-controller-clear-algorithms">WritableStreamDefaultControllerClearAlgorithms</a><span>, in § 5.5.4</span> <li><a href="#writable-stream-default-controller-close">WritableStreamDefaultControllerClose</a><span>, in § 5.5.4</span> <li><a href="#writable-stream-default-controller-error">WritableStreamDefaultControllerError</a><span>, in § 5.5.4</span> <li><a href="#writable-stream-default-controller-error-if-needed">WritableStreamDefaultControllerErrorIfNeeded</a><span>, in § 5.5.4</span> <li><a href="#writable-stream-default-controller-get-backpressure">WritableStreamDefaultControllerGetBackpressure</a><span>, in § 5.5.4</span> <li><a href="#writable-stream-default-controller-get-chunk-size">WritableStreamDefaultControllerGetChunkSize</a><span>, in § 5.5.4</span> <li><a href="#writable-stream-default-controller-get-desired-size">WritableStreamDefaultControllerGetDesiredSize</a><span>, in § 5.5.4</span> <li><a href="#writable-stream-default-controller-process-close">WritableStreamDefaultControllerProcessClose</a><span>, in § 5.5.4</span> <li><a href="#writable-stream-default-controller-process-write">WritableStreamDefaultControllerProcessWrite</a><span>, in § 5.5.4</span> <li><a href="#writable-stream-default-controller-write">WritableStreamDefaultControllerWrite</a><span>, in § 5.5.4</span> <li><a href="#writablestreamdefaultwriter">WritableStreamDefaultWriter</a><span>, in § 5.3.1</span> <li><a href="#writable-stream-default-writer-abort">WritableStreamDefaultWriterAbort</a><span>, in § 5.5.3</span> <li><a href="#writable-stream-default-writer-close">WritableStreamDefaultWriterClose</a><span>, in § 5.5.3</span> <li><a href="#writable-stream-default-writer-close-with-error-propagation">WritableStreamDefaultWriterCloseWithErrorPropagation</a><span>, in § 5.5.3</span> <li><a href="#writable-stream-default-writer-ensure-closed-promise-rejected">WritableStreamDefaultWriterEnsureClosedPromiseRejected</a><span>, in § 5.5.3</span> <li><a href="#writable-stream-default-writer-ensure-ready-promise-rejected">WritableStreamDefaultWriterEnsureReadyPromiseRejected</a><span>, in § 5.5.3</span> <li><a href="#writable-stream-default-writer-get-desired-size">WritableStreamDefaultWriterGetDesiredSize</a><span>, in § 5.5.3</span> <li><a href="#writable-stream-default-writer-release">WritableStreamDefaultWriterRelease</a><span>, in § 5.5.3</span> <li><a href="#default-writer-constructor">WritableStreamDefaultWriter(stream)</a><span>, in § 5.3.3</span> <li><a href="#writable-stream-default-writer-write">WritableStreamDefaultWriterWrite</a><span>, in § 5.5.3</span> <li><a href="#writable-stream-finish-erroring">WritableStreamFinishErroring</a><span>, in § 5.5.2</span> <li><a href="#writable-stream-finish-in-flight-close">WritableStreamFinishInFlightClose</a><span>, in § 5.5.2</span> <li><a href="#writable-stream-finish-in-flight-close-with-error">WritableStreamFinishInFlightCloseWithError</a><span>, in § 5.5.2</span> <li><a href="#writable-stream-finish-in-flight-write">WritableStreamFinishInFlightWrite</a><span>, in § 5.5.2</span> <li><a href="#writable-stream-finish-in-flight-write-with-error">WritableStreamFinishInFlightWriteWithError</a><span>, in § 5.5.2</span> <li><a href="#writable-stream-has-operation-marked-in-flight">WritableStreamHasOperationMarkedInFlight</a><span>, in § 5.5.2</span> <li><a href="#writable-stream-mark-close-request-in-flight">WritableStreamMarkCloseRequestInFlight</a><span>, in § 5.5.2</span> <li><a href="#writable-stream-mark-first-write-request-in-flight">WritableStreamMarkFirstWriteRequestInFlight</a><span>, in § 5.5.2</span> <li><a href="#writable-stream-reject-close-and-closed-promise-if-needed">WritableStreamRejectCloseAndClosedPromiseIfNeeded</a><span>, in § 5.5.2</span> <li><a href="#writable-stream-start-erroring">WritableStreamStartErroring</a><span>, in § 5.5.2</span> <li><a href="#ws-constructor">WritableStream(underlyingSink)</a><span>, in § 5.2.4</span> <li><a href="#ws-constructor">WritableStream(underlyingSink, strategy)</a><span>, in § 5.2.4</span> <li><a href="#writable-stream-update-backpressure">WritableStreamUpdateBackpressure</a><span>, in § 5.5.2</span> <li><a href="#writer">writable stream writer</a><span>, in § 2.6</span> <li><a href="#dom-transformer-writabletype">writableType</a><span>, in § 6.2.3</span> <li><a href="#dom-underlyingsink-write">write</a><span>, in § 5.2.3</span> <li><a href="#default-writer-write">write()</a><span>, in § 5.3.3</span> <li><a href="#writablestreamdefaultwriter-write-a-chunk">write a chunk</a><span>, in § 9.2.2</span> <li><a href="#writablestreamdefaultcontroller-writealgorithm">[[writeAlgorithm]]</a><span>, in § 5.4.2</span> <li><a href="#writablestream-set-up-writealgorithm">writeAlgorithm</a><span>, in § 9.2.1</span> <li><a href="#default-writer-write">write(chunk)</a><span>, in § 5.3.3</span> <li><a href="#writablestream-writer">[[writer]]</a><span>, in § 5.2.2</span> <li><a href="#writer">writer</a><span>, in § 2.6</span> <li><a href="#writablestream-writerequests">[[writeRequests]]</a><span>, in § 5.2.2</span> <li><a href="#writablestreamdefaultwriter-write-a-chunk">writing a chunk</a><span>, in § 9.2.2</span> </ul> <h3 class="no-num no-ref heading settled" id="index-defined-elsewhere"><span class="content">Terms defined by reference</span><a class="self-link" href="#index-defined-elsewhere"></a></h3> <ul class="index"> <li> <a data-link-type="biblio">[COMPRESSION]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="6e6d76ed">CompressionStream</span> </ul> <li> <a data-link-type="biblio">[DOM]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="2e66eaf1">AbortController</span> <li><span class="dfn-paneled" id="cca3cdb2">AbortSignal</span> <li><span class="dfn-paneled" id="28e64574">abort reason</span> <li><span class="dfn-paneled" id="535dd335">aborted</span> <li><span class="dfn-paneled" id="87bc23a5">add</span> <li><span class="dfn-paneled" id="ff87eaf9">remove</span> <li><span class="dfn-paneled" id="0fe84b59">signal</span> <li><span class="dfn-paneled" id="2296404c">signal abort</span> </ul> <li> <a data-link-type="biblio">[ECMASCRIPT]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="d1a8bfee">%ArrayBuffer%</span> <li><span class="dfn-paneled" id="038c4c21">%DataView%</span> <li><span class="dfn-paneled" id="b5d2d271">%Object.prototype%</span> <li><span class="dfn-paneled" id="2426fb1e">%Uint8Array%</span> <li><span class="dfn-paneled" id="ecb78c1d">ArrayBuffer</span> <li><span class="dfn-paneled" id="81131be0">Call</span> <li><span class="dfn-paneled" id="74a58133">CloneArrayBuffer</span> <li><span class="dfn-paneled" id="944206e4">Construct</span> <li><span class="dfn-paneled" id="3689e92d">CopyDataBlockBytes</span> <li><span class="dfn-paneled" id="4c6c6f05">CreateArrayFromList</span> <li><span class="dfn-paneled" id="6df10f44">CreateBuiltinFunction</span> <li><span class="dfn-paneled" id="d2c61922">CreateDataProperty</span> <li><span class="dfn-paneled" id="fb8187fa">DataView</span> <li><span class="dfn-paneled" id="d7a47d32">DetachArrayBuffer</span> <li><span class="dfn-paneled" id="abf85593">Get</span> <li><span class="dfn-paneled" id="1f8de32a">GetIterator</span> <li><span class="dfn-paneled" id="5b7339ce">GetMethod</span> <li><span class="dfn-paneled" id="13e76b84">GetV</span> <li><span class="dfn-paneled" id="d7f1c677">IsDetachedBuffer</span> <li><span class="dfn-paneled" id="e7409427">IsInteger</span> <li><span class="dfn-paneled" id="03487a52">IteratorComplete</span> <li><span class="dfn-paneled" id="069eabcc">IteratorNext</span> <li><span class="dfn-paneled" id="68d0559e">IteratorValue</span> <li><span class="dfn-paneled" id="5f9c7266">Number</span> <li><span class="dfn-paneled" id="ebbbef34">OrdinaryObjectCreate</span> <li><span class="dfn-paneled" id="65342bb9">SameValue</span> <li><span class="dfn-paneled" id="91890fa8">SharedArrayBuffer</span> <li><span class="dfn-paneled" id="81c11fc3">TypeError</span> <li><span class="dfn-paneled" id="8b2fedc9">Uint8Array</span> <li><span class="dfn-paneled" id="3ee2d4d2">abstract operation</span> <li><span class="dfn-paneled" id="77aef363">array</span> <li><span class="dfn-paneled" id="93148e63">async generator</span> <li><span class="dfn-paneled" id="9aa33dcf">async iterable</span> <li><span class="dfn-paneled" id="74b35c0b">Completion Record</span> <li><span class="dfn-paneled" id="c5c13e72">Completion Records</span> <li><span class="dfn-paneled" id="900ce14b">internal slot</span> <li><span class="dfn-paneled" id="d8f8e172">is a String</span> <li><span class="dfn-paneled" id="367d928f">is an Object</span> <li><span class="dfn-paneled" id="70a9ebde">is not a Number</span> <li><span class="dfn-paneled" id="68316ab6">is not an Object</span> <li><span class="dfn-paneled" id="88cd0dbd">iterable</span> <li><span class="dfn-paneled" id="6875767f">map</span> <li><span class="dfn-paneled" id="e050b76b">number type</span> <li><span class="dfn-paneled" id="704f9119">realm</span> <li><span class="dfn-paneled" id="e1576caa">the current Realm</span> <li><span class="dfn-paneled" id="904376f6">the typed array constructors table</span> <li><span class="dfn-paneled" id="a3a4ba25">typed array</span> </ul> <li> <a data-link-type="biblio">[ENCODING]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="1e249f40">TextDecoderStream</span> </ul> <li> <a data-link-type="biblio">[FETCH]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="08a12aad">Response</span> <li><span class="dfn-paneled" id="8e9945a0">body</span> <li><span class="dfn-paneled" id="2ce6f6bb">fetch(input)</span> </ul> <li> <a data-link-type="biblio">[HTML]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="df16744f">MessagePort</span> <li><span class="dfn-paneled" id="0800bdf4">StructuredDeserialize</span> <li><span class="dfn-paneled" id="e7cb09fb">StructuredDeserializeWithTransfer</span> <li><span class="dfn-paneled" id="89786baf">StructuredSerialize</span> <li><span class="dfn-paneled" id="9da834a1">StructuredSerializeWithTransfer</span> <li><span class="dfn-paneled" id="444d7f6a">Transferable</span> <li><span class="dfn-paneled" id="a7d0975c">entangle</span> <li><span class="dfn-paneled" id="4b6086d7">global object</span> <li><span class="dfn-paneled" id="f0811ff8">img</span> <li><span class="dfn-paneled" id="a72449dd">in parallel</span> <li><span class="dfn-paneled" id="38381ead">message</span> <li><span class="dfn-paneled" id="4a5e45d1">message port post message steps</span> <li><span class="dfn-paneled" id="6b373a4a">messageerror</span> <li><span class="dfn-paneled" id="8afe05ad">port message queue</span> <li><span class="dfn-paneled" id="53079ce3">queue a microtask</span> <li><span class="dfn-paneled" id="e99bd18e">relevant global object</span> <li><span class="dfn-paneled" id="5991ccfb">relevant realm</span> <li><span class="dfn-paneled" id="9c4c1e66">relevant settings object</span> <li><span class="dfn-paneled" id="0a422d04">serializable object</span> <li><span class="dfn-paneled" id="25ce4994">transfer steps</span> <li><span class="dfn-paneled" id="6aa60cdd">transfer-receiving steps</span> <li><span class="dfn-paneled" id="dbe29252">transferable object</span> <li><span class="dfn-paneled" id="f1041b37">unhandledrejection</span> </ul> <li> <a data-link-type="biblio">[INFRA]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="53275e46">append <small>(for list)</small></span> <li><span class="dfn-paneled" id="a3b18719">append <small>(for set)</small></span> <li><span class="dfn-paneled" id="7b0d918d">break</span> <li><span class="dfn-paneled" id="3de9e659">byte sequence</span> <li><span class="dfn-paneled" id="1243a891">exist</span> <li><span class="dfn-paneled" id="16d07e10">for each</span> <li><span class="dfn-paneled" id="860300d4">implementation-defined</span> <li><span class="dfn-paneled" id="6b815fdd">is empty</span> <li><span class="dfn-paneled" id="c88f3887">item</span> <li><span class="dfn-paneled" id="36333997">length</span> <li><span class="dfn-paneled" id="649608b9">list</span> <li><span class="dfn-paneled" id="692595fe">ordered set</span> <li><span class="dfn-paneled" id="99c988d6">remove</span> <li><span class="dfn-paneled" id="0204d188">size</span> <li><span class="dfn-paneled" id="984221ca">struct</span> <li><span class="dfn-paneled" id="cbdc89b4">while</span> </ul> <li> <a data-link-type="biblio">[SERVICE-WORKERS]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="9ff3511b">fetch</span> </ul> <li> <a data-link-type="biblio">[WASM-JS-API-2]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="9ca1c179">Memory</span> <li><span class="dfn-paneled" id="2f6db3ee">buffer</span> </ul> <li> <a data-link-type="biblio">[WEBIDL]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="6c9ab516">ArrayBufferView</span> <li><span class="dfn-paneled" id="dca2de17">DOMException</span> <li><span class="dfn-paneled" id="d54f5897">DataCloneError</span> <li><span class="dfn-paneled" id="c01cbda0">EnforceRange</span> <li><span class="dfn-paneled" id="ae46556f">Function</span> <li><span class="dfn-paneled" id="bdbd19d1">Promise</span> <li><span class="dfn-paneled" id="ec878a66">RangeError</span> <li><span class="dfn-paneled" id="dacde8b5">a new promise</span> <li><span class="dfn-paneled" id="d0b4a948">a promise rejected with</span> <li><span class="dfn-paneled" id="8f5c2179">a promise resolved with</span> <li><span class="dfn-paneled" id="6c6b1005">any</span> <li><span class="dfn-paneled" id="9a7f3f6f">asynchronous iterator initialization steps</span> <li><span class="dfn-paneled" id="a53fbed9">asynchronous iterator return</span> <li><span class="dfn-paneled" id="5372cca8">boolean</span> <li><span class="dfn-paneled" id="495737df">byte length</span> <li><span class="dfn-paneled" id="a053c42b">callback context</span> <li><span class="dfn-paneled" id="a9bf6bd5">callback this value</span> <li><span class="dfn-paneled" id="59243858">constructor steps</span> <li><span class="dfn-paneled" id="cadf5fe9">converted to an IDL value</span> <li><span class="dfn-paneled" id="88a9cf19">create</span> <li><span class="dfn-paneled" id="1003edc0">detach</span> <li><span class="dfn-paneled" id="9c78f4e3">end of iteration</span> <li><span class="dfn-paneled" id="7b05fe24">get a copy of the bytes held by the buffer source</span> <li><span class="dfn-paneled" id="e7652812">get the next iteration result</span> <li><span class="dfn-paneled" id="4ae6d1ad">getting a promise to wait for all</span> <li><span class="dfn-paneled" id="a32c65d4">implements</span> <li><span class="dfn-paneled" id="a7900362">include</span> <li><span class="dfn-paneled" id="10ce5f6f">invoke</span> <li><span class="dfn-paneled" id="56f81a8e">new</span> <li><span class="dfn-paneled" id="efd1ec5d">object</span> <li><span class="dfn-paneled" id="6728fdee">platform object</span> <li><span class="dfn-paneled" id="750a2f08">react</span> <li><span class="dfn-paneled" id="116848ac">reacting</span> <li><span class="dfn-paneled" id="b262501e">reject</span> <li><span class="dfn-paneled" id="3b90bdcd">resolve</span> <li><span class="dfn-paneled" id="9cce47fd">sequence</span> <li><span class="dfn-paneled" id="4013a022">this</span> <li><span class="dfn-paneled" id="69c80471">transfer</span> <li><span class="dfn-paneled" id="5f90bbfb">undefined</span> <li><span class="dfn-paneled" id="f32e046f">underlying buffer</span> <li><span class="dfn-paneled" id="11e0b87f">unrestricted double</span> <li><span class="dfn-paneled" id="f14b47b8">unsigned long long</span> <li><span class="dfn-paneled" id="24bd7d25">upon fulfillment</span> <li><span class="dfn-paneled" id="f14ed351">upon rejection</span> <li><span class="dfn-paneled" id="2d6ca7ca">write <small>(for ArrayBuffer)</small></span> <li><span class="dfn-paneled" id="f3fd9d04">write <small>(for ArrayBufferView)</small></span> </ul> <li> <a data-link-type="biblio">[WEBRTC-ENCODED-TRANSFORM]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="ee3f3fb3">RTCRtpScriptTransformer</span> </ul> <li> <a data-link-type="biblio">[WEBSOCKETS]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="6eeed17d">WebSocket</span> <li><span class="dfn-paneled" id="32596166">bufferedAmount</span> </ul> </ul> <h2 class="no-num no-ref heading settled" id="references"><span class="content">References</span><a class="self-link" href="#references"></a></h2> <h3 class="no-num no-ref heading settled" id="normative"><span class="content">Normative References</span><a class="self-link" href="#normative"></a></h3> <dl> <dt id="biblio-dom">[DOM] <dd>Anne van Kesteren. <a href="https://dom.spec.whatwg.org/"><cite>DOM Standard</cite></a>. Living Standard. URL: <a href="https://dom.spec.whatwg.org/">https://dom.spec.whatwg.org/</a> <dt id="biblio-ecmascript">[ECMASCRIPT] <dd><a href="https://tc39.es/ecma262/multipage/"><cite>ECMAScript Language Specification</cite></a>. URL: <a href="https://tc39.es/ecma262/multipage/">https://tc39.es/ecma262/multipage/</a> <dt id="biblio-html">[HTML] <dd>Anne van Kesteren; et al. <a href="https://html.spec.whatwg.org/multipage/"><cite>HTML Standard</cite></a>. Living Standard. URL: <a href="https://html.spec.whatwg.org/multipage/">https://html.spec.whatwg.org/multipage/</a> <dt id="biblio-ieee-754">[IEEE-754] <dd><a href="http://ieeexplore.ieee.org/servlet/opac?punumber=4610933"><cite>IEEE Standard for Floating-Point Arithmetic</cite></a>. 29 August 2008. URL: <a href="http://ieeexplore.ieee.org/servlet/opac?punumber=4610933">http://ieeexplore.ieee.org/servlet/opac?punumber=4610933</a> <dt id="biblio-infra">[INFRA] <dd>Anne van Kesteren; Domenic Denicola. <a href="https://infra.spec.whatwg.org/"><cite>Infra Standard</cite></a>. Living Standard. URL: <a href="https://infra.spec.whatwg.org/">https://infra.spec.whatwg.org/</a> <dt id="biblio-webidl">[WEBIDL] <dd>Edgar Chen; Timothy Gu. <a href="https://webidl.spec.whatwg.org/"><cite>Web IDL Standard</cite></a>. Living Standard. URL: <a href="https://webidl.spec.whatwg.org/">https://webidl.spec.whatwg.org/</a> </dl> <h3 class="no-num no-ref heading settled" id="informative"><span class="content">Informative References</span><a class="self-link" href="#informative"></a></h3> <dl> <dt id="biblio-compression">[COMPRESSION] <dd>Adam Rice. <a href="https://compression.spec.whatwg.org/"><cite>Compression Standard</cite></a>. Living Standard. URL: <a href="https://compression.spec.whatwg.org/">https://compression.spec.whatwg.org/</a> <dt id="biblio-encoding">[ENCODING] <dd>Anne van Kesteren. <a href="https://encoding.spec.whatwg.org/"><cite>Encoding Standard</cite></a>. Living Standard. URL: <a href="https://encoding.spec.whatwg.org/">https://encoding.spec.whatwg.org/</a> <dt id="biblio-fetch">[FETCH] <dd>Anne van Kesteren. <a href="https://fetch.spec.whatwg.org/"><cite>Fetch Standard</cite></a>. Living Standard. URL: <a href="https://fetch.spec.whatwg.org/">https://fetch.spec.whatwg.org/</a> <dt id="biblio-service-workers">[SERVICE-WORKERS] <dd>Jake Archibald; Marijn Kruisselbrink. <a href="https://w3c.github.io/ServiceWorker/"><cite>Service Workers</cite></a>. URL: <a href="https://w3c.github.io/ServiceWorker/">https://w3c.github.io/ServiceWorker/</a> <dt id="biblio-wasm-js-api-1">[WASM-JS-API-1] <dd>Daniel Ehrenberg. <a href="https://webassembly.github.io/spec/js-api/"><cite>WebAssembly JavaScript Interface</cite></a>. URL: <a href="https://webassembly.github.io/spec/js-api/">https://webassembly.github.io/spec/js-api/</a> <dt id="biblio-wasm-js-api-2">[WASM-JS-API-2] <dd>. Ms2ger. <a href="https://webassembly.github.io/spec/js-api/"><cite>WebAssembly JavaScript Interface</cite></a>. URL: <a href="https://webassembly.github.io/spec/js-api/">https://webassembly.github.io/spec/js-api/</a> <dt id="biblio-webrtc-encoded-transform">[WEBRTC-ENCODED-TRANSFORM] <dd>Harald Alvestrand; Guido Urdaneta; youenn fablet. <a href="https://w3c.github.io/webrtc-encoded-transform/"><cite>WebRTC Encoded Transform</cite></a>. URL: <a href="https://w3c.github.io/webrtc-encoded-transform/">https://w3c.github.io/webrtc-encoded-transform/</a> <dt id="biblio-websockets">[WEBSOCKETS] <dd>Adam Rice. <a href="https://websockets.spec.whatwg.org/"><cite>WebSockets Standard</cite></a>. Living Standard. URL: <a href="https://websockets.spec.whatwg.org/">https://websockets.spec.whatwg.org/</a> </dl> <h2 class="no-num no-ref heading settled" id="idl-index"><span class="content">IDL Index</span><a class="self-link" href="#idl-index"></a></h2> <pre class="idl highlight def">[Exposed=*, <a class="idl-code" data-link-type="extended-attribute" href="https://html.spec.whatwg.org/multipage/structured-data.html#transferable"><c- g>Transferable</c-></a>] <c- b>interface</c-> <a href="#readablestream"><code><c- g>ReadableStream</c-></code></a> { <a class="idl-code" data-link-type="constructor" href="#rs-constructor"><c- g>constructor</c-></a>(<c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-object"><c- b>object</c-></a> <a href="#dom-readablestream-readablestream-underlyingsource-strategy-underlyingsource"><code><c- g>underlyingSource</c-></code></a>, <c- b>optional</c-> <a data-link-type="idl-name" href="#dictdef-queuingstrategy"><c- n>QueuingStrategy</c-></a> <a href="#dom-readablestream-readablestream-underlyingsource-strategy-strategy"><code><c- g>strategy</c-></code></a> = {}); <c- b>static</c-> <a data-link-type="idl-name" href="#readablestream"><c- n>ReadableStream</c-></a> <a class="idl-code" data-link-type="method" href="#rs-from"><c- g>from</c-></a>(<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any"><c- b>any</c-></a> <a href="#dom-readablestream-from-asynciterable-asynciterable"><code><c- g>asyncIterable</c-></code></a>); <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-boolean"><c- b>boolean</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="boolean" href="#rs-locked"><c- g>locked</c-></a>; <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise"><c- b>Promise</c-></a><<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined"><c- b>undefined</c-></a>> <a class="idl-code" data-link-type="method" href="#rs-cancel"><c- g>cancel</c-></a>(<c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any"><c- b>any</c-></a> <a href="#dom-readablestream-cancel-reason-reason"><code><c- g>reason</c-></code></a>); <a data-link-type="idl-name" href="#typedefdef-readablestreamreader"><c- n>ReadableStreamReader</c-></a> <a class="idl-code" data-link-type="method" href="#rs-get-reader"><c- g>getReader</c-></a>(<c- b>optional</c-> <a data-link-type="idl-name" href="#dictdef-readablestreamgetreaderoptions"><c- n>ReadableStreamGetReaderOptions</c-></a> <a href="#dom-readablestream-getreader-options-options"><code><c- g>options</c-></code></a> = {}); <a data-link-type="idl-name" href="#readablestream"><c- n>ReadableStream</c-></a> <a class="idl-code" data-link-type="method" href="#rs-pipe-through"><c- g>pipeThrough</c-></a>(<a data-link-type="idl-name" href="#dictdef-readablewritablepair"><c- n>ReadableWritablePair</c-></a> <a href="#dom-readablestream-pipethrough-transform-options-transform"><code><c- g>transform</c-></code></a>, <c- b>optional</c-> <a data-link-type="idl-name" href="#dictdef-streampipeoptions"><c- n>StreamPipeOptions</c-></a> <a href="#dom-readablestream-pipethrough-transform-options-options"><code><c- g>options</c-></code></a> = {}); <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise"><c- b>Promise</c-></a><<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined"><c- b>undefined</c-></a>> <a class="idl-code" data-link-type="method" href="#rs-pipe-to"><c- g>pipeTo</c-></a>(<a data-link-type="idl-name" href="#writablestream"><c- n>WritableStream</c-></a> <a href="#dom-readablestream-pipeto-destination-options-destination"><code><c- g>destination</c-></code></a>, <c- b>optional</c-> <a data-link-type="idl-name" href="#dictdef-streampipeoptions"><c- n>StreamPipeOptions</c-></a> <a href="#dom-readablestream-pipeto-destination-options-options"><code><c- g>options</c-></code></a> = {}); <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#idl-sequence"><c- b>sequence</c-></a><<a data-link-type="idl-name" href="#readablestream"><c- n>ReadableStream</c-></a>> <a class="idl-code" data-link-type="method" href="#rs-tee"><c- g>tee</c-></a>(); <c- b>async</c-> <c- b>iterable</c-><<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any"><c- b>any</c-></a>>(<c- b>optional</c-> <a data-link-type="idl-name" href="#dictdef-readablestreamiteratoroptions"><c- n>ReadableStreamIteratorOptions</c-></a> <a href="#dom-readablestream-options"><code><c- g>options</c-></code></a> = {}); }; <c- b>typedef</c-> (<a data-link-type="idl-name" href="#readablestreamdefaultreader"><c- n>ReadableStreamDefaultReader</c-></a> <c- b>or</c-> <a data-link-type="idl-name" href="#readablestreambyobreader"><c- n>ReadableStreamBYOBReader</c-></a>) <a href="#typedefdef-readablestreamreader"><code><c- g>ReadableStreamReader</c-></code></a>; <c- b>enum</c-> <a href="#enumdef-readablestreamreadermode"><code><c- g>ReadableStreamReaderMode</c-></code></a> { <a href="#dom-readablestreamreadermode-byob"><code><c- s>"byob"</c-></code></a> }; <c- b>dictionary</c-> <a href="#dictdef-readablestreamgetreaderoptions"><code><c- g>ReadableStreamGetReaderOptions</c-></code></a> { <a data-link-type="idl-name" href="#enumdef-readablestreamreadermode"><c- n>ReadableStreamReaderMode</c-></a> <a data-type="ReadableStreamReaderMode" href="#dom-readablestreamgetreaderoptions-mode"><code><c- g>mode</c-></code></a>; }; <c- b>dictionary</c-> <a href="#dictdef-readablestreamiteratoroptions"><code><c- g>ReadableStreamIteratorOptions</c-></code></a> { <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-boolean"><c- b>boolean</c-></a> <a data-default="false" data-type="boolean" href="#dom-readablestreamiteratoroptions-preventcancel"><code><c- g>preventCancel</c-></code></a> = <c- b>false</c->; }; <c- b>dictionary</c-> <a href="#dictdef-readablewritablepair"><code><c- g>ReadableWritablePair</c-></code></a> { <c- b>required</c-> <a data-link-type="idl-name" href="#readablestream"><c- n>ReadableStream</c-></a> <a data-type="ReadableStream" href="#dom-readablewritablepair-readable"><code><c- g>readable</c-></code></a>; <c- b>required</c-> <a data-link-type="idl-name" href="#writablestream"><c- n>WritableStream</c-></a> <a data-type="WritableStream" href="#dom-readablewritablepair-writable"><code><c- g>writable</c-></code></a>; }; <c- b>dictionary</c-> <a href="#dictdef-streampipeoptions"><code><c- g>StreamPipeOptions</c-></code></a> { <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-boolean"><c- b>boolean</c-></a> <a data-default="false" data-type="boolean" href="#dom-streampipeoptions-preventclose"><code><c- g>preventClose</c-></code></a> = <c- b>false</c->; <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-boolean"><c- b>boolean</c-></a> <a data-default="false" data-type="boolean" href="#dom-streampipeoptions-preventabort"><code><c- g>preventAbort</c-></code></a> = <c- b>false</c->; <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-boolean"><c- b>boolean</c-></a> <a data-default="false" data-type="boolean" href="#dom-streampipeoptions-preventcancel"><code><c- g>preventCancel</c-></code></a> = <c- b>false</c->; <a data-link-type="idl-name" href="https://dom.spec.whatwg.org/#abortsignal"><c- n>AbortSignal</c-></a> <a data-type="AbortSignal" href="#dom-streampipeoptions-signal"><code><c- g>signal</c-></code></a>; }; <c- b>dictionary</c-> <a href="#dictdef-underlyingsource"><code><c- g>UnderlyingSource</c-></code></a> { <a data-link-type="idl-name" href="#callbackdef-underlyingsourcestartcallback"><c- n>UnderlyingSourceStartCallback</c-></a> <a class="idl-code" data-link-type="dict-member" data-type="UnderlyingSourceStartCallback" href="#dom-underlyingsource-start"><c- g>start</c-></a>; <a data-link-type="idl-name" href="#callbackdef-underlyingsourcepullcallback"><c- n>UnderlyingSourcePullCallback</c-></a> <a class="idl-code" data-link-type="dict-member" data-type="UnderlyingSourcePullCallback" href="#dom-underlyingsource-pull"><c- g>pull</c-></a>; <a data-link-type="idl-name" href="#callbackdef-underlyingsourcecancelcallback"><c- n>UnderlyingSourceCancelCallback</c-></a> <a class="idl-code" data-link-type="dict-member" data-type="UnderlyingSourceCancelCallback" href="#dom-underlyingsource-cancel"><c- g>cancel</c-></a>; <a data-link-type="idl-name" href="#enumdef-readablestreamtype"><c- n>ReadableStreamType</c-></a> <a class="idl-code" data-link-type="dict-member" data-type="ReadableStreamType" href="#dom-underlyingsource-type"><c- g>type</c-></a>; [<a class="idl-code" data-link-type="extended-attribute" href="https://webidl.spec.whatwg.org/#EnforceRange"><c- g>EnforceRange</c-></a>] <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-unsigned-long-long"><c- b>unsigned</c-> <c- b>long</c-> <c- b>long</c-></a> <a class="idl-code" data-link-type="dict-member" data-type="unsigned long long" href="#dom-underlyingsource-autoallocatechunksize"><c- g>autoAllocateChunkSize</c-></a>; }; <c- b>typedef</c-> (<a data-link-type="idl-name" href="#readablestreamdefaultcontroller"><c- n>ReadableStreamDefaultController</c-></a> <c- b>or</c-> <a data-link-type="idl-name" href="#readablebytestreamcontroller"><c- n>ReadableByteStreamController</c-></a>) <a href="#typedefdef-readablestreamcontroller"><code><c- g>ReadableStreamController</c-></code></a>; <c- b>callback</c-> <a href="#callbackdef-underlyingsourcestartcallback"><code><c- g>UnderlyingSourceStartCallback</c-></code></a> = <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any"><c- b>any</c-></a> (<a data-link-type="idl-name" href="#typedefdef-readablestreamcontroller"><c- n>ReadableStreamController</c-></a> <a href="#dom-underlyingsourcestartcallback-controller"><code><c- g>controller</c-></code></a>); <c- b>callback</c-> <a href="#callbackdef-underlyingsourcepullcallback"><code><c- g>UnderlyingSourcePullCallback</c-></code></a> = <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise"><c- b>Promise</c-></a><<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined"><c- b>undefined</c-></a>> (<a data-link-type="idl-name" href="#typedefdef-readablestreamcontroller"><c- n>ReadableStreamController</c-></a> <a href="#dom-underlyingsourcepullcallback-controller"><code><c- g>controller</c-></code></a>); <c- b>callback</c-> <a href="#callbackdef-underlyingsourcecancelcallback"><code><c- g>UnderlyingSourceCancelCallback</c-></code></a> = <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise"><c- b>Promise</c-></a><<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined"><c- b>undefined</c-></a>> (<c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any"><c- b>any</c-></a> <a href="#dom-underlyingsourcecancelcallback-reason"><code><c- g>reason</c-></code></a>); <c- b>enum</c-> <a href="#enumdef-readablestreamtype"><code><c- g>ReadableStreamType</c-></code></a> { <a class="idl-code" data-link-type="enum-value" href="#dom-readablestreamtype-bytes"><c- s>"bytes"</c-></a> }; <c- b>interface</c-> <c- b>mixin</c-> <a href="#readablestreamgenericreader"><code><c- g>ReadableStreamGenericReader</c-></code></a> { <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise"><c- b>Promise</c-></a><<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined"><c- b>undefined</c-></a>> <a class="idl-code" data-link-type="attribute" data-readonly data-type="Promise<undefined>" href="#generic-reader-closed"><c- g>closed</c-></a>; <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise"><c- b>Promise</c-></a><<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined"><c- b>undefined</c-></a>> <a class="idl-code" data-link-type="method" href="#generic-reader-cancel"><c- g>cancel</c-></a>(<c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any"><c- b>any</c-></a> <a href="#dom-readablestreamgenericreader-cancel-reason-reason"><code><c- g>reason</c-></code></a>); }; [Exposed=*] <c- b>interface</c-> <a href="#readablestreamdefaultreader"><code><c- g>ReadableStreamDefaultReader</c-></code></a> { <a class="idl-code" data-link-type="constructor" href="#default-reader-constructor"><c- g>constructor</c-></a>(<a data-link-type="idl-name" href="#readablestream"><c- n>ReadableStream</c-></a> <a href="#dom-readablestreamdefaultreader-readablestreamdefaultreader-stream-stream"><code><c- g>stream</c-></code></a>); <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise"><c- b>Promise</c-></a><<a data-link-type="idl-name" href="#dictdef-readablestreamreadresult"><c- n>ReadableStreamReadResult</c-></a>> <a class="idl-code" data-link-type="method" href="#default-reader-read"><c- g>read</c-></a>(); <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined"><c- b>undefined</c-></a> <a class="idl-code" data-link-type="method" href="#default-reader-release-lock"><c- g>releaseLock</c-></a>(); }; <a data-link-type="idl-name" href="#readablestreamdefaultreader"><c- n>ReadableStreamDefaultReader</c-></a> <c- b>includes</c-> <a data-link-type="idl-name" href="#readablestreamgenericreader"><c- n>ReadableStreamGenericReader</c-></a>; <c- b>dictionary</c-> <a href="#dictdef-readablestreamreadresult"><code><c- g>ReadableStreamReadResult</c-></code></a> { <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any"><c- b>any</c-></a> <a data-type="any" href="#dom-readablestreamreadresult-value"><code><c- g>value</c-></code></a>; <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-boolean"><c- b>boolean</c-></a> <a data-type="boolean" href="#dom-readablestreamreadresult-done"><code><c- g>done</c-></code></a>; }; [Exposed=*] <c- b>interface</c-> <a href="#readablestreambyobreader"><code><c- g>ReadableStreamBYOBReader</c-></code></a> { <a class="idl-code" data-link-type="constructor" href="#byob-reader-constructor"><c- g>constructor</c-></a>(<a data-link-type="idl-name" href="#readablestream"><c- n>ReadableStream</c-></a> <a href="#dom-readablestreambyobreader-readablestreambyobreader-stream-stream"><code><c- g>stream</c-></code></a>); <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise"><c- b>Promise</c-></a><<a data-link-type="idl-name" href="#dictdef-readablestreamreadresult"><c- n>ReadableStreamReadResult</c-></a>> <a class="idl-code" data-link-type="method" href="#byob-reader-read"><c- g>read</c-></a>(<a data-link-type="idl-name" href="https://webidl.spec.whatwg.org/#ArrayBufferView"><c- n>ArrayBufferView</c-></a> <a href="#dom-readablestreambyobreader-read-view-options-view"><code><c- g>view</c-></code></a>, <c- b>optional</c-> <a data-link-type="idl-name" href="#dictdef-readablestreambyobreaderreadoptions"><c- n>ReadableStreamBYOBReaderReadOptions</c-></a> <a href="#dom-readablestreambyobreader-read-view-options-options"><code><c- g>options</c-></code></a> = {}); <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined"><c- b>undefined</c-></a> <a class="idl-code" data-link-type="method" href="#byob-reader-release-lock"><c- g>releaseLock</c-></a>(); }; <a data-link-type="idl-name" href="#readablestreambyobreader"><c- n>ReadableStreamBYOBReader</c-></a> <c- b>includes</c-> <a data-link-type="idl-name" href="#readablestreamgenericreader"><c- n>ReadableStreamGenericReader</c-></a>; <c- b>dictionary</c-> <a href="#dictdef-readablestreambyobreaderreadoptions"><code><c- g>ReadableStreamBYOBReaderReadOptions</c-></code></a> { [<a class="idl-code" data-link-type="extended-attribute" href="https://webidl.spec.whatwg.org/#EnforceRange"><c- g>EnforceRange</c-></a>] <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-unsigned-long-long"><c- b>unsigned</c-> <c- b>long</c-> <c- b>long</c-></a> <a data-default="1" data-type="unsigned long long" href="#dom-readablestreambyobreaderreadoptions-min"><code><c- g>min</c-></code></a> = 1; }; [Exposed=*] <c- b>interface</c-> <a href="#readablestreamdefaultcontroller"><code><c- g>ReadableStreamDefaultController</c-></code></a> { <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-unrestricted-double"><c- b>unrestricted</c-> <c- b>double</c-></a>? <a class="idl-code" data-link-type="attribute" data-readonly data-type="unrestricted double?" href="#rs-default-controller-desired-size"><c- g>desiredSize</c-></a>; <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined"><c- b>undefined</c-></a> <a class="idl-code" data-link-type="method" href="#rs-default-controller-close"><c- g>close</c-></a>(); <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined"><c- b>undefined</c-></a> <a class="idl-code" data-link-type="method" href="#rs-default-controller-enqueue"><c- g>enqueue</c-></a>(<c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any"><c- b>any</c-></a> <a href="#dom-readablestreamdefaultcontroller-enqueue-chunk-chunk"><code><c- g>chunk</c-></code></a>); <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined"><c- b>undefined</c-></a> <a class="idl-code" data-link-type="method" href="#rs-default-controller-error"><c- g>error</c-></a>(<c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any"><c- b>any</c-></a> <a href="#dom-readablestreamdefaultcontroller-error-e-e"><code><c- g>e</c-></code></a>); }; [Exposed=*] <c- b>interface</c-> <a href="#readablebytestreamcontroller"><code><c- g>ReadableByteStreamController</c-></code></a> { <c- b>readonly</c-> <c- b>attribute</c-> <a data-link-type="idl-name" href="#readablestreambyobrequest"><c- n>ReadableStreamBYOBRequest</c-></a>? <a class="idl-code" data-link-type="attribute" data-readonly data-type="ReadableStreamBYOBRequest?" href="#rbs-controller-byob-request"><c- g>byobRequest</c-></a>; <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-unrestricted-double"><c- b>unrestricted</c-> <c- b>double</c-></a>? <a class="idl-code" data-link-type="attribute" data-readonly data-type="unrestricted double?" href="#rbs-controller-desired-size"><c- g>desiredSize</c-></a>; <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined"><c- b>undefined</c-></a> <a class="idl-code" data-link-type="method" href="#rbs-controller-close"><c- g>close</c-></a>(); <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined"><c- b>undefined</c-></a> <a class="idl-code" data-link-type="method" href="#rbs-controller-enqueue"><c- g>enqueue</c-></a>(<a data-link-type="idl-name" href="https://webidl.spec.whatwg.org/#ArrayBufferView"><c- n>ArrayBufferView</c-></a> <a href="#dom-readablebytestreamcontroller-enqueue-chunk-chunk"><code><c- g>chunk</c-></code></a>); <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined"><c- b>undefined</c-></a> <a class="idl-code" data-link-type="method" href="#rbs-controller-error"><c- g>error</c-></a>(<c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any"><c- b>any</c-></a> <a href="#dom-readablebytestreamcontroller-error-e-e"><code><c- g>e</c-></code></a>); }; [Exposed=*] <c- b>interface</c-> <a href="#readablestreambyobrequest"><code><c- g>ReadableStreamBYOBRequest</c-></code></a> { <c- b>readonly</c-> <c- b>attribute</c-> <a data-link-type="idl-name" href="https://webidl.spec.whatwg.org/#ArrayBufferView"><c- n>ArrayBufferView</c-></a>? <a class="idl-code" data-link-type="attribute" data-readonly data-type="ArrayBufferView?" href="#rs-byob-request-view"><c- g>view</c-></a>; <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined"><c- b>undefined</c-></a> <a class="idl-code" data-link-type="method" href="#rs-byob-request-respond"><c- g>respond</c-></a>([<a class="idl-code" data-link-type="extended-attribute" href="https://webidl.spec.whatwg.org/#EnforceRange"><c- g>EnforceRange</c-></a>] <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-unsigned-long-long"><c- b>unsigned</c-> <c- b>long</c-> <c- b>long</c-></a> <a href="#dom-readablestreambyobrequest-respond-byteswritten-byteswritten"><code><c- g>bytesWritten</c-></code></a>); <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined"><c- b>undefined</c-></a> <a class="idl-code" data-link-type="method" href="#rs-byob-request-respond-with-new-view"><c- g>respondWithNewView</c-></a>(<a data-link-type="idl-name" href="https://webidl.spec.whatwg.org/#ArrayBufferView"><c- n>ArrayBufferView</c-></a> <a href="#dom-readablestreambyobrequest-respondwithnewview-view-view"><code><c- g>view</c-></code></a>); }; [Exposed=*, <a class="idl-code" data-link-type="extended-attribute" href="https://html.spec.whatwg.org/multipage/structured-data.html#transferable"><c- g>Transferable</c-></a>] <c- b>interface</c-> <a href="#writablestream"><code><c- g>WritableStream</c-></code></a> { <a class="idl-code" data-link-type="constructor" href="#ws-constructor"><c- g>constructor</c-></a>(<c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-object"><c- b>object</c-></a> <a href="#dom-writablestream-writablestream-underlyingsink-strategy-underlyingsink"><code><c- g>underlyingSink</c-></code></a>, <c- b>optional</c-> <a data-link-type="idl-name" href="#dictdef-queuingstrategy"><c- n>QueuingStrategy</c-></a> <a href="#dom-writablestream-writablestream-underlyingsink-strategy-strategy"><code><c- g>strategy</c-></code></a> = {}); <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-boolean"><c- b>boolean</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="boolean" href="#ws-locked"><c- g>locked</c-></a>; <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise"><c- b>Promise</c-></a><<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined"><c- b>undefined</c-></a>> <a class="idl-code" data-link-type="method" href="#ws-abort"><c- g>abort</c-></a>(<c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any"><c- b>any</c-></a> <a href="#dom-writablestream-abort-reason-reason"><code><c- g>reason</c-></code></a>); <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise"><c- b>Promise</c-></a><<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined"><c- b>undefined</c-></a>> <a class="idl-code" data-link-type="method" href="#ws-close"><c- g>close</c-></a>(); <a data-link-type="idl-name" href="#writablestreamdefaultwriter"><c- n>WritableStreamDefaultWriter</c-></a> <a class="idl-code" data-link-type="method" href="#ws-get-writer"><c- g>getWriter</c-></a>(); }; <c- b>dictionary</c-> <a href="#dictdef-underlyingsink"><code><c- g>UnderlyingSink</c-></code></a> { <a data-link-type="idl-name" href="#callbackdef-underlyingsinkstartcallback"><c- n>UnderlyingSinkStartCallback</c-></a> <a class="idl-code" data-link-type="dict-member" data-type="UnderlyingSinkStartCallback" href="#dom-underlyingsink-start"><c- g>start</c-></a>; <a data-link-type="idl-name" href="#callbackdef-underlyingsinkwritecallback"><c- n>UnderlyingSinkWriteCallback</c-></a> <a class="idl-code" data-link-type="dict-member" data-type="UnderlyingSinkWriteCallback" href="#dom-underlyingsink-write"><c- g>write</c-></a>; <a data-link-type="idl-name" href="#callbackdef-underlyingsinkclosecallback"><c- n>UnderlyingSinkCloseCallback</c-></a> <a class="idl-code" data-link-type="dict-member" data-type="UnderlyingSinkCloseCallback" href="#dom-underlyingsink-close"><c- g>close</c-></a>; <a data-link-type="idl-name" href="#callbackdef-underlyingsinkabortcallback"><c- n>UnderlyingSinkAbortCallback</c-></a> <a class="idl-code" data-link-type="dict-member" data-type="UnderlyingSinkAbortCallback" href="#dom-underlyingsink-abort"><c- g>abort</c-></a>; <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any"><c- b>any</c-></a> <a class="idl-code" data-link-type="dict-member" data-type="any" href="#dom-underlyingsink-type"><c- g>type</c-></a>; }; <c- b>callback</c-> <a href="#callbackdef-underlyingsinkstartcallback"><code><c- g>UnderlyingSinkStartCallback</c-></code></a> = <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any"><c- b>any</c-></a> (<a data-link-type="idl-name" href="#writablestreamdefaultcontroller"><c- n>WritableStreamDefaultController</c-></a> <a href="#dom-underlyingsinkstartcallback-controller"><code><c- g>controller</c-></code></a>); <c- b>callback</c-> <a href="#callbackdef-underlyingsinkwritecallback"><code><c- g>UnderlyingSinkWriteCallback</c-></code></a> = <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise"><c- b>Promise</c-></a><<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined"><c- b>undefined</c-></a>> (<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any"><c- b>any</c-></a> <a href="#dom-underlyingsinkwritecallback-chunk"><code><c- g>chunk</c-></code></a>, <a data-link-type="idl-name" href="#writablestreamdefaultcontroller"><c- n>WritableStreamDefaultController</c-></a> <a href="#dom-underlyingsinkwritecallback-controller"><code><c- g>controller</c-></code></a>); <c- b>callback</c-> <a href="#callbackdef-underlyingsinkclosecallback"><code><c- g>UnderlyingSinkCloseCallback</c-></code></a> = <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise"><c- b>Promise</c-></a><<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined"><c- b>undefined</c-></a>> (); <c- b>callback</c-> <a href="#callbackdef-underlyingsinkabortcallback"><code><c- g>UnderlyingSinkAbortCallback</c-></code></a> = <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise"><c- b>Promise</c-></a><<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined"><c- b>undefined</c-></a>> (<c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any"><c- b>any</c-></a> <a href="#dom-underlyingsinkabortcallback-reason"><code><c- g>reason</c-></code></a>); [Exposed=*] <c- b>interface</c-> <a href="#writablestreamdefaultwriter"><code><c- g>WritableStreamDefaultWriter</c-></code></a> { <a class="idl-code" data-link-type="constructor" href="#default-writer-constructor"><c- g>constructor</c-></a>(<a data-link-type="idl-name" href="#writablestream"><c- n>WritableStream</c-></a> <a href="#dom-writablestreamdefaultwriter-writablestreamdefaultwriter-stream-stream"><code><c- g>stream</c-></code></a>); <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise"><c- b>Promise</c-></a><<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined"><c- b>undefined</c-></a>> <a class="idl-code" data-link-type="attribute" data-readonly data-type="Promise<undefined>" href="#default-writer-closed"><c- g>closed</c-></a>; <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-unrestricted-double"><c- b>unrestricted</c-> <c- b>double</c-></a>? <a class="idl-code" data-link-type="attribute" data-readonly data-type="unrestricted double?" href="#default-writer-desired-size"><c- g>desiredSize</c-></a>; <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise"><c- b>Promise</c-></a><<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined"><c- b>undefined</c-></a>> <a class="idl-code" data-link-type="attribute" data-readonly data-type="Promise<undefined>" href="#default-writer-ready"><c- g>ready</c-></a>; <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise"><c- b>Promise</c-></a><<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined"><c- b>undefined</c-></a>> <a class="idl-code" data-link-type="method" href="#default-writer-abort"><c- g>abort</c-></a>(<c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any"><c- b>any</c-></a> <a href="#dom-writablestreamdefaultwriter-abort-reason-reason"><code><c- g>reason</c-></code></a>); <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise"><c- b>Promise</c-></a><<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined"><c- b>undefined</c-></a>> <a class="idl-code" data-link-type="method" href="#default-writer-close"><c- g>close</c-></a>(); <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined"><c- b>undefined</c-></a> <a class="idl-code" data-link-type="method" href="#default-writer-release-lock"><c- g>releaseLock</c-></a>(); <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise"><c- b>Promise</c-></a><<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined"><c- b>undefined</c-></a>> <a class="idl-code" data-link-type="method" href="#default-writer-write"><c- g>write</c-></a>(<c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any"><c- b>any</c-></a> <a href="#dom-writablestreamdefaultwriter-write-chunk-chunk"><code><c- g>chunk</c-></code></a>); }; [Exposed=*] <c- b>interface</c-> <a href="#writablestreamdefaultcontroller"><code><c- g>WritableStreamDefaultController</c-></code></a> { <c- b>readonly</c-> <c- b>attribute</c-> <a data-link-type="idl-name" href="https://dom.spec.whatwg.org/#abortsignal"><c- n>AbortSignal</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="AbortSignal" href="#ws-default-controller-signal"><c- g>signal</c-></a>; <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined"><c- b>undefined</c-></a> <a class="idl-code" data-link-type="method" href="#ws-default-controller-error"><c- g>error</c-></a>(<c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any"><c- b>any</c-></a> <a href="#dom-writablestreamdefaultcontroller-error-e-e"><code><c- g>e</c-></code></a>); }; [Exposed=*, <a class="idl-code" data-link-type="extended-attribute" href="https://html.spec.whatwg.org/multipage/structured-data.html#transferable"><c- g>Transferable</c-></a>] <c- b>interface</c-> <a href="#transformstream"><code><c- g>TransformStream</c-></code></a> { <a class="idl-code" data-link-type="constructor" href="#ts-constructor"><c- g>constructor</c-></a>(<c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-object"><c- b>object</c-></a> <a href="#dom-transformstream-transformstream-transformer-writablestrategy-readablestrategy-transformer"><code><c- g>transformer</c-></code></a>, <c- b>optional</c-> <a data-link-type="idl-name" href="#dictdef-queuingstrategy"><c- n>QueuingStrategy</c-></a> <a href="#dom-transformstream-transformstream-transformer-writablestrategy-readablestrategy-writablestrategy"><code><c- g>writableStrategy</c-></code></a> = {}, <c- b>optional</c-> <a data-link-type="idl-name" href="#dictdef-queuingstrategy"><c- n>QueuingStrategy</c-></a> <a href="#dom-transformstream-transformstream-transformer-writablestrategy-readablestrategy-readablestrategy"><code><c- g>readableStrategy</c-></code></a> = {}); <c- b>readonly</c-> <c- b>attribute</c-> <a data-link-type="idl-name" href="#readablestream"><c- n>ReadableStream</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="ReadableStream" href="#ts-readable"><c- g>readable</c-></a>; <c- b>readonly</c-> <c- b>attribute</c-> <a data-link-type="idl-name" href="#writablestream"><c- n>WritableStream</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="WritableStream" href="#ts-writable"><c- g>writable</c-></a>; }; <c- b>dictionary</c-> <a href="#dictdef-transformer"><code><c- g>Transformer</c-></code></a> { <a data-link-type="idl-name" href="#callbackdef-transformerstartcallback"><c- n>TransformerStartCallback</c-></a> <a class="idl-code" data-link-type="dict-member" data-type="TransformerStartCallback" href="#dom-transformer-start"><c- g>start</c-></a>; <a data-link-type="idl-name" href="#callbackdef-transformertransformcallback"><c- n>TransformerTransformCallback</c-></a> <a class="idl-code" data-link-type="dict-member" data-type="TransformerTransformCallback" href="#dom-transformer-transform"><c- g>transform</c-></a>; <a data-link-type="idl-name" href="#callbackdef-transformerflushcallback"><c- n>TransformerFlushCallback</c-></a> <a class="idl-code" data-link-type="dict-member" data-type="TransformerFlushCallback" href="#dom-transformer-flush"><c- g>flush</c-></a>; <a data-link-type="idl-name" href="#callbackdef-transformercancelcallback"><c- n>TransformerCancelCallback</c-></a> <a class="idl-code" data-link-type="dict-member" data-type="TransformerCancelCallback" href="#dom-transformer-cancel"><c- g>cancel</c-></a>; <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any"><c- b>any</c-></a> <a class="idl-code" data-link-type="dict-member" data-type="any" href="#dom-transformer-readabletype"><c- g>readableType</c-></a>; <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any"><c- b>any</c-></a> <a class="idl-code" data-link-type="dict-member" data-type="any" href="#dom-transformer-writabletype"><c- g>writableType</c-></a>; }; <c- b>callback</c-> <a href="#callbackdef-transformerstartcallback"><code><c- g>TransformerStartCallback</c-></code></a> = <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any"><c- b>any</c-></a> (<a data-link-type="idl-name" href="#transformstreamdefaultcontroller"><c- n>TransformStreamDefaultController</c-></a> <a href="#dom-transformerstartcallback-controller"><code><c- g>controller</c-></code></a>); <c- b>callback</c-> <a href="#callbackdef-transformerflushcallback"><code><c- g>TransformerFlushCallback</c-></code></a> = <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise"><c- b>Promise</c-></a><<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined"><c- b>undefined</c-></a>> (<a data-link-type="idl-name" href="#transformstreamdefaultcontroller"><c- n>TransformStreamDefaultController</c-></a> <a href="#dom-transformerflushcallback-controller"><code><c- g>controller</c-></code></a>); <c- b>callback</c-> <a href="#callbackdef-transformertransformcallback"><code><c- g>TransformerTransformCallback</c-></code></a> = <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise"><c- b>Promise</c-></a><<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined"><c- b>undefined</c-></a>> (<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any"><c- b>any</c-></a> <a href="#dom-transformertransformcallback-chunk"><code><c- g>chunk</c-></code></a>, <a data-link-type="idl-name" href="#transformstreamdefaultcontroller"><c- n>TransformStreamDefaultController</c-></a> <a href="#dom-transformertransformcallback-controller"><code><c- g>controller</c-></code></a>); <c- b>callback</c-> <a href="#callbackdef-transformercancelcallback"><code><c- g>TransformerCancelCallback</c-></code></a> = <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise"><c- b>Promise</c-></a><<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined"><c- b>undefined</c-></a>> (<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any"><c- b>any</c-></a> <a href="#dom-transformercancelcallback-reason"><code><c- g>reason</c-></code></a>); [Exposed=*] <c- b>interface</c-> <a href="#transformstreamdefaultcontroller"><code><c- g>TransformStreamDefaultController</c-></code></a> { <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-unrestricted-double"><c- b>unrestricted</c-> <c- b>double</c-></a>? <a class="idl-code" data-link-type="attribute" data-readonly data-type="unrestricted double?" href="#ts-default-controller-desired-size"><c- g>desiredSize</c-></a>; <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined"><c- b>undefined</c-></a> <a class="idl-code" data-link-type="method" href="#ts-default-controller-enqueue"><c- g>enqueue</c-></a>(<c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any"><c- b>any</c-></a> <a href="#dom-transformstreamdefaultcontroller-enqueue-chunk-chunk"><code><c- g>chunk</c-></code></a>); <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined"><c- b>undefined</c-></a> <a class="idl-code" data-link-type="method" href="#ts-default-controller-error"><c- g>error</c-></a>(<c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any"><c- b>any</c-></a> <a href="#dom-transformstreamdefaultcontroller-error-reason-reason"><code><c- g>reason</c-></code></a>); <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined"><c- b>undefined</c-></a> <a class="idl-code" data-link-type="method" href="#ts-default-controller-terminate"><c- g>terminate</c-></a>(); }; <c- b>dictionary</c-> <a href="#dictdef-queuingstrategy"><code><c- g>QueuingStrategy</c-></code></a> { <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-unrestricted-double"><c- b>unrestricted</c-> <c- b>double</c-></a> <a class="idl-code" data-link-type="dict-member" data-type="unrestricted double" href="#dom-queuingstrategy-highwatermark"><c- g>highWaterMark</c-></a>; <a data-link-type="idl-name" href="#callbackdef-queuingstrategysize"><c- n>QueuingStrategySize</c-></a> <a class="idl-code" data-link-type="dict-member" data-type="QueuingStrategySize" href="#dom-queuingstrategy-size"><c- g>size</c-></a>; }; <c- b>callback</c-> <a href="#callbackdef-queuingstrategysize"><code><c- g>QueuingStrategySize</c-></code></a> = <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-unrestricted-double"><c- b>unrestricted</c-> <c- b>double</c-></a> (<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-any"><c- b>any</c-></a> <a href="#dom-queuingstrategysize-chunk"><code><c- g>chunk</c-></code></a>); <c- b>dictionary</c-> <a href="#dictdef-queuingstrategyinit"><code><c- g>QueuingStrategyInit</c-></code></a> { <c- b>required</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-unrestricted-double"><c- b>unrestricted</c-> <c- b>double</c-></a> <a data-type="unrestricted double" href="#dom-queuingstrategyinit-highwatermark"><code><c- g>highWaterMark</c-></code></a>; }; [Exposed=*] <c- b>interface</c-> <a href="#bytelengthqueuingstrategy"><code><c- g>ByteLengthQueuingStrategy</c-></code></a> { <a class="idl-code" data-link-type="constructor" href="#blqs-constructor"><c- g>constructor</c-></a>(<a data-link-type="idl-name" href="#dictdef-queuingstrategyinit"><c- n>QueuingStrategyInit</c-></a> <a href="#dom-bytelengthqueuingstrategy-bytelengthqueuingstrategy-init-init"><code><c- g>init</c-></code></a>); <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-unrestricted-double"><c- b>unrestricted</c-> <c- b>double</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="unrestricted double" href="#blqs-high-water-mark"><c- g>highWaterMark</c-></a>; <c- b>readonly</c-> <c- b>attribute</c-> <a data-link-type="idl-name" href="https://webidl.spec.whatwg.org/#Function"><c- n>Function</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="Function" href="#blqs-size"><c- g>size</c-></a>; }; [Exposed=*] <c- b>interface</c-> <a href="#countqueuingstrategy"><code><c- g>CountQueuingStrategy</c-></code></a> { <a class="idl-code" data-link-type="constructor" href="#cqs-constructor"><c- g>constructor</c-></a>(<a data-link-type="idl-name" href="#dictdef-queuingstrategyinit"><c- n>QueuingStrategyInit</c-></a> <a href="#dom-countqueuingstrategy-countqueuingstrategy-init-init"><code><c- g>init</c-></code></a>); <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-unrestricted-double"><c- b>unrestricted</c-> <c- b>double</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="unrestricted double" href="#cqs-high-water-mark"><c- g>highWaterMark</c-></a>; <c- b>readonly</c-> <c- b>attribute</c-> <a data-link-type="idl-name" href="https://webidl.spec.whatwg.org/#Function"><c- n>Function</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="Function" href="#cqs-size"><c- g>size</c-></a>; }; <c- b>interface</c-> <c- b>mixin</c-> <a href="#generictransformstream"><code><c- g>GenericTransformStream</c-></code></a> { <c- b>readonly</c-> <c- b>attribute</c-> <a data-link-type="idl-name" href="#readablestream"><c- n>ReadableStream</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="ReadableStream" href="#dom-generictransformstream-readable"><c- g>readable</c-></a>; <c- b>readonly</c-> <c- b>attribute</c-> <a data-link-type="idl-name" href="#writablestream"><c- n>WritableStream</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="WritableStream" href="#dom-generictransformstream-writable"><c- g>writable</c-></a>; }; </pre> <details class="mdn-anno unpositioned" data-anno-for="blqs-constructor"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/ByteLengthQueuingStrategy/ByteLengthQueuingStrategy" title="The ByteLengthQueuingStrategy() constructor creates and returns a ByteLengthQueuingStrategy object instance.">ByteLengthQueuingStrategy/ByteLengthQueuingStrategy</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>65+</span></span><span class="safari yes"><span>Safari</span><span>10.1+</span></span><span class="chrome yes"><span>Chrome</span><span>52+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>16+</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-blqs-high-water-mark①"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/ByteLengthQueuingStrategy/highWaterMark" title="The read-only ByteLengthQueuingStrategy.highWaterMark property returns the total number of bytes that can be contained in the internal queue before backpressure is applied.">ByteLengthQueuingStrategy/highWaterMark</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>65+</span></span><span class="safari yes"><span>Safari</span><span>10.1+</span></span><span class="chrome yes"><span>Chrome</span><span>52+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>16+</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="blqs-size"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/ByteLengthQueuingStrategy/size" title="The size() method of the ByteLengthQueuingStrategy interface returns the given chunk's byteLength property.">ByteLengthQueuingStrategy/size</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>65+</span></span><span class="safari yes"><span>Safari</span><span>10.1+</span></span><span class="chrome yes"><span>Chrome</span><span>52+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>16+</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="blqs-class"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/ByteLengthQueuingStrategy" title="The ByteLengthQueuingStrategy interface of the Streams API provides a built-in byte length queuing strategy that can be used when constructing streams.">ByteLengthQueuingStrategy</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>65+</span></span><span class="safari yes"><span>Safari</span><span>10.1+</span></span><span class="chrome yes"><span>Chrome</span><span>52+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>16+</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>18.0.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="dom-generictransformstream-readable"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/CompressionStream/readable" title="The readable read-only property of the CompressionStream interface returns a ReadableStream.">CompressionStream/readable</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>113+</span></span><span class="safari yes"><span>Safari</span><span>16.4+</span></span><span class="chrome yes"><span>Chrome</span><span>80+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>80+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>17.0.0+</span></span> </div> </div> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/DecompressionStream/readable" title="The readable read-only property of the DecompressionStream interface returns a ReadableStream.">DecompressionStream/readable</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>113+</span></span><span class="safari yes"><span>Safari</span><span>16.4+</span></span><span class="chrome yes"><span>Chrome</span><span>80+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>80+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>17.0.0+</span></span> </div> </div> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/TextDecoderStream/readable" title="The readable read-only property of the TextDecoderStream interface returns a ReadableStream.">TextDecoderStream/readable</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>105+</span></span><span class="safari yes"><span>Safari</span><span>14.1+</span></span><span class="chrome yes"><span>Chrome</span><span>71+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.6.0+</span></span> </div> </div> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/TextEncoderStream/readable" title="The readable read-only property of the TextEncoderStream interface returns a ReadableStream.">TextEncoderStream/readable</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>105+</span></span><span class="safari yes"><span>Safari</span><span>14.1+</span></span><span class="chrome yes"><span>Chrome</span><span>71+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.6.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="dom-generictransformstream-writable"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/CompressionStream/writable" title="The writable read-only property of the CompressionStream interface returns a WritableStream.">CompressionStream/writable</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>113+</span></span><span class="safari yes"><span>Safari</span><span>16.4+</span></span><span class="chrome yes"><span>Chrome</span><span>80+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>80+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>17.0.0+</span></span> </div> </div> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/DecompressionStream/writable" title="The writable read-only property of the DecompressionStream interface returns a WritableStream.">DecompressionStream/writable</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>113+</span></span><span class="safari yes"><span>Safari</span><span>16.4+</span></span><span class="chrome yes"><span>Chrome</span><span>80+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>80+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>17.0.0+</span></span> </div> </div> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/TextDecoderStream/writable" title="The writable read-only property of the TextDecoderStream interface returns a WritableStream.">TextDecoderStream/writable</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>105+</span></span><span class="safari yes"><span>Safari</span><span>14.1+</span></span><span class="chrome yes"><span>Chrome</span><span>71+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.6.0+</span></span> </div> </div> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/TextEncoderStream/writable" title="The writable read-only property of the TextEncoderStream interface returns a WritableStream.">TextEncoderStream/writable</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>105+</span></span><span class="safari yes"><span>Safari</span><span>14.1+</span></span><span class="chrome yes"><span>Chrome</span><span>71+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.6.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-cqs-constructor①"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/CountQueuingStrategy/CountQueuingStrategy" title="The CountQueuingStrategy() constructor creates and returns a CountQueuingStrategy object instance.">CountQueuingStrategy/CountQueuingStrategy</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>65+</span></span><span class="safari yes"><span>Safari</span><span>10.1+</span></span><span class="chrome yes"><span>Chrome</span><span>52+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>16+</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-cqs-high-water-mark①"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/CountQueuingStrategy/highWaterMark" title="The read-only CountQueuingStrategy.highWaterMark property returns the total number of chunks that can be contained in the internal queue before backpressure is applied.">CountQueuingStrategy/highWaterMark</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>65+</span></span><span class="safari yes"><span>Safari</span><span>10.1+</span></span><span class="chrome yes"><span>Chrome</span><span>52+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>16+</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-cqs-size②"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/CountQueuingStrategy/size" title="The size() method of the CountQueuingStrategy interface always returns 1, so that the total queue size is a count of the number of chunks in the queue.">CountQueuingStrategy/size</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>65+</span></span><span class="safari yes"><span>Safari</span><span>10.1+</span></span><span class="chrome yes"><span>Chrome</span><span>52+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>16+</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="cqs-class"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/CountQueuingStrategy" title="The CountQueuingStrategy interface of the Streams API provides a built-in chunk counting queuing strategy that can be used when constructing streams.">CountQueuingStrategy</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>65+</span></span><span class="safari yes"><span>Safari</span><span>10.1+</span></span><span class="chrome yes"><span>Chrome</span><span>52+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>16+</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>18.0.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-rbs-controller-byob-request②"> <summary><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/ReadableByteStreamController/byobRequest" title="The byobRequest read-only property of the ReadableByteStreamController interface returns the current BYOB request, or null if there are no pending requests.">ReadableByteStreamController/byobRequest</a></p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>102+</span></span><span class="safari no"><span>Safari</span><span>None</span></span><span class="chrome yes"><span>Chrome</span><span>89+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>89+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-rbs-controller-close①"> <summary><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/ReadableByteStreamController/close" title="The close() method of the ReadableByteStreamController interface closes the associated stream.">ReadableByteStreamController/close</a></p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>102+</span></span><span class="safari no"><span>Safari</span><span>None</span></span><span class="chrome yes"><span>Chrome</span><span>89+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>89+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-rbs-controller-desired-size②"> <summary><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/ReadableByteStreamController/desiredSize" title="The desiredSize read-only property of the ReadableByteStreamController interface returns the number of bytes required to fill the stream's internal queue to its "desired size".">ReadableByteStreamController/desiredSize</a></p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>102+</span></span><span class="safari no"><span>Safari</span><span>None</span></span><span class="chrome yes"><span>Chrome</span><span>89+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>89+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-rbs-controller-enqueue①"> <summary><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/ReadableByteStreamController/enqueue" title="The enqueue() method of the ReadableByteStreamController interface enqueues a given chunk on the associated readable byte stream (the chunk is copied into the stream's internal queues).">ReadableByteStreamController/enqueue</a></p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>102+</span></span><span class="safari no"><span>Safari</span><span>None</span></span><span class="chrome yes"><span>Chrome</span><span>89+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>89+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-rbs-controller-error①"> <summary><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/ReadableByteStreamController/error" title="The error() method of the ReadableByteStreamController interface causes any future interactions with the associated stream to error with the specified reason.">ReadableByteStreamController/error</a></p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>102+</span></span><span class="safari no"><span>Safari</span><span>None</span></span><span class="chrome yes"><span>Chrome</span><span>89+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>89+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="rbs-controller-class"> <summary><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/ReadableByteStreamController" title="The ReadableByteStreamController interface of the Streams API represents a controller for a readable byte stream. It allows control of the state and internal queue of a ReadableStream with an underlying byte source, and enables efficient zero-copy transfer of data from the underlying source to a consumer when the stream's internal queue is empty.">ReadableByteStreamController</a></p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>102+</span></span><span class="safari no"><span>Safari</span><span>None</span></span><span class="chrome yes"><span>Chrome</span><span>89+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>89+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>18.0.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-rs-constructor⑤"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/ReadableStream" title="The ReadableStream() constructor creates and returns a readable stream object from the given handlers.">ReadableStream/ReadableStream</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>65+</span></span><span class="safari yes"><span>Safari</span><span>10.1+</span></span><span class="chrome yes"><span>Chrome</span><span>52+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-rs-cancel③"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/cancel" title="The cancel() method of the ReadableStream interface returns a Promise that resolves when the stream is canceled.">ReadableStream/cancel</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>65+</span></span><span class="safari yes"><span>Safari</span><span>10.1+</span></span><span class="chrome yes"><span>Chrome</span><span>43+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>14+</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-rs-get-reader⑤"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/getReader" title="The getReader() method of the ReadableStream interface creates a reader and locks the stream to it. While the stream is locked, no other reader can be acquired until this one is released.">ReadableStream/getReader</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>65+</span></span><span class="safari yes"><span>Safari</span><span>10.1+</span></span><span class="chrome yes"><span>Chrome</span><span>43+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>14+</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-rs-locked②"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/locked" title="The locked read-only property of the ReadableStream interface returns whether or not the readable stream is locked to a reader.">ReadableStream/locked</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>65+</span></span><span class="safari yes"><span>Safari</span><span>10.1+</span></span><span class="chrome yes"><span>Chrome</span><span>52+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>14+</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-rs-pipe-through②"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/pipeThrough" title="The pipeThrough() method of the ReadableStream interface provides a chainable way of piping the current stream through a transform stream or any other writable/readable pair.">ReadableStream/pipeThrough</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>102+</span></span><span class="safari yes"><span>Safari</span><span>10.1+</span></span><span class="chrome yes"><span>Chrome</span><span>59+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-rs-pipe-to④"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/pipeTo" title="The pipeTo() method of the ReadableStream interface pipes the current ReadableStream to a given WritableStream and returns a Promise that fulfills when the piping process completes successfully, or rejects if any errors were encountered.">ReadableStream/pipeTo</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>100+</span></span><span class="safari yes"><span>Safari</span><span>10.1+</span></span><span class="chrome yes"><span>Chrome</span><span>59+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-rs-tee②"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/tee" title="The tee() method of the ReadableStream interface tees the current readable stream, returning a two-element array containing the two resulting branches as new ReadableStream instances.">ReadableStream/tee</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>65+</span></span><span class="safari yes"><span>Safari</span><span>10.1+</span></span><span class="chrome yes"><span>Chrome</span><span>52+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="rs-transfer"> <summary><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/https://developer.mozilla.org/en-US/docs/Glossary/Transferable_objects" title="Transferable objects are objects that own resources that can be transferred from one context to another, ensuring that the resources are only available in one context at a time. Following a transfer, the original object is no longer usable; it no longer points to the transferred resource, and any attempt to read or write the object will throw an exception.">/developer.mozilla.org/en-US/docs/Glossary/Transferable_objects</a></p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>103+</span></span><span class="safari no"><span>Safari</span><span>None</span></span><span class="chrome yes"><span>Chrome</span><span>87+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>87+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs no"><span>Node.js</span><span>None</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="rs-asynciterator"> <summary><b class="less-than-two-engines-flag" title="This feature is in less than two current engines.">⚠</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/asyncIterator" title="The Symbol.asyncIterator static data property represents the well-known symbol @@asyncIterator. The async iterable protocol looks up this symbol for the method that returns the async iterator for an object. In order for an object to be async iterable, it must have an @@asyncIterator key.">Reference/Global_Objects/Symbol/asyncIterator</a></p> <p class="less-than-two-engines-text">In only one current engine.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>110+</span></span><span class="safari no"><span>Safari</span><span>None</span></span><span class="chrome no"><span>Chrome</span><span>None</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink no"><span>Edge</span><span>None</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="rs-class"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream" title="The ReadableStream interface of the Streams API represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object.">ReadableStream</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>65+</span></span><span class="safari yes"><span>Safari</span><span>10.1+</span></span><span class="chrome yes"><span>Chrome</span><span>43+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>14+</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>18.0.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-byob-reader-constructor①"> <summary><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBReader/ReadableStreamBYOBReader" title="The ReadableStreamBYOBReader() constructor creates and returns a ReadableStreamBYOBReader object instance.">ReadableStreamBYOBReader/ReadableStreamBYOBReader</a></p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>102+</span></span><span class="safari no"><span>Safari</span><span>None</span></span><span class="chrome yes"><span>Chrome</span><span>89+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>89+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-generic-reader-cancel②"> <summary><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBReader/cancel" title="The cancel() method of the ReadableStreamBYOBReader interface returns a Promise that resolves when the stream is canceled. Calling this method signals a loss of interest in the stream by a consumer.">ReadableStreamBYOBReader/cancel</a></p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>102+</span></span><span class="safari no"><span>Safari</span><span>None</span></span><span class="chrome yes"><span>Chrome</span><span>89+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>89+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader/cancel" title="The cancel() method of the ReadableStreamDefaultReader interface returns a Promise that resolves when the stream is canceled. Calling this method signals a loss of interest in the stream by a consumer.">ReadableStreamDefaultReader/cancel</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>65+</span></span><span class="safari yes"><span>Safari</span><span>13.1+</span></span><span class="chrome yes"><span>Chrome</span><span>78+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-generic-reader-closed②"> <summary><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBReader/closed" title="The closed read-only property of the ReadableStreamBYOBReader interface returns a Promise that fulfills when the stream closes, or rejects if the stream throws an error or the reader's lock is released.">ReadableStreamBYOBReader/closed</a></p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>102+</span></span><span class="safari no"><span>Safari</span><span>None</span></span><span class="chrome yes"><span>Chrome</span><span>89+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>89+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader/closed" title="The closed read-only property of the ReadableStreamDefaultReader interface returns a Promise that fulfills when the stream closes, or rejects if the stream throws an error or the reader's lock is released. This property enables you to write code that responds to an end to the streaming process.">ReadableStreamDefaultReader/closed</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>65+</span></span><span class="safari yes"><span>Safari</span><span>13.1+</span></span><span class="chrome yes"><span>Chrome</span><span>78+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-byob-reader-read③"> <summary><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBReader/read" title="The read() method of the ReadableStreamBYOBReader interface is used to read data into a view on a user-supplied buffer from an associated readable byte stream. A request for data will be satisfied from the stream's internal queues if there is any data present. If the stream queues are empty, the request may be supplied as a zero-copy transfer from the underlying byte source.">ReadableStreamBYOBReader/read</a></p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>102+</span></span><span class="safari no"><span>Safari</span><span>None</span></span><span class="chrome yes"><span>Chrome</span><span>89+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>89+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-byob-reader-release-lock②"> <summary><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBReader/releaseLock" title="The releaseLock() method of the ReadableStreamBYOBReader interface releases the reader's lock on the stream. After the lock is released, the reader is no longer active.">ReadableStreamBYOBReader/releaseLock</a></p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>102+</span></span><span class="safari no"><span>Safari</span><span>None</span></span><span class="chrome yes"><span>Chrome</span><span>89+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>89+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="byob-reader-class"> <summary><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBReader" title="The ReadableStreamBYOBReader interface of the Streams API defines a reader for a ReadableStream that supports zero-copy reading from an underlying byte source. It is used for efficient copying from underlying sources where the data is delivered as an "anonymous" sequence of bytes, such as files.">ReadableStreamBYOBReader</a></p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>102+</span></span><span class="safari no"><span>Safari</span><span>None</span></span><span class="chrome yes"><span>Chrome</span><span>89+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>89+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>18.0.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-rs-byob-request-respond①"> <summary><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBRequest/respond" title="The respond() method of the ReadableStreamBYOBRequest interface is used to signal to the associated readable byte stream that the specified number of bytes were written into the ReadableStreamBYOBRequest.view.">ReadableStreamBYOBRequest/respond</a></p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>102+</span></span><span class="safari no"><span>Safari</span><span>None</span></span><span class="chrome yes"><span>Chrome</span><span>89+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>89+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-rs-byob-request-respond-with-new-view①"> <summary><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBRequest/respondWithNewView" title="The respondWithNewView() method of the ReadableStreamBYOBRequest interface specifies a new view that the consumer of the associated readable byte stream should write to instead of ReadableStreamBYOBRequest.view.">ReadableStreamBYOBRequest/respondWithNewView</a></p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>102+</span></span><span class="safari no"><span>Safari</span><span>None</span></span><span class="chrome yes"><span>Chrome</span><span>89+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>89+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-rs-byob-request-view①"> <summary><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBRequest/view" title="The view getter property of the ReadableStreamBYOBRequest interface returns the current view.">ReadableStreamBYOBRequest/view</a></p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>102+</span></span><span class="safari no"><span>Safari</span><span>None</span></span><span class="chrome yes"><span>Chrome</span><span>89+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>89+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="rs-byob-request-class"> <summary><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBRequest" title="The ReadableStreamBYOBRequest interface of the Streams API represents a "pull request" for data from an underlying source that will made as a zero-copy transfer to a consumer (bypassing the stream's internal queues).">ReadableStreamBYOBRequest</a></p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>102+</span></span><span class="safari no"><span>Safari</span><span>None</span></span><span class="chrome yes"><span>Chrome</span><span>89+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>89+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>18.0.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-rs-default-controller-close①"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultController/close" title="The close() method of the ReadableStreamDefaultController interface closes the associated stream.">ReadableStreamDefaultController/close</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>65+</span></span><span class="safari yes"><span>Safari</span><span>13.1+</span></span><span class="chrome yes"><span>Chrome</span><span>80+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>80+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-rs-default-controller-desired-size②"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultController/desiredSize" title="The desiredSize read-only property of the ReadableStreamDefaultController interface returns the desired size required to fill the stream's internal queue.">ReadableStreamDefaultController/desiredSize</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>65+</span></span><span class="safari yes"><span>Safari</span><span>13.1+</span></span><span class="chrome yes"><span>Chrome</span><span>80+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>80+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-rs-default-controller-enqueue①"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultController/enqueue" title="The enqueue() method of the ReadableStreamDefaultController interface enqueues a given chunk in the associated stream.">ReadableStreamDefaultController/enqueue</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>65+</span></span><span class="safari yes"><span>Safari</span><span>13.1+</span></span><span class="chrome yes"><span>Chrome</span><span>80+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>80+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="rs-default-controller-error"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultController/error" title="The error() method of the ReadableStreamDefaultController interface causes any future interactions with the associated stream to error.">ReadableStreamDefaultController/error</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>65+</span></span><span class="safari yes"><span>Safari</span><span>13.1+</span></span><span class="chrome yes"><span>Chrome</span><span>80+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>80+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="rs-default-controller-class"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultController" title="The ReadableStreamDefaultController interface of the Streams API represents a controller allowing control of a ReadableStream's state and internal queue. Default controllers are for streams that are not byte streams.">ReadableStreamDefaultController</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>65+</span></span><span class="safari yes"><span>Safari</span><span>13.1+</span></span><span class="chrome yes"><span>Chrome</span><span>80+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>80+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>18.0.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-default-reader-constructor①"> <summary><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader/ReadableStreamDefaultReader" title="The ReadableStreamDefaultReader() constructor creates and returns a ReadableStreamDefaultReader object instance.">ReadableStreamDefaultReader/ReadableStreamDefaultReader</a></p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>100+</span></span><span class="safari no"><span>Safari</span><span>None</span></span><span class="chrome yes"><span>Chrome</span><span>78+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-default-reader-read①"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader/read" title="The read() method of the ReadableStreamDefaultReader interface returns a Promise providing access to the next chunk in the stream's internal queue.">ReadableStreamDefaultReader/read</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>65+</span></span><span class="safari yes"><span>Safari</span><span>13.1+</span></span><span class="chrome yes"><span>Chrome</span><span>78+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-default-reader-release-lock②"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader/releaseLock" title="The releaseLock() method of the ReadableStreamDefaultReader interface releases the reader's lock on the stream.">ReadableStreamDefaultReader/releaseLock</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>65+</span></span><span class="safari yes"><span>Safari</span><span>13.1+</span></span><span class="chrome yes"><span>Chrome</span><span>78+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="default-reader-class"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader" title="The ReadableStreamDefaultReader interface of the Streams API represents a default reader that can be used to read stream data supplied from a network (such as a fetch request).">ReadableStreamDefaultReader</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>65+</span></span><span class="safari yes"><span>Safari</span><span>13.1+</span></span><span class="chrome yes"><span>Chrome</span><span>78+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>18.0.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-ts-constructor④"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/TransformStream/TransformStream" title="The TransformStream() constructor creates a new TransformStream object which represents a pair of streams: a WritableStream representing the writable side, and a ReadableStream representing the readable side.">TransformStream/TransformStream</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>102+</span></span><span class="safari yes"><span>Safari</span><span>14.1+</span></span><span class="chrome yes"><span>Chrome</span><span>67+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-ts-readable②"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/TransformStream/readable" title="The readable read-only property of the TransformStream interface returns the ReadableStream instance controlled by this TransformStream.">TransformStream/readable</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>102+</span></span><span class="safari yes"><span>Safari</span><span>14.1+</span></span><span class="chrome yes"><span>Chrome</span><span>67+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ts-transfer"> <summary><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/https://developer.mozilla.org/en-US/docs/Glossary/Transferable_objects" title="Transferable objects are objects that own resources that can be transferred from one context to another, ensuring that the resources are only available in one context at a time. Following a transfer, the original object is no longer usable; it no longer points to the transferred resource, and any attempt to read or write the object will throw an exception.">/developer.mozilla.org/en-US/docs/Glossary/Transferable_objects</a></p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>103+</span></span><span class="safari no"><span>Safari</span><span>None</span></span><span class="chrome yes"><span>Chrome</span><span>87+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>87+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs no"><span>Node.js</span><span>None</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-ts-writable②"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/TransformStream/writable" title="The writable read-only property of the TransformStream interface returns the WritableStream instance controlled by this TransformStream.">TransformStream/writable</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>102+</span></span><span class="safari yes"><span>Safari</span><span>14.1+</span></span><span class="chrome yes"><span>Chrome</span><span>67+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ts-class"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/TransformStream" title="The TransformStream interface of the Streams API represents a concrete implementation of the pipe chain transform stream concept.">TransformStream</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>102+</span></span><span class="safari yes"><span>Safari</span><span>14.1+</span></span><span class="chrome yes"><span>Chrome</span><span>67+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>18.0.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ts-default-controller-desired-size"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/TransformStreamDefaultController/desiredSize" title="The desiredSize read-only property of the TransformStreamDefaultController interface returns the desired size to fill the queue of the associated ReadableStream.">TransformStreamDefaultController/desiredSize</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>102+</span></span><span class="safari yes"><span>Safari</span><span>14.1+</span></span><span class="chrome yes"><span>Chrome</span><span>67+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ts-default-controller-enqueue"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/TransformStreamDefaultController/enqueue" title="The enqueue() method of the TransformStreamDefaultController interface enqueues the given chunk in the readable side of the stream.">TransformStreamDefaultController/enqueue</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>102+</span></span><span class="safari yes"><span>Safari</span><span>14.1+</span></span><span class="chrome yes"><span>Chrome</span><span>67+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ts-default-controller-error"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/TransformStreamDefaultController/error" title="The error() method of the TransformStreamDefaultController interface errors both sides of the stream. Any further interactions with it will fail with the given error message, and any chunks in the queue will be discarded.">TransformStreamDefaultController/error</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>102+</span></span><span class="safari yes"><span>Safari</span><span>14.1+</span></span><span class="chrome yes"><span>Chrome</span><span>67+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ts-default-controller-terminate"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/TransformStreamDefaultController/terminate" title="The terminate() method of the TransformStreamDefaultController interface closes the readable side and errors the writable side of the stream.">TransformStreamDefaultController/terminate</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>102+</span></span><span class="safari yes"><span>Safari</span><span>14.1+</span></span><span class="chrome yes"><span>Chrome</span><span>67+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ts-default-controller-class"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/TransformStreamDefaultController" title="The TransformStreamDefaultController interface of the Streams API provides methods to manipulate the associated ReadableStream and WritableStream.">TransformStreamDefaultController</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>102+</span></span><span class="safari yes"><span>Safari</span><span>14.1+</span></span><span class="chrome yes"><span>Chrome</span><span>67+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-ws-constructor④"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/WritableStream/WritableStream" title="The WritableStream() constructor creates a new WritableStream object instance.">WritableStream/WritableStream</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>100+</span></span><span class="safari yes"><span>Safari</span><span>14.1+</span></span><span class="chrome yes"><span>Chrome</span><span>59+</span></span> <hr> <span class="opera yes"><span>Opera</span><span>47+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>16+</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Mobile</span><span>44+</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-ws-abort③"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/WritableStream/abort" title="The abort() method of the WritableStream interface aborts the stream, signaling that the producer can no longer successfully write to the stream and it is to be immediately moved to an error state, with any queued writes discarded.">WritableStream/abort</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>100+</span></span><span class="safari yes"><span>Safari</span><span>14.1+</span></span><span class="chrome yes"><span>Chrome</span><span>59+</span></span> <hr> <span class="opera yes"><span>Opera</span><span>47+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>16+</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Mobile</span><span>44+</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-ws-close①"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/WritableStream/close" title="The close() method of the WritableStream interface closes the associated stream. All chunks written before this method is called are sent before the returned promise is fulfilled.">WritableStream/close</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>100+</span></span><span class="safari yes"><span>Safari</span><span>14.1+</span></span><span class="chrome yes"><span>Chrome</span><span>81+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>81+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-ws-get-writer①"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/WritableStream/getWriter" title="The getWriter() method of the WritableStream interface returns a new instance of WritableStreamDefaultWriter and locks the stream to that instance. While the stream is locked, no other writer can be acquired until this one is released.">WritableStream/getWriter</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>100+</span></span><span class="safari yes"><span>Safari</span><span>14.1+</span></span><span class="chrome yes"><span>Chrome</span><span>59+</span></span> <hr> <span class="opera yes"><span>Opera</span><span>47+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>16+</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Mobile</span><span>44+</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-ws-locked②"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/WritableStream/locked" title="The locked read-only property of the WritableStream interface returns a boolean indicating whether the WritableStream is locked to a writer.">WritableStream/locked</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>100+</span></span><span class="safari yes"><span>Safari</span><span>14.1+</span></span><span class="chrome yes"><span>Chrome</span><span>59+</span></span> <hr> <span class="opera yes"><span>Opera</span><span>47+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>16+</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Mobile</span><span>44+</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ws-transfer"> <summary><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/https://developer.mozilla.org/en-US/docs/Glossary/Transferable_objects" title="Transferable objects are objects that own resources that can be transferred from one context to another, ensuring that the resources are only available in one context at a time. Following a transfer, the original object is no longer usable; it no longer points to the transferred resource, and any attempt to read or write the object will throw an exception.">/developer.mozilla.org/en-US/docs/Glossary/Transferable_objects</a></p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>103+</span></span><span class="safari no"><span>Safari</span><span>None</span></span><span class="chrome yes"><span>Chrome</span><span>87+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>87+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs no"><span>Node.js</span><span>None</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ws-class"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/WritableStream" title="The WritableStream interface of the Streams API provides a standard abstraction for writing streaming data to a destination, known as a sink. This object comes with built-in backpressure and queuing.">WritableStream</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>100+</span></span><span class="safari yes"><span>Safari</span><span>14.1+</span></span><span class="chrome yes"><span>Chrome</span><span>59+</span></span> <hr> <span class="opera yes"><span>Opera</span><span>47+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>16+</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Mobile</span><span>44+</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>18.0.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-ws-default-controller-error①"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultController/error" title="The error() method of the WritableStreamDefaultController interface causes any future interactions with the associated stream to error.">WritableStreamDefaultController/error</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>100+</span></span><span class="safari yes"><span>Safari</span><span>14.1+</span></span><span class="chrome yes"><span>Chrome</span><span>59+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>16+</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-ws-default-controller-signal①"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultController/signal" title="The read-only signal property of the WritableStreamDefaultController interface returns the AbortSignal associated with the controller.">WritableStreamDefaultController/signal</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>100+</span></span><span class="safari yes"><span>Safari</span><span>16.4+</span></span><span class="chrome yes"><span>Chrome</span><span>98+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>98+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ws-default-controller-class"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultController" title="The WritableStreamDefaultController interface of the Streams API represents a controller allowing control of a WritableStream's state. When constructing a WritableStream, the underlying sink is given a corresponding WritableStreamDefaultController instance to manipulate.">WritableStreamDefaultController</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>100+</span></span><span class="safari yes"><span>Safari</span><span>14.1+</span></span><span class="chrome yes"><span>Chrome</span><span>59+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>16+</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>18.0.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-default-writer-constructor①"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter/WritableStreamDefaultWriter" title="The WritableStreamDefaultWriter() constructor creates a new WritableStreamDefaultWriter object instance.">WritableStreamDefaultWriter/WritableStreamDefaultWriter</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>100+</span></span><span class="safari yes"><span>Safari</span><span>14.1+</span></span><span class="chrome yes"><span>Chrome</span><span>78+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-default-writer-abort④"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter/abort" title="The abort() method of the WritableStreamDefaultWriter interface aborts the stream, signaling that the producer can no longer successfully write to the stream and it is to be immediately moved to an error state, with any queued writes discarded.">WritableStreamDefaultWriter/abort</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>100+</span></span><span class="safari yes"><span>Safari</span><span>14.1+</span></span><span class="chrome yes"><span>Chrome</span><span>59+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>16+</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-default-writer-close⑦"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter/close" title="The close() method of the WritableStreamDefaultWriter interface closes the associated writable stream.">WritableStreamDefaultWriter/close</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>100+</span></span><span class="safari yes"><span>Safari</span><span>14.1+</span></span><span class="chrome yes"><span>Chrome</span><span>59+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>16+</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-default-writer-closed②"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter/closed" title="The closed read-only property of the WritableStreamDefaultWriter interface returns a Promise that fulfills if the stream becomes closed, or rejects if the stream errors or the writer's lock is released.">WritableStreamDefaultWriter/closed</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>100+</span></span><span class="safari yes"><span>Safari</span><span>14.1+</span></span><span class="chrome yes"><span>Chrome</span><span>59+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>16+</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-default-writer-desired-size⑥"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter/desiredSize" title="The desiredSize read-only property of the WritableStreamDefaultWriter interface returns the desired size required to fill the stream's internal queue.">WritableStreamDefaultWriter/desiredSize</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>100+</span></span><span class="safari yes"><span>Safari</span><span>14.1+</span></span><span class="chrome yes"><span>Chrome</span><span>59+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>16+</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-default-writer-ready⑨"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter/ready" title="The ready read-only property of the WritableStreamDefaultWriter interface returns a Promise that resolves when the desired size of the stream's internal queue transitions from non-positive to positive, signaling that it is no longer applying backpressure.">WritableStreamDefaultWriter/ready</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>100+</span></span><span class="safari yes"><span>Safari</span><span>14.1+</span></span><span class="chrome yes"><span>Chrome</span><span>59+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>16+</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-default-writer-release-lock②"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter/releaseLock" title="The releaseLock() method of the WritableStreamDefaultWriter interface releases the writer's lock on the corresponding stream. After the lock is released, the writer is no longer active. If the associated stream is errored when the lock is released, the writer will appear errored in the same way from now on; otherwise, the writer will appear closed.">WritableStreamDefaultWriter/releaseLock</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>100+</span></span><span class="safari yes"><span>Safari</span><span>14.1+</span></span><span class="chrome yes"><span>Chrome</span><span>59+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>16+</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-default-writer-write①②"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter/write" title="The write() method of the WritableStreamDefaultWriter interface writes a passed chunk of data to a WritableStream and its underlying sink, then returns a Promise that resolves to indicate the success or failure of the write operation.">WritableStreamDefaultWriter/write</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>100+</span></span><span class="safari yes"><span>Safari</span><span>14.1+</span></span><span class="chrome yes"><span>Chrome</span><span>59+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>16+</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.5.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="default-writer-class"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter" title="The WritableStreamDefaultWriter interface of the Streams API is the object returned by WritableStream.getWriter() and once created locks the writer to the WritableStream ensuring that no other streams can write to the underlying sink.">WritableStreamDefaultWriter</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>100+</span></span><span class="safari yes"><span>Safari</span><span>14.1+</span></span><span class="chrome yes"><span>Chrome</span><span>59+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>16+</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>18.0.0+</span></span> </div> </div> </details> <script>/* Boilerplate: script-dom-helper */ "use strict"; function query(sel) { return document.querySelector(sel); } function queryAll(sel) { return [...document.querySelectorAll(sel)]; } function iter(obj) { if(!obj) return []; var it = obj[Symbol.iterator]; if(it) return it; return Object.entries(obj); } function mk(tagname, attrs, ...children) { const el = document.createElement(tagname); for(const [k,v] of iter(attrs)) { if(k.slice(0,3) == "_on") { const eventName = k.slice(3); el.addEventListener(eventName, v); } else if(k[0] == "_") { // property, not attribute el[k.slice(1)] = v; } else { if(v === false || v == null) { continue; } else if(v === true) { el.setAttribute(k, ""); continue; } else { el.setAttribute(k, v); } } } append(el, children); return el; } /* Create shortcuts for every known HTML element */ [ "a", "abbr", "acronym", "address", "applet", "area", "article", "aside", "audio", "b", "base", "basefont", "bdo", "big", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "datalist", "dd", "del", "details", "dfn", "dialog", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "font", "footer", "form", "frame", "frameset", "head", "header", "h1", "h2", "h3", "h4", "h5", "h6", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "label", "legend", "li", "link", "main", "map", "mark", "meta", "meter", "nav", "nobr", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "pre", "progress", "q", "s", "samp", "script", "section", "select", "small", "source", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "u", "ul", "var", "video", "wbr", "xmp", ].forEach(tagname=>{ mk[tagname] = (...args) => mk(tagname, ...args); }); function* nodesFromChildList(children) { for(const child of children.flat(Infinity)) { if(child instanceof Node) { yield child; } else { yield new Text(child); } } } function append(el, ...children) { for(const child of nodesFromChildList(children)) { if(el instanceof Node) el.appendChild(child); else el.push(child); } return el; } function insertAfter(el, ...children) { for(const child of nodesFromChildList(children)) { el.parentNode.insertBefore(child, el.nextSibling); } return el; } function clearContents(el) { el.innerHTML = ""; return el; } function parseHTML(markup) { if(markup.toLowerCase().trim().indexOf('<!doctype') === 0) { const doc = document.implementation.createHTMLDocument(""); doc.documentElement.innerHTML = markup; return doc; } else { const el = mk.template({}); el.innerHTML = markup; return el.content; } }</script> <script>/* Boilerplate: script-dfn-panel */ "use strict"; { let dfnPanelData = { "0204d188": {"dfnID":"0204d188","dfnText":"size","external":true,"refSections":[{"refs":[{"id":"ref-for-list-size"},{"id":"ref-for-list-size\u2460"}],"title":"4.9.2. Interfacing with controllers"}],"url":"https://infra.spec.whatwg.org/#list-size"}, "03487a52": {"dfnID":"03487a52","dfnText":"IteratorComplete","external":true,"refSections":[{"refs":[{"id":"ref-for-sec-iteratorcomplete"}],"title":"4.9.1. Working with readable streams"}],"url":"https://tc39.es/ecma262/multipage/abstract-operations.html#sec-iteratorcomplete"}, "038c4c21": {"dfnID":"038c4c21","dfnText":"%DataView%","external":true,"refSections":[{"refs":[{"id":"ref-for-sec-dataview-constructor"}],"title":"4.7.2. Internal slots"},{"refs":[{"id":"ref-for-sec-dataview-constructor\u2460"}],"title":"4.9.5. Byte stream controllers"}],"url":"https://tc39.es/ecma262/multipage/structured-data.html#sec-dataview-constructor"}, "069eabcc": {"dfnID":"069eabcc","dfnText":"IteratorNext","external":true,"refSections":[{"refs":[{"id":"ref-for-sec-iteratornext"}],"title":"4.9.1. Working with readable streams"}],"url":"https://tc39.es/ecma262/multipage/abstract-operations.html#sec-iteratornext"}, "0800bdf4": {"dfnID":"0800bdf4","dfnText":"StructuredDeserialize","external":true,"refSections":[{"refs":[{"id":"ref-for-structureddeserialize"}],"title":"8.3. Miscellaneous"}],"url":"https://html.spec.whatwg.org/multipage/structured-data.html#structureddeserialize"}, "08a12aad": {"dfnID":"08a12aad","dfnText":"Response","external":true,"refSections":[{"refs":[{"id":"ref-for-response"}],"title":"1. Introduction"}],"url":"https://fetch.spec.whatwg.org/#response"}, "0a422d04": {"dfnID":"0a422d04","dfnText":"serializable object","external":true,"refSections":[{"refs":[{"id":"ref-for-serializable-objects"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-serializable-objects\u2460"}],"title":"9.1.2. Reading"}],"url":"https://html.spec.whatwg.org/multipage/structured-data.html#serializable-objects"}, "0fe84b59": {"dfnID":"0fe84b59","dfnText":"signal","external":true,"refSections":[{"refs":[{"id":"ref-for-abortcontroller-signal"}],"title":"5.4.3. Methods and properties"},{"refs":[{"id":"ref-for-abortcontroller-signal\u2460"}],"title":"9.2.1. Creation and manipulation"}],"url":"https://dom.spec.whatwg.org/#abortcontroller-signal"}, "1003edc0": {"dfnID":"1003edc0","dfnText":"detach","external":true,"refSections":[{"refs":[{"id":"ref-for-dfn-detach"},{"id":"ref-for-dfn-detach\u2460"}],"title":"4.5.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-dfn-detach\u2461"}],"title":"9.1.1. Creation and manipulation"}],"url":"https://webidl.spec.whatwg.org/#dfn-detach"}, "10ce5f6f": {"dfnID":"10ce5f6f","dfnText":"invoke","external":true,"refSections":[{"refs":[{"id":"ref-for-invoke-a-callback-function"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-invoke-a-callback-function\u2460"},{"id":"ref-for-invoke-a-callback-function\u2461"},{"id":"ref-for-invoke-a-callback-function\u2462"}],"title":"4.9.4. Default controllers"},{"refs":[{"id":"ref-for-invoke-a-callback-function\u2463"},{"id":"ref-for-invoke-a-callback-function\u2464"},{"id":"ref-for-invoke-a-callback-function\u2465"}],"title":"4.9.5. Byte stream controllers"},{"refs":[{"id":"ref-for-invoke-a-callback-function\u2466"}],"title":"5.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-invoke-a-callback-function\u2467"},{"id":"ref-for-invoke-a-callback-function\u2468"},{"id":"ref-for-invoke-a-callback-function\u2460\u24ea"},{"id":"ref-for-invoke-a-callback-function\u2460\u2460"}],"title":"5.5.4. Default controllers"},{"refs":[{"id":"ref-for-invoke-a-callback-function\u2460\u2461"},{"id":"ref-for-invoke-a-callback-function\u2460\u2462"}],"title":"6.2.4. Constructor and properties"},{"refs":[{"id":"ref-for-invoke-a-callback-function\u2460\u2463"}],"title":"6.3.2. Internal slots"},{"refs":[{"id":"ref-for-invoke-a-callback-function\u2460\u2464"},{"id":"ref-for-invoke-a-callback-function\u2460\u2465"},{"id":"ref-for-invoke-a-callback-function\u2460\u2466"}],"title":"6.4.2. Default controllers"},{"refs":[{"id":"ref-for-invoke-a-callback-function\u2460\u2467"}],"title":"7.4. Abstract operations"}],"url":"https://webidl.spec.whatwg.org/#invoke-a-callback-function"}, "116848ac": {"dfnID":"116848ac","dfnText":"reacting","external":true,"refSections":[{"refs":[{"id":"ref-for-dfn-perform-steps-once-promise-is-settled"},{"id":"ref-for-dfn-perform-steps-once-promise-is-settled\u2460"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-dfn-perform-steps-once-promise-is-settled\u2461"}],"title":"4.9.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-dfn-perform-steps-once-promise-is-settled\u2462"}],"title":"6.4.2. Default controllers"},{"refs":[{"id":"ref-for-dfn-perform-steps-once-promise-is-settled\u2463"},{"id":"ref-for-dfn-perform-steps-once-promise-is-settled\u2464"},{"id":"ref-for-dfn-perform-steps-once-promise-is-settled\u2465"}],"title":"6.4.3. Default sinks"},{"refs":[{"id":"ref-for-dfn-perform-steps-once-promise-is-settled\u2466"}],"title":"6.4.4. Default sources"},{"refs":[{"id":"ref-for-dfn-perform-steps-once-promise-is-settled\u2467"}],"title":"8.2. Transferable streams"}],"url":"https://webidl.spec.whatwg.org/#dfn-perform-steps-once-promise-is-settled"}, "11e0b87f": {"dfnID":"11e0b87f","dfnText":"unrestricted double","external":true,"refSections":[{"refs":[{"id":"ref-for-idl-unrestricted-double"}],"title":"3. Conventions"},{"refs":[{"id":"ref-for-idl-unrestricted-double\u2460"}],"title":"4.6.1. Interface definition"},{"refs":[{"id":"ref-for-idl-unrestricted-double\u2461"}],"title":"4.7.1. Interface definition"},{"refs":[{"id":"ref-for-idl-unrestricted-double\u2462"}],"title":"5.3.1. Interface definition"},{"refs":[{"id":"ref-for-idl-unrestricted-double\u2463"}],"title":"6.3.1. Interface definition"},{"refs":[{"id":"ref-for-idl-unrestricted-double\u2464"},{"id":"ref-for-idl-unrestricted-double\u2465"},{"id":"ref-for-idl-unrestricted-double\u2466"},{"id":"ref-for-idl-unrestricted-double\u2467"}],"title":"7.1. The queuing strategy API"},{"refs":[{"id":"ref-for-idl-unrestricted-double\u2468"}],"title":"7.2.1. Interface definition"},{"refs":[{"id":"ref-for-idl-unrestricted-double\u2460\u24ea"}],"title":"7.3.1. Interface definition"}],"url":"https://webidl.spec.whatwg.org/#idl-unrestricted-double"}, "1243a891": {"dfnID":"1243a891","dfnText":"exist","external":true,"refSections":[{"refs":[{"id":"ref-for-map-exists"},{"id":"ref-for-map-exists\u2460"},{"id":"ref-for-map-exists\u2461"},{"id":"ref-for-map-exists\u2462"},{"id":"ref-for-map-exists\u2463"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-map-exists\u2464"},{"id":"ref-for-map-exists\u2465"},{"id":"ref-for-map-exists\u2466"}],"title":"4.9.4. Default controllers"},{"refs":[{"id":"ref-for-map-exists\u2467"},{"id":"ref-for-map-exists\u2468"},{"id":"ref-for-map-exists\u2460\u24ea"},{"id":"ref-for-map-exists\u2460\u2460"}],"title":"4.9.5. Byte stream controllers"},{"refs":[{"id":"ref-for-map-exists\u2460\u2461"}],"title":"5.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-map-exists\u2460\u2462"},{"id":"ref-for-map-exists\u2460\u2463"},{"id":"ref-for-map-exists\u2460\u2464"},{"id":"ref-for-map-exists\u2460\u2465"}],"title":"5.5.4. Default controllers"},{"refs":[{"id":"ref-for-map-exists\u2460\u2466"},{"id":"ref-for-map-exists\u2460\u2467"},{"id":"ref-for-map-exists\u2460\u2468"}],"title":"6.2.4. Constructor and properties"},{"refs":[{"id":"ref-for-map-exists\u2461\u24ea"},{"id":"ref-for-map-exists\u2461\u2460"},{"id":"ref-for-map-exists\u2461\u2461"}],"title":"6.4.2. Default controllers"},{"refs":[{"id":"ref-for-map-exists\u2461\u2462"},{"id":"ref-for-map-exists\u2461\u2463"}],"title":"7.4. Abstract operations"}],"url":"https://infra.spec.whatwg.org/#map-exists"}, "13e76b84": {"dfnID":"13e76b84","dfnText":"GetV","external":true,"refSections":[{"refs":[{"id":"ref-for-sec-getv"}],"title":"7.2.2. Internal slots"}],"url":"https://tc39.es/ecma262/multipage/abstract-operations.html#sec-getv"}, "16d07e10": {"dfnID":"16d07e10","dfnText":"for each","external":true,"refSections":[{"refs":[{"id":"ref-for-list-iterate"},{"id":"ref-for-list-iterate\u2460"}],"title":"4.9.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-list-iterate\u2461"},{"id":"ref-for-list-iterate\u2462"}],"title":"4.9.3. Readers"},{"refs":[{"id":"ref-for-list-iterate\u2463"},{"id":"ref-for-list-iterate\u2464"},{"id":"ref-for-list-iterate\u2465"},{"id":"ref-for-list-iterate\u2466"}],"title":"4.9.5. Byte stream controllers"},{"refs":[{"id":"ref-for-list-iterate\u2467"}],"title":"5.5.2. Interfacing with controllers"}],"url":"https://infra.spec.whatwg.org/#list-iterate"}, "1e249f40": {"dfnID":"1e249f40","dfnText":"TextDecoderStream","external":true,"refSections":[{"refs":[{"id":"ref-for-textdecoderstream"}],"title":"9.3.2. Wrapping into a custom class"}],"url":"https://encoding.spec.whatwg.org/#textdecoderstream"}, "1f8de32a": {"dfnID":"1f8de32a","dfnText":"GetIterator","external":true,"refSections":[{"refs":[{"id":"ref-for-sec-getiterator"}],"title":"4.9.1. Working with readable streams"}],"url":"https://tc39.es/ecma262/multipage/abstract-operations.html#sec-getiterator"}, "2296404c": {"dfnID":"2296404c","dfnText":"signal abort","external":true,"refSections":[{"refs":[{"id":"ref-for-abortcontroller-signal-abort"},{"id":"ref-for-abortcontroller-signal-abort\u2460"}],"title":"5.5.1. Working with writable streams"}],"url":"https://dom.spec.whatwg.org/#abortcontroller-signal-abort"}, "2426fb1e": {"dfnID":"2426fb1e","dfnText":"%Uint8Array%","external":true,"refSections":[{"refs":[{"id":"ref-for-sec-typedarray-objects\u2461"}],"title":"4.7.4. Internal methods"},{"refs":[{"id":"ref-for-sec-typedarray-objects\u2463"},{"id":"ref-for-sec-typedarray-objects\u2464"},{"id":"ref-for-sec-typedarray-objects\u2465"}],"title":"4.9.5. Byte stream controllers"},{"refs":[{"id":"ref-for-sec-typedarray-objects\u2466"}],"title":"8.3. Miscellaneous"}],"url":"https://tc39.es/ecma262/multipage/indexed-collections.html#sec-typedarray-objects"}, "24bd7d25": {"dfnID":"24bd7d25","dfnText":"upon fulfillment","external":true,"refSections":[{"refs":[{"id":"ref-for-upon-fulfillment"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-upon-fulfillment\u2460"},{"id":"ref-for-upon-fulfillment\u2461"}],"title":"4.9.4. Default controllers"},{"refs":[{"id":"ref-for-upon-fulfillment\u2462"},{"id":"ref-for-upon-fulfillment\u2463"}],"title":"4.9.5. Byte stream controllers"},{"refs":[{"id":"ref-for-upon-fulfillment\u2464"}],"title":"5.5.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-upon-fulfillment\u2465"},{"id":"ref-for-upon-fulfillment\u2466"},{"id":"ref-for-upon-fulfillment\u2467"}],"title":"5.5.4. Default controllers"}],"url":"https://webidl.spec.whatwg.org/#upon-fulfillment"}, "25ce4994": {"dfnID":"25ce4994","dfnText":"transfer steps","external":true,"refSections":[{"refs":[{"id":"ref-for-transfer-steps"}],"title":"4.2.6. Transfer via postMessage()"},{"refs":[{"id":"ref-for-transfer-steps\u2460"}],"title":"5.2.5. Transfer via postMessage()"},{"refs":[{"id":"ref-for-transfer-steps\u2461"}],"title":"6.2.5. Transfer via postMessage()"}],"url":"https://html.spec.whatwg.org/multipage/structured-data.html#transfer-steps"}, "28e64574": {"dfnID":"28e64574","dfnText":"abort reason","external":true,"refSections":[{"refs":[{"id":"ref-for-abortsignal-abort-reason"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-abortsignal-abort-reason\u2460"},{"id":"ref-for-abortsignal-abort-reason\u2461"}],"title":"9.2.1. Creation and manipulation"}],"url":"https://dom.spec.whatwg.org/#abortsignal-abort-reason"}, "2ce6f6bb": {"dfnID":"2ce6f6bb","dfnText":"fetch(input)","external":true,"refSections":[{"refs":[{"id":"ref-for-dom-global-fetch"}],"title":"6.1. Using transform streams"}],"url":"https://fetch.spec.whatwg.org/#dom-global-fetch"}, "2d6ca7ca": {"dfnID":"2d6ca7ca","dfnText":"write (for ArrayBuffer)","external":true,"refSections":[{"refs":[{"id":"ref-for-arraybuffer-write"}],"title":"9.1.1. Creation and manipulation"}],"url":"https://webidl.spec.whatwg.org/#arraybuffer-write"}, "2e66eaf1": {"dfnID":"2e66eaf1","dfnText":"AbortController","external":true,"refSections":[{"refs":[{"id":"ref-for-abortcontroller"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-abortcontroller\u2460"}],"title":"5.4.2. Internal slots"},{"refs":[{"id":"ref-for-abortcontroller\u2461"}],"title":"5.5.4. Default controllers"}],"url":"https://dom.spec.whatwg.org/#abortcontroller"}, "2f6db3ee": {"dfnID":"2f6db3ee","dfnText":"buffer","external":true,"refSections":[{"refs":[{"id":"ref-for-dom-memory-buffer"}],"title":"8.3. Miscellaneous"}],"url":"https://webassembly.github.io/spec/js-api/#dom-memory-buffer"}, "32596166": {"dfnID":"32596166","dfnText":"bufferedAmount","external":true,"refSections":[{"refs":[{"id":"ref-for-dom-websocket-bufferedamount"}],"title":"10.6. A writable stream with no backpressure or success signals"}],"url":"https://websockets.spec.whatwg.org/#dom-websocket-bufferedamount"}, "36333997": {"dfnID":"36333997","dfnText":"length","external":true,"refSections":[{"refs":[{"id":"ref-for-byte-sequence-length"}],"title":"9.1.1. Creation and manipulation"}],"url":"https://infra.spec.whatwg.org/#byte-sequence-length"}, "367d928f": {"dfnID":"367d928f","dfnText":"is an Object","external":true,"refSections":[{"refs":[{"id":"ref-for-sec-object-type"},{"id":"ref-for-sec-object-type\u2460"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-sec-object-type\u2461"},{"id":"ref-for-sec-object-type\u2462"}],"title":"8.2. Transferable streams"},{"refs":[{"id":"ref-for-sec-object-type\u2463"},{"id":"ref-for-sec-object-type\u2464"},{"id":"ref-for-sec-object-type\u2465"},{"id":"ref-for-sec-object-type\u2466"}],"title":"8.3. Miscellaneous"}],"url":"https://tc39.es/ecma262/#sec-object-type"}, "3689e92d": {"dfnID":"3689e92d","dfnText":"CopyDataBlockBytes","external":true,"refSections":[{"refs":[{"id":"ref-for-sec-copydatablockbytes"}],"title":"4.9.5. Byte stream controllers"}],"url":"https://tc39.es/ecma262/multipage/ecmascript-data-types-and-values.html#sec-copydatablockbytes"}, "38381ead": {"dfnID":"38381ead","dfnText":"message","external":true,"refSections":[{"refs":[{"id":"ref-for-event-message"},{"id":"ref-for-event-message\u2460"}],"title":"8.2. Transferable streams"}],"url":"https://html.spec.whatwg.org/multipage/indices.html#event-message"}, "3b90bdcd": {"dfnID":"3b90bdcd","dfnText":"resolve","external":true,"refSections":[{"refs":[{"id":"ref-for-resolve"},{"id":"ref-for-resolve\u2460"}],"title":"4.2.5. Asynchronous iteration"},{"refs":[{"id":"ref-for-resolve\u2461"},{"id":"ref-for-resolve\u2462"}],"title":"4.4.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-resolve\u2463"},{"id":"ref-for-resolve\u2464"}],"title":"4.5.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-resolve\u2465"},{"id":"ref-for-resolve\u2466"},{"id":"ref-for-resolve\u2467"},{"id":"ref-for-resolve\u2468"},{"id":"ref-for-resolve\u2460\u24ea"},{"id":"ref-for-resolve\u2460\u2460"},{"id":"ref-for-resolve\u2460\u2461"},{"id":"ref-for-resolve\u2460\u2462"},{"id":"ref-for-resolve\u2460\u2463"},{"id":"ref-for-resolve\u2460\u2464"},{"id":"ref-for-resolve\u2460\u2465"},{"id":"ref-for-resolve\u2460\u2466"},{"id":"ref-for-resolve\u2460\u2467"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-resolve\u2460\u2468"}],"title":"4.9.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-resolve\u2461\u24ea"}],"title":"5.5.1. Working with writable streams"},{"refs":[{"id":"ref-for-resolve\u2461\u2460"},{"id":"ref-for-resolve\u2461\u2461"},{"id":"ref-for-resolve\u2461\u2462"},{"id":"ref-for-resolve\u2461\u2463"},{"id":"ref-for-resolve\u2461\u2464"},{"id":"ref-for-resolve\u2461\u2465"}],"title":"5.5.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-resolve\u2461\u2466"},{"id":"ref-for-resolve\u2461\u2467"}],"title":"6.2.4. Constructor and properties"},{"refs":[{"id":"ref-for-resolve\u2461\u2468"}],"title":"6.4.1. Working with transform streams"},{"refs":[{"id":"ref-for-resolve\u2462\u24ea"},{"id":"ref-for-resolve\u2462\u2460"}],"title":"6.4.3. Default sinks"},{"refs":[{"id":"ref-for-resolve\u2462\u2461"}],"title":"6.4.4. Default sources"},{"refs":[{"id":"ref-for-resolve\u2462\u2462"},{"id":"ref-for-resolve\u2462\u2463"}],"title":"8.2. Transferable streams"}],"url":"https://webidl.spec.whatwg.org/#resolve"}, "3de9e659": {"dfnID":"3de9e659","dfnText":"byte sequence","external":true,"refSections":[{"refs":[{"id":"ref-for-byte-sequence"},{"id":"ref-for-byte-sequence\u2460"},{"id":"ref-for-byte-sequence\u2461"}],"title":"9.1.1. Creation and manipulation"},{"refs":[{"id":"ref-for-byte-sequence\u2462"},{"id":"ref-for-byte-sequence\u2463"}],"title":"9.1.2. Reading"}],"url":"https://infra.spec.whatwg.org/#byte-sequence"}, "3ee2d4d2": {"dfnID":"3ee2d4d2","dfnText":"abstract operation","external":true,"refSections":[{"refs":[{"id":"ref-for-sec-algorithm-conventions-abstract-operations"}],"title":"3. Conventions"}],"url":"https://tc39.es/ecma262/#sec-algorithm-conventions-abstract-operations"}, "4013a022": {"dfnID":"4013a022","dfnText":"this","external":true,"refSections":[{"refs":[{"id":"ref-for-this"},{"id":"ref-for-this\u2460"},{"id":"ref-for-this\u2461"},{"id":"ref-for-this\u2462"},{"id":"ref-for-this\u2463"},{"id":"ref-for-this\u2464"},{"id":"ref-for-this\u2465"},{"id":"ref-for-this\u2466"},{"id":"ref-for-this\u2467"},{"id":"ref-for-this\u2468"},{"id":"ref-for-this\u2460\u24ea"},{"id":"ref-for-this\u2460\u2460"},{"id":"ref-for-this\u2460\u2461"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-this\u2460\u2462"}],"title":"4.2.5. Asynchronous iteration"},{"refs":[{"id":"ref-for-this\u2460\u2463"},{"id":"ref-for-this\u2460\u2464"},{"id":"ref-for-this\u2460\u2465"}],"title":"4.3.3. Methods and properties"},{"refs":[{"id":"ref-for-this\u2460\u2466"},{"id":"ref-for-this\u2460\u2467"},{"id":"ref-for-this\u2460\u2468"},{"id":"ref-for-this\u2461\u24ea"},{"id":"ref-for-this\u2461\u2460"}],"title":"4.4.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-this\u2461\u2461"},{"id":"ref-for-this\u2461\u2462"},{"id":"ref-for-this\u2461\u2463"},{"id":"ref-for-this\u2461\u2464"},{"id":"ref-for-this\u2461\u2465"}],"title":"4.5.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-this\u2461\u2466"},{"id":"ref-for-this\u2461\u2467"},{"id":"ref-for-this\u2461\u2468"},{"id":"ref-for-this\u2462\u24ea"},{"id":"ref-for-this\u2462\u2460"},{"id":"ref-for-this\u2462\u2461"}],"title":"4.6.3. Methods and properties"},{"refs":[{"id":"ref-for-this\u2462\u2462"},{"id":"ref-for-this\u2462\u2463"},{"id":"ref-for-this\u2462\u2464"},{"id":"ref-for-this\u2462\u2465"},{"id":"ref-for-this\u2462\u2466"},{"id":"ref-for-this\u2462\u2467"},{"id":"ref-for-this\u2462\u2468"},{"id":"ref-for-this\u2463\u24ea"},{"id":"ref-for-this\u2463\u2460"},{"id":"ref-for-this\u2463\u2461"},{"id":"ref-for-this\u2463\u2462"}],"title":"4.6.4. Internal methods"},{"refs":[{"id":"ref-for-this\u2463\u2463"},{"id":"ref-for-this\u2463\u2464"},{"id":"ref-for-this\u2463\u2465"},{"id":"ref-for-this\u2463\u2466"},{"id":"ref-for-this\u2463\u2467"},{"id":"ref-for-this\u2463\u2468"},{"id":"ref-for-this\u2464\u24ea"},{"id":"ref-for-this\u2464\u2460"},{"id":"ref-for-this\u2464\u2461"}],"title":"4.7.3. Methods and properties"},{"refs":[{"id":"ref-for-this\u2464\u2462"},{"id":"ref-for-this\u2464\u2463"},{"id":"ref-for-this\u2464\u2464"},{"id":"ref-for-this\u2464\u2465"},{"id":"ref-for-this\u2464\u2466"},{"id":"ref-for-this\u2464\u2467"},{"id":"ref-for-this\u2464\u2468"},{"id":"ref-for-this\u2465\u24ea"},{"id":"ref-for-this\u2465\u2460"},{"id":"ref-for-this\u2465\u2461"},{"id":"ref-for-this\u2465\u2462"},{"id":"ref-for-this\u2465\u2463"},{"id":"ref-for-this\u2465\u2464"}],"title":"4.7.4. Internal methods"},{"refs":[{"id":"ref-for-this\u2465\u2465"},{"id":"ref-for-this\u2465\u2466"},{"id":"ref-for-this\u2465\u2467"},{"id":"ref-for-this\u2465\u2468"},{"id":"ref-for-this\u2466\u24ea"},{"id":"ref-for-this\u2466\u2460"},{"id":"ref-for-this\u2466\u2461"},{"id":"ref-for-this\u2466\u2462"}],"title":"4.8.3. Methods and properties"},{"refs":[{"id":"ref-for-this\u2466\u2463"},{"id":"ref-for-this\u2466\u2464"},{"id":"ref-for-this\u2466\u2465"},{"id":"ref-for-this\u2466\u2466"},{"id":"ref-for-this\u2466\u2467"},{"id":"ref-for-this\u2466\u2468"},{"id":"ref-for-this\u2467\u24ea"},{"id":"ref-for-this\u2467\u2460"},{"id":"ref-for-this\u2467\u2461"}],"title":"5.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-this\u2467\u2462"},{"id":"ref-for-this\u2467\u2463"},{"id":"ref-for-this\u2467\u2464"},{"id":"ref-for-this\u2467\u2465"},{"id":"ref-for-this\u2467\u2466"},{"id":"ref-for-this\u2467\u2467"},{"id":"ref-for-this\u2467\u2468"},{"id":"ref-for-this\u2468\u24ea"},{"id":"ref-for-this\u2468\u2460"},{"id":"ref-for-this\u2468\u2461"},{"id":"ref-for-this\u2468\u2462"},{"id":"ref-for-this\u2468\u2463"},{"id":"ref-for-this\u2468\u2464"}],"title":"5.3.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-this\u2468\u2465"},{"id":"ref-for-this\u2468\u2466"},{"id":"ref-for-this\u2468\u2467"}],"title":"5.4.3. Methods and properties"},{"refs":[{"id":"ref-for-this\u2468\u2468"},{"id":"ref-for-this\u2460\u24ea\u24ea"},{"id":"ref-for-this\u2460\u24ea\u2460"}],"title":"5.4.4. Internal methods"},{"refs":[{"id":"ref-for-this\u2460\u24ea\u2461"},{"id":"ref-for-this\u2460\u24ea\u2462"},{"id":"ref-for-this\u2460\u24ea\u2463"},{"id":"ref-for-this\u2460\u24ea\u2464"},{"id":"ref-for-this\u2460\u24ea\u2465"}],"title":"6.2.4. Constructor and properties"},{"refs":[{"id":"ref-for-this\u2460\u24ea\u2466"},{"id":"ref-for-this\u2460\u24ea\u2467"},{"id":"ref-for-this\u2460\u24ea\u2468"},{"id":"ref-for-this\u2460\u2460\u24ea"}],"title":"6.3.3. Methods and properties"},{"refs":[{"id":"ref-for-this\u2460\u2460\u2460"},{"id":"ref-for-this\u2460\u2460\u2461"},{"id":"ref-for-this\u2460\u2460\u2462"}],"title":"7.2.3. Constructor and properties"},{"refs":[{"id":"ref-for-this\u2460\u2460\u2463"},{"id":"ref-for-this\u2460\u2460\u2464"},{"id":"ref-for-this\u2460\u2460\u2465"}],"title":"7.3.3. Constructor and properties"},{"refs":[{"id":"ref-for-this\u2460\u2460\u2466"}],"title":"9.1.1. Creation and manipulation"},{"refs":[{"id":"ref-for-this\u2460\u2460\u2467"}],"title":"9.2.1. Creation and manipulation"},{"refs":[{"id":"ref-for-this\u2460\u2460\u2468"}],"title":"9.3.1. Creation and manipulation"},{"refs":[{"id":"ref-for-this\u2460\u2461\u24ea"},{"id":"ref-for-this\u2460\u2461\u2460"}],"title":"9.3.2. Wrapping into a custom class"}],"url":"https://webidl.spec.whatwg.org/#this"}, "444d7f6a": {"dfnID":"444d7f6a","dfnText":"Transferable","external":true,"refSections":[{"refs":[{"id":"ref-for-transferable"}],"title":"4.2.1. Interface definition"},{"refs":[{"id":"ref-for-transferable\u2460"}],"title":"5.2.1. Interface definition"},{"refs":[{"id":"ref-for-transferable\u2461"}],"title":"6.2.1. Interface definition"}],"url":"https://html.spec.whatwg.org/multipage/structured-data.html#transferable"}, "495737df": {"dfnID":"495737df","dfnText":"byte length","external":true,"refSections":[{"refs":[{"id":"ref-for-buffersource-byte-length"},{"id":"ref-for-buffersource-byte-length\u2460"}],"title":"9.1.1. Creation and manipulation"}],"url":"https://webidl.spec.whatwg.org/#buffersource-byte-length"}, "4a5e45d1": {"dfnID":"4a5e45d1","dfnText":"message port post message steps","external":true,"refSections":[{"refs":[{"id":"ref-for-message-port-post-message-steps"},{"id":"ref-for-message-port-post-message-steps\u2460"}],"title":"8.2. Transferable streams"}],"url":"https://html.spec.whatwg.org/multipage/web-messaging.html#message-port-post-message-steps"}, "4ae6d1ad": {"dfnID":"4ae6d1ad","dfnText":"getting a promise to wait for all","external":true,"refSections":[{"refs":[{"id":"ref-for-waiting-for-all-promise"}],"title":"4.9.1. Working with readable streams"}],"url":"https://webidl.spec.whatwg.org/#waiting-for-all-promise"}, "4b6086d7": {"dfnID":"4b6086d7","dfnText":"global object","external":true,"refSections":[{"refs":[{"id":"ref-for-global-object"}],"title":"7.2.2. Internal slots"},{"refs":[{"id":"ref-for-global-object\u2460"}],"title":"7.3.2. Internal slots"}],"url":"https://html.spec.whatwg.org/multipage/webappapis.html#global-object"}, "4c6c6f05": {"dfnID":"4c6c6f05","dfnText":"CreateArrayFromList","external":true,"refSections":[{"refs":[{"id":"ref-for-sec-createarrayfromlist"},{"id":"ref-for-sec-createarrayfromlist\u2460"},{"id":"ref-for-sec-createarrayfromlist\u2461"},{"id":"ref-for-sec-createarrayfromlist\u2462"}],"title":"4.9.1. Working with readable streams"}],"url":"https://tc39.es/ecma262/multipage/abstract-operations.html#sec-createarrayfromlist"}, "53079ce3": {"dfnID":"53079ce3","dfnText":"queue a microtask","external":true,"refSections":[{"refs":[{"id":"ref-for-queue-a-microtask"},{"id":"ref-for-queue-a-microtask\u2460"},{"id":"ref-for-queue-a-microtask\u2461"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-queue-a-microtask\u2462"}],"title":"9.1.2. Reading"}],"url":"https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-microtask"}, "53275e46": {"dfnID":"53275e46","dfnText":"append (for list)","external":true,"refSections":[{"refs":[{"id":"ref-for-list-append"}],"title":"4.7.4. Internal methods"},{"refs":[{"id":"ref-for-list-append\u2460"},{"id":"ref-for-list-append\u2461"}],"title":"4.9.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-list-append\u2462"},{"id":"ref-for-list-append\u2463"},{"id":"ref-for-list-append\u2464"},{"id":"ref-for-list-append\u2465"},{"id":"ref-for-list-append\u2466"}],"title":"4.9.5. Byte stream controllers"},{"refs":[{"id":"ref-for-list-append\u2467"}],"title":"5.5.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-list-append\u2468"}],"title":"8.1. Queue-with-sizes"}],"url":"https://infra.spec.whatwg.org/#list-append"}, "535dd335": {"dfnID":"535dd335","dfnText":"aborted","external":true,"refSections":[{"refs":[{"id":"ref-for-abortsignal-aborted"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-abortsignal-aborted\u2460"},{"id":"ref-for-abortsignal-aborted\u2461"}],"title":"9.2.1. Creation and manipulation"}],"url":"https://dom.spec.whatwg.org/#abortsignal-aborted"}, "5372cca8": {"dfnID":"5372cca8","dfnText":"boolean","external":true,"refSections":[{"refs":[{"id":"ref-for-idl-boolean"},{"id":"ref-for-idl-boolean\u2460"},{"id":"ref-for-idl-boolean\u2461"},{"id":"ref-for-idl-boolean\u2462"},{"id":"ref-for-idl-boolean\u2463"}],"title":"4.2.1. Interface definition"},{"refs":[{"id":"ref-for-idl-boolean\u2464"}],"title":"4.4.1. Interface definition"},{"refs":[{"id":"ref-for-idl-boolean\u2465"}],"title":"5.2.1. Interface definition"}],"url":"https://webidl.spec.whatwg.org/#idl-boolean"}, "56f81a8e": {"dfnID":"56f81a8e","dfnText":"new","external":true,"refSections":[{"refs":[{"id":"ref-for-new"},{"id":"ref-for-new\u2460"},{"id":"ref-for-new\u2461"}],"title":"4.2.6. Transfer via postMessage()"},{"refs":[{"id":"ref-for-new\u2462"},{"id":"ref-for-new\u2463"},{"id":"ref-for-new\u2464"},{"id":"ref-for-new\u2465"},{"id":"ref-for-new\u2466"},{"id":"ref-for-new\u2467"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-new\u2468"}],"title":"4.9.4. Default controllers"},{"refs":[{"id":"ref-for-new\u2460\u24ea"},{"id":"ref-for-new\u2460\u2460"}],"title":"4.9.5. Byte stream controllers"},{"refs":[{"id":"ref-for-new\u2460\u2461"},{"id":"ref-for-new\u2460\u2462"},{"id":"ref-for-new\u2460\u2463"}],"title":"5.2.5. Transfer via postMessage()"},{"refs":[{"id":"ref-for-new\u2460\u2464"},{"id":"ref-for-new\u2460\u2465"},{"id":"ref-for-new\u2460\u2466"}],"title":"5.5.1. Working with writable streams"},{"refs":[{"id":"ref-for-new\u2460\u2467"}],"title":"5.5.4. Default controllers"},{"refs":[{"id":"ref-for-new\u2460\u2468"}],"title":"6.4.2. Default controllers"},{"refs":[{"id":"ref-for-new\u2461\u24ea"},{"id":"ref-for-new\u2461\u2460"}],"title":"8.2. Transferable streams"},{"refs":[{"id":"ref-for-new\u2461\u2461"},{"id":"ref-for-new\u2461\u2462"},{"id":"ref-for-new\u2461\u2463"},{"id":"ref-for-new\u2461\u2464"},{"id":"ref-for-new\u2461\u2465"}],"title":"9.1.1. Creation and manipulation"},{"refs":[{"id":"ref-for-new\u2461\u2466"},{"id":"ref-for-new\u2461\u2467"},{"id":"ref-for-new\u2461\u2468"}],"title":"9.2.1. Creation and manipulation"},{"refs":[{"id":"ref-for-new\u2462\u24ea"},{"id":"ref-for-new\u2462\u2460"},{"id":"ref-for-new\u2462\u2461"},{"id":"ref-for-new\u2462\u2462"}],"title":"9.3.1. Creation and manipulation"},{"refs":[{"id":"ref-for-new\u2462\u2463"}],"title":"9.3.2. Wrapping into a custom class"}],"url":"https://webidl.spec.whatwg.org/#new"}, "59243858": {"dfnID":"59243858","dfnText":"constructor steps","external":true,"refSections":[{"refs":[{"id":"ref-for-constructor-steps"}],"title":"9.3.2. Wrapping into a custom class"}],"url":"https://webidl.spec.whatwg.org/#constructor-steps"}, "5991ccfb": {"dfnID":"5991ccfb","dfnText":"relevant realm","external":true,"refSections":[{"refs":[{"id":"ref-for-concept-relevant-realm"}],"title":"7.2.2. Internal slots"},{"refs":[{"id":"ref-for-concept-relevant-realm\u2460"}],"title":"7.3.2. Internal slots"},{"refs":[{"id":"ref-for-concept-relevant-realm\u2461"}],"title":"9.1.1. Creation and manipulation"}],"url":"https://html.spec.whatwg.org/multipage/webappapis.html#concept-relevant-realm"}, "5b7339ce": {"dfnID":"5b7339ce","dfnText":"GetMethod","external":true,"refSections":[{"refs":[{"id":"ref-for-sec-getmethod"}],"title":"4.9.1. Working with readable streams"}],"url":"https://tc39.es/ecma262/multipage/abstract-operations.html#sec-getmethod"}, "5f90bbfb": {"dfnID":"5f90bbfb","dfnText":"undefined","external":true,"refSections":[{"refs":[{"id":"ref-for-idl-undefined"},{"id":"ref-for-idl-undefined\u2460"}],"title":"4.2.1. Interface definition"},{"refs":[{"id":"ref-for-idl-undefined\u2461"},{"id":"ref-for-idl-undefined\u2462"}],"title":"4.2.3. The underlying source API"},{"refs":[{"id":"ref-for-idl-undefined\u2463"},{"id":"ref-for-idl-undefined\u2464"}],"title":"4.3.1. Mixin definition"},{"refs":[{"id":"ref-for-idl-undefined\u2465"}],"title":"4.4.1. Interface definition"},{"refs":[{"id":"ref-for-idl-undefined\u2466"}],"title":"4.5.1. Interface definition"},{"refs":[{"id":"ref-for-idl-undefined\u2467"},{"id":"ref-for-idl-undefined\u2468"},{"id":"ref-for-idl-undefined\u2460\u24ea"}],"title":"4.6.1. Interface definition"},{"refs":[{"id":"ref-for-idl-undefined\u2460\u2460"},{"id":"ref-for-idl-undefined\u2460\u2461"},{"id":"ref-for-idl-undefined\u2460\u2462"}],"title":"4.7.1. Interface definition"},{"refs":[{"id":"ref-for-idl-undefined\u2460\u2463"},{"id":"ref-for-idl-undefined\u2460\u2464"}],"title":"4.8.1. Interface definition"},{"refs":[{"id":"ref-for-idl-undefined\u2460\u2465"},{"id":"ref-for-idl-undefined\u2460\u2466"}],"title":"5.2.1. Interface definition"},{"refs":[{"id":"ref-for-idl-undefined\u2460\u2467"},{"id":"ref-for-idl-undefined\u2460\u2468"},{"id":"ref-for-idl-undefined\u2461\u24ea"}],"title":"5.2.3. The underlying sink API"},{"refs":[{"id":"ref-for-idl-undefined\u2461\u2460"},{"id":"ref-for-idl-undefined\u2461\u2461"},{"id":"ref-for-idl-undefined\u2461\u2462"},{"id":"ref-for-idl-undefined\u2461\u2463"},{"id":"ref-for-idl-undefined\u2461\u2464"},{"id":"ref-for-idl-undefined\u2461\u2465"}],"title":"5.3.1. Interface definition"},{"refs":[{"id":"ref-for-idl-undefined\u2461\u2466"}],"title":"5.4.1. Interface definition"},{"refs":[{"id":"ref-for-idl-undefined\u2461\u2467"},{"id":"ref-for-idl-undefined\u2461\u2468"},{"id":"ref-for-idl-undefined\u2462\u24ea"}],"title":"6.2.3. The transformer API"},{"refs":[{"id":"ref-for-idl-undefined\u2462\u2460"},{"id":"ref-for-idl-undefined\u2462\u2461"},{"id":"ref-for-idl-undefined\u2462\u2462"}],"title":"6.3.1. Interface definition"}],"url":"https://webidl.spec.whatwg.org/#idl-undefined"}, "5f9c7266": {"dfnID":"5f9c7266","dfnText":"Number","external":true,"refSections":[{"refs":[{"id":"ref-for-sec-number-objects"}],"title":"8.1. Queue-with-sizes"}],"url":"https://tc39.es/ecma262/multipage/numbers-and-dates.html#sec-number-objects"}, "649608b9": {"dfnID":"649608b9","dfnText":"list","external":true,"refSections":[{"refs":[{"id":"ref-for-list"}],"title":"4.4.2. Internal slots"},{"refs":[{"id":"ref-for-list\u2460"}],"title":"4.5.2. Internal slots"},{"refs":[{"id":"ref-for-list\u2461"}],"title":"4.6.2. Internal slots"},{"refs":[{"id":"ref-for-list\u2462"},{"id":"ref-for-list\u2463"}],"title":"4.7.2. Internal slots"},{"refs":[{"id":"ref-for-list\u2464"}],"title":"4.7.4. Internal methods"},{"refs":[{"id":"ref-for-list\u2465"},{"id":"ref-for-list\u2466"}],"title":"4.9.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-list\u2467"},{"id":"ref-for-list\u2468"},{"id":"ref-for-list\u2460\u24ea"},{"id":"ref-for-list\u2460\u2460"}],"title":"4.9.3. Readers"},{"refs":[{"id":"ref-for-list\u2460\u2461"},{"id":"ref-for-list\u2460\u2462"},{"id":"ref-for-list\u2460\u2463"},{"id":"ref-for-list\u2460\u2464"}],"title":"4.9.5. Byte stream controllers"},{"refs":[{"id":"ref-for-list\u2460\u2465"}],"title":"5.2.2. Internal slots"},{"refs":[{"id":"ref-for-list\u2460\u2466"}],"title":"5.4.2. Internal slots"},{"refs":[{"id":"ref-for-list\u2460\u2467"}],"title":"5.5.1. Working with writable streams"},{"refs":[{"id":"ref-for-list\u2460\u2468"}],"title":"5.5.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-list\u2461\u24ea"},{"id":"ref-for-list\u2461\u2460"}],"title":"8.1. Queue-with-sizes"}],"url":"https://infra.spec.whatwg.org/#list"}, "65342bb9": {"dfnID":"65342bb9","dfnText":"SameValue","external":true,"refSections":[{"refs":[{"id":"ref-for-sec-samevalue"}],"title":"8.3. Miscellaneous"}],"url":"https://tc39.es/ecma262/multipage/abstract-operations.html#sec-samevalue"}, "6728fdee": {"dfnID":"6728fdee","dfnText":"platform object","external":true,"refSections":[{"refs":[{"id":"ref-for-dfn-platform-object"}],"title":"3. Conventions"},{"refs":[{"id":"ref-for-dfn-platform-object\u2460"}],"title":"9.3.2. Wrapping into a custom class"}],"url":"https://webidl.spec.whatwg.org/#dfn-platform-object"}, "68316ab6": {"dfnID":"68316ab6","dfnText":"is not an Object","external":true,"refSections":[{"refs":[{"id":"ref-for-sec-object-type"},{"id":"ref-for-sec-object-type\u2460"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-sec-object-type\u2461"},{"id":"ref-for-sec-object-type\u2462"}],"title":"8.2. Transferable streams"},{"refs":[{"id":"ref-for-sec-object-type\u2463"},{"id":"ref-for-sec-object-type\u2464"},{"id":"ref-for-sec-object-type\u2465"},{"id":"ref-for-sec-object-type\u2466"}],"title":"8.3. Miscellaneous"}],"url":"https://tc39.es/ecma262/#sec-object-type"}, "6875767f": {"dfnID":"6875767f","dfnText":"map","external":true,"refSections":[{"refs":[{"id":"ref-for-sec-array.prototype.map"}],"title":"10.10. A transform stream created from a sync mapper function"}],"url":"https://tc39.es/ecma262/#sec-array.prototype.map"}, "68d0559e": {"dfnID":"68d0559e","dfnText":"IteratorValue","external":true,"refSections":[{"refs":[{"id":"ref-for-sec-iteratorvalue"}],"title":"4.9.1. Working with readable streams"}],"url":"https://tc39.es/ecma262/multipage/abstract-operations.html#sec-iteratorvalue"}, "692595fe": {"dfnID":"692595fe","dfnText":"ordered set","external":true,"refSections":[{"refs":[{"id":"ref-for-ordered-set"}],"title":"4.9.1. Working with readable streams"}],"url":"https://infra.spec.whatwg.org/#ordered-set"}, "69c80471": {"dfnID":"69c80471","dfnText":"transfer","external":true,"refSections":[{"refs":[{"id":"ref-for-arraybuffer-transfer"}],"title":"9.1.1. Creation and manipulation"},{"refs":[{"id":"ref-for-arraybuffer-transfer\u2460"}],"title":"9.2.1. Creation and manipulation"},{"refs":[{"id":"ref-for-arraybuffer-transfer\u2461"}],"title":"9.3.1. Creation and manipulation"}],"url":"https://webidl.spec.whatwg.org/#arraybuffer-transfer"}, "6aa60cdd": {"dfnID":"6aa60cdd","dfnText":"transfer-receiving steps","external":true,"refSections":[{"refs":[{"id":"ref-for-transfer-receiving-steps"}],"title":"4.2.6. Transfer via postMessage()"},{"refs":[{"id":"ref-for-transfer-receiving-steps\u2460"}],"title":"5.2.5. Transfer via postMessage()"},{"refs":[{"id":"ref-for-transfer-receiving-steps\u2461"}],"title":"6.2.5. Transfer via postMessage()"}],"url":"https://html.spec.whatwg.org/multipage/structured-data.html#transfer-receiving-steps"}, "6b373a4a": {"dfnID":"6b373a4a","dfnText":"messageerror","external":true,"refSections":[{"refs":[{"id":"ref-for-event-messageerror"},{"id":"ref-for-event-messageerror\u2460"}],"title":"8.2. Transferable streams"}],"url":"https://html.spec.whatwg.org/multipage/indices.html#event-messageerror"}, "6b815fdd": {"dfnID":"6b815fdd","dfnText":"is empty","external":true,"refSections":[{"refs":[{"id":"ref-for-list-is-empty"}],"title":"4.2.5. Asynchronous iteration"},{"refs":[{"id":"ref-for-list-is-empty\u2460"},{"id":"ref-for-list-is-empty\u2461"}],"title":"4.6.4. Internal methods"},{"refs":[{"id":"ref-for-list-is-empty\u2462"}],"title":"4.7.4. Internal methods"},{"refs":[{"id":"ref-for-list-is-empty\u2463"},{"id":"ref-for-list-is-empty\u2464"},{"id":"ref-for-list-is-empty\u2465"},{"id":"ref-for-list-is-empty\u2466"},{"id":"ref-for-list-is-empty\u2467"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-list-is-empty\u2468"},{"id":"ref-for-list-is-empty\u2460\u24ea"}],"title":"4.9.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-list-is-empty\u2460\u2460"}],"title":"4.9.4. Default controllers"},{"refs":[{"id":"ref-for-list-is-empty\u2460\u2461"},{"id":"ref-for-list-is-empty\u2460\u2462"},{"id":"ref-for-list-is-empty\u2460\u2463"},{"id":"ref-for-list-is-empty\u2460\u2464"},{"id":"ref-for-list-is-empty\u2460\u2465"},{"id":"ref-for-list-is-empty\u2460\u2466"},{"id":"ref-for-list-is-empty\u2460\u2467"},{"id":"ref-for-list-is-empty\u2460\u2468"},{"id":"ref-for-list-is-empty\u2461\u24ea"}],"title":"4.9.5. Byte stream controllers"},{"refs":[{"id":"ref-for-list-is-empty\u2461\u2460"},{"id":"ref-for-list-is-empty\u2461\u2461"}],"title":"8.1. Queue-with-sizes"},{"refs":[{"id":"ref-for-list-is-empty\u2461\u2462"}],"title":"9.1.1. Creation and manipulation"}],"url":"https://infra.spec.whatwg.org/#list-is-empty"}, "6c6b1005": {"dfnID":"6c6b1005","dfnText":"any","external":true,"refSections":[{"refs":[{"id":"ref-for-idl-any"},{"id":"ref-for-idl-any\u2460"},{"id":"ref-for-idl-any\u2461"}],"title":"4.2.1. Interface definition"},{"refs":[{"id":"ref-for-idl-any\u2462"},{"id":"ref-for-idl-any\u2463"}],"title":"4.2.3. The underlying source API"},{"refs":[{"id":"ref-for-idl-any\u2464"}],"title":"4.3.1. Mixin definition"},{"refs":[{"id":"ref-for-idl-any\u2465"}],"title":"4.4.1. Interface definition"},{"refs":[{"id":"ref-for-idl-any\u2466"},{"id":"ref-for-idl-any\u2467"}],"title":"4.6.1. Interface definition"},{"refs":[{"id":"ref-for-idl-any\u2468"}],"title":"4.7.1. Interface definition"},{"refs":[{"id":"ref-for-idl-any\u2460\u24ea"}],"title":"5.2.1. Interface definition"},{"refs":[{"id":"ref-for-idl-any\u2460\u2460"},{"id":"ref-for-idl-any\u2460\u2461"},{"id":"ref-for-idl-any\u2460\u2462"},{"id":"ref-for-idl-any\u2460\u2463"},{"id":"ref-for-idl-any\u2460\u2464"}],"title":"5.2.3. The underlying sink API"},{"refs":[{"id":"ref-for-idl-any\u2460\u2465"},{"id":"ref-for-idl-any\u2460\u2466"}],"title":"5.3.1. Interface definition"},{"refs":[{"id":"ref-for-idl-any\u2460\u2467"}],"title":"5.4.1. Interface definition"},{"refs":[{"id":"ref-for-idl-any\u2460\u2468"},{"id":"ref-for-idl-any\u2461\u24ea"},{"id":"ref-for-idl-any\u2461\u2460"},{"id":"ref-for-idl-any\u2461\u2461"},{"id":"ref-for-idl-any\u2461\u2462"},{"id":"ref-for-idl-any\u2461\u2463"},{"id":"ref-for-idl-any\u2461\u2464"}],"title":"6.2.3. The transformer API"},{"refs":[{"id":"ref-for-idl-any\u2461\u2465"},{"id":"ref-for-idl-any\u2461\u2466"}],"title":"6.3.1. Interface definition"},{"refs":[{"id":"ref-for-idl-any\u2461\u2467"}],"title":"7.1. The queuing strategy API"}],"url":"https://webidl.spec.whatwg.org/#idl-any"}, "6c9ab516": {"dfnID":"6c9ab516","dfnText":"ArrayBufferView","external":true,"refSections":[{"refs":[{"id":"ref-for-ArrayBufferView"}],"title":"4.5.1. Interface definition"},{"refs":[{"id":"ref-for-ArrayBufferView\u2460"}],"title":"4.7.1. Interface definition"},{"refs":[{"id":"ref-for-ArrayBufferView\u2461"}],"title":"4.7.3. Methods and properties"},{"refs":[{"id":"ref-for-ArrayBufferView\u2462"},{"id":"ref-for-ArrayBufferView\u2463"}],"title":"4.8.1. Interface definition"},{"refs":[{"id":"ref-for-ArrayBufferView\u2464"}],"title":"4.8.3. Methods and properties"},{"refs":[{"id":"ref-for-ArrayBufferView\u2465"},{"id":"ref-for-ArrayBufferView\u2466"},{"id":"ref-for-ArrayBufferView\u2467"}],"title":"9.1.1. Creation and manipulation"}],"url":"https://webidl.spec.whatwg.org/#ArrayBufferView"}, "6df10f44": {"dfnID":"6df10f44","dfnText":"CreateBuiltinFunction","external":true,"refSections":[{"refs":[{"id":"ref-for-sec-createbuiltinfunction"}],"title":"7.2.2. Internal slots"},{"refs":[{"id":"ref-for-sec-createbuiltinfunction\u2460"}],"title":"7.3.2. Internal slots"}],"url":"https://tc39.es/ecma262/multipage/ordinary-and-exotic-objects-behaviours.html#sec-createbuiltinfunction"}, "6e6d76ed": {"dfnID":"6e6d76ed","dfnText":"CompressionStream","external":true,"refSections":[{"refs":[{"id":"ref-for-compressionstream"}],"title":"9.3.2. Wrapping into a custom class"}],"url":"https://compression.spec.whatwg.org/#compressionstream"}, "6eeed17d": {"dfnID":"6eeed17d","dfnText":"WebSocket","external":true,"refSections":[{"refs":[{"id":"ref-for-websocket"}],"title":"10.1. A readable stream with an underlying push source (no\nbackpressure support)"},{"refs":[{"id":"ref-for-websocket\u2460"}],"title":"10.6. A writable stream with no backpressure or success signals"}],"url":"https://websockets.spec.whatwg.org/#websocket"}, "704f9119": {"dfnID":"704f9119","dfnText":"realm","external":true,"refSections":[{"refs":[{"id":"ref-for-sec-code-realms"}],"title":"8.2. Transferable streams"}],"url":"https://tc39.es/ecma262/#sec-code-realms"}, "70a9ebde": {"dfnID":"70a9ebde","dfnText":"is not a Number","external":true,"refSections":[{"refs":[{"id":"ref-for-sec-ecmascript-language-types-number-type\u2460"}],"title":"8.3. Miscellaneous"}],"url":"https://tc39.es/ecma262/#sec-ecmascript-language-types-number-type"}, "74a58133": {"dfnID":"74a58133","dfnText":"CloneArrayBuffer","external":true,"refSections":[{"refs":[{"id":"ref-for-sec-clonearraybuffer"}],"title":"4.9.5. Byte stream controllers"},{"refs":[{"id":"ref-for-sec-clonearraybuffer\u2460"}],"title":"8.3. Miscellaneous"}],"url":"https://tc39.es/ecma262/multipage/structured-data.html#sec-clonearraybuffer"}, "74b35c0b": {"dfnID":"74b35c0b","dfnText":"Completion Record","external":true,"refSections":[{"refs":[{"id":"ref-for-sec-completion-record-specification-type"}],"title":"3. Conventions"},{"refs":[{"id":"ref-for-sec-completion-record-specification-type\u2460"}],"title":"4.9.4. Default controllers"},{"refs":[{"id":"ref-for-sec-completion-record-specification-type\u2461"}],"title":"5.5.4. Default controllers"}],"url":"https://tc39.es/ecma262/multipage/ecmascript-data-types-and-values.html#sec-completion-record-specification-type"}, "750a2f08": {"dfnID":"750a2f08","dfnText":"react","external":true,"refSections":[{"refs":[{"id":"ref-for-dfn-perform-steps-once-promise-is-settled"},{"id":"ref-for-dfn-perform-steps-once-promise-is-settled\u2460"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-dfn-perform-steps-once-promise-is-settled\u2461"}],"title":"4.9.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-dfn-perform-steps-once-promise-is-settled\u2462"}],"title":"6.4.2. Default controllers"},{"refs":[{"id":"ref-for-dfn-perform-steps-once-promise-is-settled\u2463"},{"id":"ref-for-dfn-perform-steps-once-promise-is-settled\u2464"},{"id":"ref-for-dfn-perform-steps-once-promise-is-settled\u2465"}],"title":"6.4.3. Default sinks"},{"refs":[{"id":"ref-for-dfn-perform-steps-once-promise-is-settled\u2466"}],"title":"6.4.4. Default sources"},{"refs":[{"id":"ref-for-dfn-perform-steps-once-promise-is-settled\u2467"}],"title":"8.2. Transferable streams"}],"url":"https://webidl.spec.whatwg.org/#dfn-perform-steps-once-promise-is-settled"}, "77aef363": {"dfnID":"77aef363","dfnText":"array","external":true,"refSections":[{"refs":[{"id":"ref-for-sec-array-objects"}],"title":"4.2.4. Constructor, methods, and properties"}],"url":"https://tc39.es/ecma262/#sec-array-objects"}, "7b05fe24": {"dfnID":"7b05fe24","dfnText":"get a copy of the bytes held by the buffer source","external":true,"refSections":[{"refs":[{"id":"ref-for-dfn-get-buffer-source-copy"}],"title":"9.2.1. Creation and manipulation"},{"refs":[{"id":"ref-for-dfn-get-buffer-source-copy\u2460"}],"title":"9.3.1. Creation and manipulation"}],"url":"https://webidl.spec.whatwg.org/#dfn-get-buffer-source-copy"}, "7b0d918d": {"dfnID":"7b0d918d","dfnText":"break","external":true,"refSections":[{"refs":[{"id":"ref-for-iteration-break"}],"title":"4.9.5. Byte stream controllers"}],"url":"https://infra.spec.whatwg.org/#iteration-break"}, "81131be0": {"dfnID":"81131be0","dfnText":"Call","external":true,"refSections":[{"refs":[{"id":"ref-for-sec-call"}],"title":"4.9.1. Working with readable streams"}],"url":"https://tc39.es/ecma262/multipage/abstract-operations.html#sec-call"}, "81c11fc3": {"dfnID":"81c11fc3","dfnText":"TypeError","external":true,"refSections":[{"refs":[{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror"},{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2460"},{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2461"},{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2462"},{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2463"},{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2464"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2465"}],"title":"4.3.3. Methods and properties"},{"refs":[{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2466"},{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2467"}],"title":"4.4.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2468"},{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2460\u24ea"},{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2460\u2460"},{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2460\u2461"},{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2460\u2462"},{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2460\u2463"}],"title":"4.5.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2460\u2464"},{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2460\u2465"}],"title":"4.6.3. Methods and properties"},{"refs":[{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2460\u2466"},{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2460\u2467"},{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2460\u2468"},{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2461\u24ea"},{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2461\u2460"},{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2461\u2461"},{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2461\u2462"}],"title":"4.7.3. Methods and properties"},{"refs":[{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2461\u2463"},{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2461\u2464"},{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2461\u2465"},{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2461\u2466"}],"title":"4.8.3. Methods and properties"},{"refs":[{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2461\u2467"},{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2461\u2468"},{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2462\u24ea"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2462\u2460"},{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2462\u2461"},{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2462\u2462"},{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2462\u2463"},{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2462\u2464"},{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2462\u2465"},{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2462\u2466"}],"title":"4.9.3. Readers"},{"refs":[{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2462\u2467"},{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2462\u2468"},{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2463\u24ea"},{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2463\u2460"},{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2463\u2461"},{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2463\u2462"},{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2463\u2463"},{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2463\u2464"},{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2463\u2465"}],"title":"4.9.5. Byte stream controllers"},{"refs":[{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2463\u2466"}],"title":"5.2.3. The underlying sink API"},{"refs":[{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2463\u2467"},{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2463\u2468"},{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2464\u24ea"},{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2464\u2460"},{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2464\u2461"}],"title":"5.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2464\u2462"},{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2464\u2463"},{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2464\u2464"},{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2464\u2465"},{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2464\u2466"}],"title":"5.3.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2464\u2467"},{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2464\u2468"}],"title":"5.5.1. Working with writable streams"},{"refs":[{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2465\u24ea"},{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2465\u2460"},{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2465\u2461"}],"title":"5.5.3. Writers"},{"refs":[{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2465\u2462"},{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2465\u2463"}],"title":"6.4.2. Default controllers"},{"refs":[{"id":"ref-for-sec-native-error-types-used-in-this-standard-typeerror\u2465\u2464"}],"title":"9.1.2. Reading"}],"url":"https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror"}, "860300d4": {"dfnID":"860300d4","dfnText":"implementation-defined","external":true,"refSections":[{"refs":[{"id":"ref-for-implementation-defined"}],"title":"4.9.5. Byte stream controllers"}],"url":"https://infra.spec.whatwg.org/#implementation-defined"}, "87bc23a5": {"dfnID":"87bc23a5","dfnText":"add","external":true,"refSections":[{"refs":[{"id":"ref-for-abortsignal-add"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-abortsignal-add\u2460"},{"id":"ref-for-abortsignal-add\u2461"}],"title":"9.2.1. Creation and manipulation"}],"url":"https://dom.spec.whatwg.org/#abortsignal-add"}, "88a9cf19": {"dfnID":"88a9cf19","dfnText":"create","external":true,"refSections":[{"refs":[{"id":"ref-for-arraybufferview-create"},{"id":"ref-for-arraybufferview-create\u2460"}],"title":"9.1.1. Creation and manipulation"}],"url":"https://webidl.spec.whatwg.org/#arraybufferview-create"}, "88cd0dbd": {"dfnID":"88cd0dbd","dfnText":"iterable","external":true,"refSections":[{"refs":[{"id":"ref-for-sec-iterable-interface"}],"title":"4.2.4. Constructor, methods, and properties"}],"url":"https://tc39.es/ecma262/#sec-iterable-interface"}, "89786baf": {"dfnID":"89786baf","dfnText":"StructuredSerialize","external":true,"refSections":[{"refs":[{"id":"ref-for-structuredserialize"}],"title":"8.3. Miscellaneous"}],"url":"https://html.spec.whatwg.org/multipage/structured-data.html#structuredserialize"}, "8afe05ad": {"dfnID":"8afe05ad","dfnText":"port message queue","external":true,"refSections":[{"refs":[{"id":"ref-for-port-message-queue"},{"id":"ref-for-port-message-queue\u2460"}],"title":"8.2. Transferable streams"}],"url":"https://html.spec.whatwg.org/multipage/web-messaging.html#port-message-queue"}, "8b2fedc9": {"dfnID":"8b2fedc9","dfnText":"Uint8Array","external":true,"refSections":[{"refs":[{"id":"ref-for-sec-typedarray-objects"}],"title":"2. Model"},{"refs":[{"id":"ref-for-sec-typedarray-objects\u2460"}],"title":"4.1. Using readable streams"},{"refs":[{"id":"ref-for-sec-typedarray-objects\u2462"}],"title":"4.8.2. Internal slots"},{"refs":[{"id":"ref-for-sec-typedarray-objects\u2467"}],"title":"9.1.1. Creation and manipulation"},{"refs":[{"id":"ref-for-sec-typedarray-objects\u2468"}],"title":"9.1.2. Reading"}],"url":"https://tc39.es/ecma262/#sec-typedarray-objects"}, "8e9945a0": {"dfnID":"8e9945a0","dfnText":"body","external":true,"refSections":[{"refs":[{"id":"ref-for-concept-request-body"}],"title":"6.1. Using transform streams"}],"url":"https://fetch.spec.whatwg.org/#concept-request-body"}, "8f5c2179": {"dfnID":"8f5c2179","dfnText":"a promise resolved with","external":true,"refSections":[{"refs":[{"id":"ref-for-a-promise-resolved-with"}],"title":"4.2.5. Asynchronous iteration"},{"refs":[{"id":"ref-for-a-promise-resolved-with\u2460"},{"id":"ref-for-a-promise-resolved-with\u2461"},{"id":"ref-for-a-promise-resolved-with\u2462"},{"id":"ref-for-a-promise-resolved-with\u2463"},{"id":"ref-for-a-promise-resolved-with\u2464"},{"id":"ref-for-a-promise-resolved-with\u2465"},{"id":"ref-for-a-promise-resolved-with\u2466"},{"id":"ref-for-a-promise-resolved-with\u2467"},{"id":"ref-for-a-promise-resolved-with\u2468"},{"id":"ref-for-a-promise-resolved-with\u2460\u24ea"},{"id":"ref-for-a-promise-resolved-with\u2460\u2460"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-a-promise-resolved-with\u2460\u2461"}],"title":"4.9.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-a-promise-resolved-with\u2460\u2462"}],"title":"4.9.3. Readers"},{"refs":[{"id":"ref-for-a-promise-resolved-with\u2460\u2463"},{"id":"ref-for-a-promise-resolved-with\u2460\u2464"},{"id":"ref-for-a-promise-resolved-with\u2460\u2465"}],"title":"4.9.4. Default controllers"},{"refs":[{"id":"ref-for-a-promise-resolved-with\u2460\u2466"},{"id":"ref-for-a-promise-resolved-with\u2460\u2467"},{"id":"ref-for-a-promise-resolved-with\u2460\u2468"}],"title":"4.9.5. Byte stream controllers"},{"refs":[{"id":"ref-for-a-promise-resolved-with\u2461\u24ea"},{"id":"ref-for-a-promise-resolved-with\u2461\u2460"},{"id":"ref-for-a-promise-resolved-with\u2461\u2461"},{"id":"ref-for-a-promise-resolved-with\u2461\u2462"},{"id":"ref-for-a-promise-resolved-with\u2461\u2463"}],"title":"5.5.1. Working with writable streams"},{"refs":[{"id":"ref-for-a-promise-resolved-with\u2461\u2464"}],"title":"5.5.3. Writers"},{"refs":[{"id":"ref-for-a-promise-resolved-with\u2461\u2465"},{"id":"ref-for-a-promise-resolved-with\u2461\u2466"},{"id":"ref-for-a-promise-resolved-with\u2461\u2467"},{"id":"ref-for-a-promise-resolved-with\u2461\u2468"}],"title":"5.5.4. Default controllers"},{"refs":[{"id":"ref-for-a-promise-resolved-with\u2462\u24ea"},{"id":"ref-for-a-promise-resolved-with\u2462\u2460"},{"id":"ref-for-a-promise-resolved-with\u2462\u2461"}],"title":"6.4.2. Default controllers"},{"refs":[{"id":"ref-for-a-promise-resolved-with\u2462\u2462"},{"id":"ref-for-a-promise-resolved-with\u2462\u2463"},{"id":"ref-for-a-promise-resolved-with\u2462\u2464"},{"id":"ref-for-a-promise-resolved-with\u2462\u2465"},{"id":"ref-for-a-promise-resolved-with\u2462\u2466"},{"id":"ref-for-a-promise-resolved-with\u2462\u2467"}],"title":"8.2. Transferable streams"},{"refs":[{"id":"ref-for-a-promise-resolved-with\u2462\u2468"},{"id":"ref-for-a-promise-resolved-with\u2463\u24ea"},{"id":"ref-for-a-promise-resolved-with\u2463\u2460"},{"id":"ref-for-a-promise-resolved-with\u2463\u2461"}],"title":"9.1.1. Creation and manipulation"},{"refs":[{"id":"ref-for-a-promise-resolved-with\u2463\u2462"},{"id":"ref-for-a-promise-resolved-with\u2463\u2463"}],"title":"9.2.1. Creation and manipulation"},{"refs":[{"id":"ref-for-a-promise-resolved-with\u2463\u2464"},{"id":"ref-for-a-promise-resolved-with\u2463\u2465"},{"id":"ref-for-a-promise-resolved-with\u2463\u2466"},{"id":"ref-for-a-promise-resolved-with\u2463\u2467"}],"title":"9.3.1. Creation and manipulation"}],"url":"https://webidl.spec.whatwg.org/#a-promise-resolved-with"}, "900ce14b": {"dfnID":"900ce14b","dfnText":"internal slot","external":true,"refSections":[{"refs":[{"id":"ref-for-sec-object-internal-methods-and-internal-slots"}],"title":"3. Conventions"}],"url":"https://tc39.es/ecma262/#sec-object-internal-methods-and-internal-slots"}, "904376f6": {"dfnID":"904376f6","dfnText":"the typed array constructors table","external":true,"refSections":[{"refs":[{"id":"ref-for-table-49"}],"title":"4.7.2. Internal slots"},{"refs":[{"id":"ref-for-table-49\u2460"},{"id":"ref-for-table-49\u2461"}],"title":"4.9.5. Byte stream controllers"}],"url":"https://tc39.es/ecma262/#table-49"}, "91890fa8": {"dfnID":"91890fa8","dfnText":"SharedArrayBuffer","external":true,"refSections":[{"refs":[{"id":"ref-for-sec-sharedarraybuffer-objects"}],"title":"9.2.1. Creation and manipulation"},{"refs":[{"id":"ref-for-sec-sharedarraybuffer-objects\u2460"}],"title":"9.3.1. Creation and manipulation"}],"url":"https://tc39.es/ecma262/#sec-sharedarraybuffer-objects"}, "93148e63": {"dfnID":"93148e63","dfnText":"async generator","external":true,"refSections":[{"refs":[{"id":"ref-for-sec-asyncgenerator-objects"}],"title":"4.2.4. Constructor, methods, and properties"}],"url":"https://tc39.es/ecma262/#sec-asyncgenerator-objects"}, "944206e4": {"dfnID":"944206e4","dfnText":"Construct","external":true,"refSections":[{"refs":[{"id":"ref-for-sec-construct"}],"title":"4.7.4. Internal methods"},{"refs":[{"id":"ref-for-sec-construct\u2460"},{"id":"ref-for-sec-construct\u2461"},{"id":"ref-for-sec-construct\u2462"},{"id":"ref-for-sec-construct\u2463"},{"id":"ref-for-sec-construct\u2464"}],"title":"4.9.5. Byte stream controllers"},{"refs":[{"id":"ref-for-sec-construct\u2465"}],"title":"8.3. Miscellaneous"}],"url":"https://tc39.es/ecma262/multipage/abstract-operations.html#sec-construct"}, "984221ca": {"dfnID":"984221ca","dfnText":"struct","external":true,"refSections":[{"refs":[{"id":"ref-for-struct"}],"title":"4.4.2. Internal slots"},{"refs":[{"id":"ref-for-struct\u2460"}],"title":"4.5.2. Internal slots"},{"refs":[{"id":"ref-for-struct\u2461"},{"id":"ref-for-struct\u2462"}],"title":"4.7.2. Internal slots"},{"refs":[{"id":"ref-for-struct\u2463"}],"title":"5.2.2. Internal slots"},{"refs":[{"id":"ref-for-struct\u2464"}],"title":"8.1. Queue-with-sizes"}],"url":"https://infra.spec.whatwg.org/#struct"}, "99c988d6": {"dfnID":"99c988d6","dfnText":"remove","external":true,"refSections":[{"refs":[{"id":"ref-for-list-remove"},{"id":"ref-for-list-remove\u2460"}],"title":"4.9.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-list-remove\u2461"},{"id":"ref-for-list-remove\u2462"},{"id":"ref-for-list-remove\u2463"},{"id":"ref-for-list-remove\u2464"}],"title":"4.9.5. Byte stream controllers"},{"refs":[{"id":"ref-for-list-remove\u2465"}],"title":"5.5.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-list-remove\u2466"}],"title":"8.1. Queue-with-sizes"}],"url":"https://infra.spec.whatwg.org/#list-remove"}, "9a7f3f6f": {"dfnID":"9a7f3f6f","dfnText":"asynchronous iterator initialization steps","external":true,"refSections":[{"refs":[{"id":"ref-for-asynchronous-iterator-initialization-steps"}],"title":"4.2.5. Asynchronous iteration"}],"url":"https://webidl.spec.whatwg.org/#asynchronous-iterator-initialization-steps"}, "9aa33dcf": {"dfnID":"9aa33dcf","dfnText":"async iterable","external":true,"refSections":[{"refs":[{"id":"ref-for-sec-asynciterable-interface"}],"title":"4.2.4. Constructor, methods, and properties"}],"url":"https://tc39.es/ecma262/#sec-asynciterable-interface"}, "9c4c1e66": {"dfnID":"9c4c1e66","dfnText":"relevant settings object","external":true,"refSections":[{"refs":[{"id":"ref-for-relevant-settings-object"}],"title":"7.2.2. Internal slots"},{"refs":[{"id":"ref-for-relevant-settings-object\u2460"}],"title":"7.3.2. Internal slots"}],"url":"https://html.spec.whatwg.org/multipage/webappapis.html#relevant-settings-object"}, "9c78f4e3": {"dfnID":"9c78f4e3","dfnText":"end of iteration","external":true,"refSections":[{"refs":[{"id":"ref-for-end-of-iteration"}],"title":"4.2.5. Asynchronous iteration"}],"url":"https://webidl.spec.whatwg.org/#end-of-iteration"}, "9ca1c179": {"dfnID":"9ca1c179","dfnText":"Memory","external":true,"refSections":[{"refs":[{"id":"ref-for-memory"}],"title":"8.3. Miscellaneous"}],"url":"https://webassembly.github.io/spec/js-api/#memory"}, "9cce47fd": {"dfnID":"9cce47fd","dfnText":"sequence","external":true,"refSections":[{"refs":[{"id":"ref-for-idl-sequence"}],"title":"4.2.1. Interface definition"}],"url":"https://webidl.spec.whatwg.org/#idl-sequence"}, "9da834a1": {"dfnID":"9da834a1","dfnText":"StructuredSerializeWithTransfer","external":true,"refSections":[{"refs":[{"id":"ref-for-structuredserializewithtransfer"}],"title":"4.2.6. Transfer via postMessage()"},{"refs":[{"id":"ref-for-structuredserializewithtransfer\u2460"}],"title":"5.2.5. Transfer via postMessage()"},{"refs":[{"id":"ref-for-structuredserializewithtransfer\u2461"},{"id":"ref-for-structuredserializewithtransfer\u2462"}],"title":"6.2.5. Transfer via postMessage()"},{"refs":[{"id":"ref-for-structuredserializewithtransfer\u2463"}],"title":"9.2.1. Creation and manipulation"},{"refs":[{"id":"ref-for-structuredserializewithtransfer\u2464"}],"title":"9.3.1. Creation and manipulation"}],"url":"https://html.spec.whatwg.org/multipage/structured-data.html#structuredserializewithtransfer"}, "9ff3511b": {"dfnID":"9ff3511b","dfnText":"fetch","external":true,"refSections":[{"refs":[{"id":"ref-for-service-worker-global-scope-fetch-event"}],"title":"1. Introduction"}],"url":"https://w3c.github.io/ServiceWorker/#service-worker-global-scope-fetch-event"}, "a053c42b": {"dfnID":"a053c42b","dfnText":"callback context","external":true,"refSections":[{"refs":[{"id":"ref-for-dfn-callback-context"}],"title":"7.2.2. Internal slots"},{"refs":[{"id":"ref-for-dfn-callback-context\u2460"}],"title":"7.3.2. Internal slots"}],"url":"https://webidl.spec.whatwg.org/#dfn-callback-context"}, "a32c65d4": {"dfnID":"a32c65d4","dfnText":"implements","external":true,"refSections":[{"refs":[{"id":"ref-for-implements"},{"id":"ref-for-implements\u2460"},{"id":"ref-for-implements\u2461"},{"id":"ref-for-implements\u2462"},{"id":"ref-for-implements\u2463"},{"id":"ref-for-implements\u2464"},{"id":"ref-for-implements\u2465"},{"id":"ref-for-implements\u2466"},{"id":"ref-for-implements\u2467"},{"id":"ref-for-implements\u2468"},{"id":"ref-for-implements\u2460\u24ea"},{"id":"ref-for-implements\u2460\u2460"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-implements\u2460\u2461"},{"id":"ref-for-implements\u2460\u2462"},{"id":"ref-for-implements\u2460\u2463"},{"id":"ref-for-implements\u2460\u2464"},{"id":"ref-for-implements\u2460\u2465"},{"id":"ref-for-implements\u2460\u2466"},{"id":"ref-for-implements\u2460\u2467"},{"id":"ref-for-implements\u2460\u2468"}],"title":"4.9.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-implements\u2461\u24ea"}],"title":"4.9.3. Readers"},{"refs":[{"id":"ref-for-implements\u2461\u2460"}],"title":"4.9.5. Byte stream controllers"},{"refs":[{"id":"ref-for-implements\u2461\u2461"}],"title":"5.5.4. Default controllers"},{"refs":[{"id":"ref-for-implements\u2461\u2462"}],"title":"6.4.2. Default controllers"},{"refs":[{"id":"ref-for-implements\u2461\u2463"},{"id":"ref-for-implements\u2461\u2464"},{"id":"ref-for-implements\u2461\u2465"},{"id":"ref-for-implements\u2461\u2466"},{"id":"ref-for-implements\u2461\u2467"},{"id":"ref-for-implements\u2461\u2468"},{"id":"ref-for-implements\u2462\u24ea"}],"title":"9.1.1. Creation and manipulation"}],"url":"https://webidl.spec.whatwg.org/#implements"}, "a3a4ba25": {"dfnID":"a3a4ba25","dfnText":"typed array","external":true,"refSections":[{"refs":[{"id":"ref-for-sec-typedarray-objects"}],"title":"2. Model"},{"refs":[{"id":"ref-for-sec-typedarray-objects\u2460"}],"title":"4.1. Using readable streams"},{"refs":[{"id":"ref-for-sec-typedarray-objects\u2462"}],"title":"4.8.2. Internal slots"},{"refs":[{"id":"ref-for-sec-typedarray-objects\u2467"}],"title":"9.1.1. Creation and manipulation"},{"refs":[{"id":"ref-for-sec-typedarray-objects\u2468"}],"title":"9.1.2. Reading"}],"url":"https://tc39.es/ecma262/#sec-typedarray-objects"}, "a3b18719": {"dfnID":"a3b18719","dfnText":"append (for set)","external":true,"refSections":[{"refs":[{"id":"ref-for-set-append"},{"id":"ref-for-set-append\u2460"}],"title":"4.9.1. Working with readable streams"}],"url":"https://infra.spec.whatwg.org/#set-append"}, "a53fbed9": {"dfnID":"a53fbed9","dfnText":"asynchronous iterator return","external":true,"refSections":[{"refs":[{"id":"ref-for-asynchronous-iterator-return"}],"title":"4.2.5. Asynchronous iteration"}],"url":"https://webidl.spec.whatwg.org/#asynchronous-iterator-return"}, "a72449dd": {"dfnID":"a72449dd","dfnText":"in parallel","external":true,"refSections":[{"refs":[{"id":"ref-for-in-parallel"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-in-parallel\u2460"}],"title":"9.2.1. Creation and manipulation"},{"refs":[{"id":"ref-for-in-parallel\u2461"}],"title":"9.3.1. Creation and manipulation"}],"url":"https://html.spec.whatwg.org/multipage/infrastructure.html#in-parallel"}, "a7900362": {"dfnID":"a7900362","dfnText":"include","external":true,"refSections":[{"refs":[{"id":"ref-for-include"}],"title":"9.3.2. Wrapping into a custom class"}],"url":"https://webidl.spec.whatwg.org/#include"}, "a7d0975c": {"dfnID":"a7d0975c","dfnText":"entangle","external":true,"refSections":[{"refs":[{"id":"ref-for-entangle"}],"title":"4.2.6. Transfer via postMessage()"},{"refs":[{"id":"ref-for-entangle\u2460"}],"title":"5.2.5. Transfer via postMessage()"}],"url":"https://html.spec.whatwg.org/multipage/web-messaging.html#entangle"}, "a9bf6bd5": {"dfnID":"a9bf6bd5","dfnText":"callback this value","external":true,"refSections":[{"refs":[{"id":"ref-for-dfn-callback-this-value"},{"id":"ref-for-dfn-callback-this-value\u2460"},{"id":"ref-for-dfn-callback-this-value\u2461"}],"title":"4.9.4. Default controllers"},{"refs":[{"id":"ref-for-dfn-callback-this-value\u2462"},{"id":"ref-for-dfn-callback-this-value\u2463"},{"id":"ref-for-dfn-callback-this-value\u2464"}],"title":"4.9.5. Byte stream controllers"},{"refs":[{"id":"ref-for-dfn-callback-this-value\u2465"},{"id":"ref-for-dfn-callback-this-value\u2466"},{"id":"ref-for-dfn-callback-this-value\u2467"},{"id":"ref-for-dfn-callback-this-value\u2468"}],"title":"5.5.4. Default controllers"},{"refs":[{"id":"ref-for-dfn-callback-this-value\u2460\u24ea"}],"title":"6.2.4. Constructor and properties"},{"refs":[{"id":"ref-for-dfn-callback-this-value\u2460\u2460"},{"id":"ref-for-dfn-callback-this-value\u2460\u2461"},{"id":"ref-for-dfn-callback-this-value\u2460\u2462"}],"title":"6.4.2. Default controllers"}],"url":"https://webidl.spec.whatwg.org/#dfn-callback-this-value"}, "abf85593": {"dfnID":"abf85593","dfnText":"Get","external":true,"refSections":[{"refs":[{"id":"ref-for-sec-get-o-p"},{"id":"ref-for-sec-get-o-p\u2460"},{"id":"ref-for-sec-get-o-p\u2461"},{"id":"ref-for-sec-get-o-p\u2462"}],"title":"8.2. Transferable streams"}],"url":"https://tc39.es/ecma262/multipage/abstract-operations.html#sec-get-o-p"}, "abort-a-writable-stream": {"dfnID":"abort-a-writable-stream","dfnText":"abort","external":false,"refSections":[{"refs":[{"id":"ref-for-abort-a-writable-stream"}],"title":"2.6. Locking"},{"refs":[{"id":"ref-for-abort-a-writable-stream\u2460"},{"id":"ref-for-abort-a-writable-stream\u2461"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-abort-a-writable-stream\u2462"}],"title":"5.2.3. The underlying sink API"},{"refs":[{"id":"ref-for-abort-a-writable-stream\u2463"}],"title":"5.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-abort-a-writable-stream\u2464"}],"title":"5.4.2. Internal slots"},{"refs":[{"id":"ref-for-abort-a-writable-stream\u2465"}],"title":"5.4.3. Methods and properties"},{"refs":[{"id":"ref-for-abort-a-writable-stream\u2466"}],"title":"5.5.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-abort-a-writable-stream\u2467"}],"title":"9.4.1. Duplex streams"},{"refs":[{"id":"ref-for-abort-a-writable-stream\u2468"}],"title":"10.11. Using an identity transform stream as a primitive to\ncreate new readable streams"}],"url":"#abort-a-writable-stream"}, "abstract-opdef-cancopydatablockbytes": {"dfnID":"abstract-opdef-cancopydatablockbytes","dfnText":"CanCopyDataBlockBytes(toBuffer, toIndex,\n fromBuffer, fromIndex, count)","external":false,"refSections":[{"refs":[{"id":"ref-for-abstract-opdef-cancopydatablockbytes"}],"title":"4.9.5. Byte stream controllers"}],"url":"#abstract-opdef-cancopydatablockbytes"}, "abstract-opdef-cloneasuint8array": {"dfnID":"abstract-opdef-cloneasuint8array","dfnText":"CloneAsUint8Array(O)","external":false,"refSections":[{"refs":[{"id":"ref-for-abstract-opdef-cloneasuint8array"},{"id":"ref-for-abstract-opdef-cloneasuint8array\u2460"}],"title":"4.9.1. Working with readable streams"}],"url":"#abstract-opdef-cloneasuint8array"}, "abstract-opdef-createreadablebytestream": {"dfnID":"abstract-opdef-createreadablebytestream","dfnText":"CreateReadableByteStream(startAlgorithm,\n pullAlgorithm, cancelAlgorithm)","external":false,"refSections":[{"refs":[{"id":"ref-for-abstract-opdef-createreadablebytestream"},{"id":"ref-for-abstract-opdef-createreadablebytestream\u2460"}],"title":"4.9.1. Working with readable streams"}],"url":"#abstract-opdef-createreadablebytestream"}, "abstract-opdef-crossrealmtransformsenderror": {"dfnID":"abstract-opdef-crossrealmtransformsenderror","dfnText":"CrossRealmTransformSendError(port,\n error)","external":false,"refSections":[{"refs":[{"id":"ref-for-abstract-opdef-crossrealmtransformsenderror"},{"id":"ref-for-abstract-opdef-crossrealmtransformsenderror\u2460"},{"id":"ref-for-abstract-opdef-crossrealmtransformsenderror\u2461"}],"title":"8.2. Transferable streams"}],"url":"#abstract-opdef-crossrealmtransformsenderror"}, "abstract-opdef-packandpostmessage": {"dfnID":"abstract-opdef-packandpostmessage","dfnText":"PackAndPostMessage(port, type, value)","external":false,"refSections":[{"refs":[{"id":"ref-for-abstract-opdef-packandpostmessage"},{"id":"ref-for-abstract-opdef-packandpostmessage\u2460"},{"id":"ref-for-abstract-opdef-packandpostmessage\u2461"},{"id":"ref-for-abstract-opdef-packandpostmessage\u2462"}],"title":"8.2. Transferable streams"}],"url":"#abstract-opdef-packandpostmessage"}, "abstract-opdef-packandpostmessagehandlingerror": {"dfnID":"abstract-opdef-packandpostmessagehandlingerror","dfnText":"PackAndPostMessageHandlingError(port,\n type, value)","external":false,"refSections":[{"refs":[{"id":"ref-for-abstract-opdef-packandpostmessagehandlingerror"},{"id":"ref-for-abstract-opdef-packandpostmessagehandlingerror\u2460"},{"id":"ref-for-abstract-opdef-packandpostmessagehandlingerror\u2461"}],"title":"8.2. Transferable streams"}],"url":"#abstract-opdef-packandpostmessagehandlingerror"}, "abstract-opdef-readablebytestreamcontroller-releasesteps": {"dfnID":"abstract-opdef-readablebytestreamcontroller-releasesteps","dfnText":"[[ReleaseSteps]]()","external":false,"refSections":[],"url":"#abstract-opdef-readablebytestreamcontroller-releasesteps"}, "abstract-opdef-readablebytestreamcontrollerenqueueclonedchunktoqueue": {"dfnID":"abstract-opdef-readablebytestreamcontrollerenqueueclonedchunktoqueue","dfnText":"ReadableByteStreamControllerEnqueueClonedChunkToQueue(controller,\n buffer, byteOffset, byteLength)","external":false,"refSections":[{"refs":[{"id":"ref-for-abstract-opdef-readablebytestreamcontrollerenqueueclonedchunktoqueue"},{"id":"ref-for-abstract-opdef-readablebytestreamcontrollerenqueueclonedchunktoqueue\u2460"}],"title":"4.9.5. Byte stream controllers"}],"url":"#abstract-opdef-readablebytestreamcontrollerenqueueclonedchunktoqueue"}, "abstract-opdef-readablebytestreamcontrollerenqueuedetachedpullintotoqueue": {"dfnID":"abstract-opdef-readablebytestreamcontrollerenqueuedetachedpullintotoqueue","dfnText":"ReadableByteStreamControllerEnqueueDetachedPullIntoToQueue(controller,\n pullIntoDescriptor)","external":false,"refSections":[{"refs":[{"id":"ref-for-abstract-opdef-readablebytestreamcontrollerenqueuedetachedpullintotoqueue"},{"id":"ref-for-abstract-opdef-readablebytestreamcontrollerenqueuedetachedpullintotoqueue\u2460"}],"title":"4.9.5. Byte stream controllers"}],"url":"#abstract-opdef-readablebytestreamcontrollerenqueuedetachedpullintotoqueue"}, "abstract-opdef-readablebytestreamcontrollerfillreadrequestfromqueue": {"dfnID":"abstract-opdef-readablebytestreamcontrollerfillreadrequestfromqueue","dfnText":"ReadableByteStreamControllerFillReadRequestFromQueue(controller,\n readRequest)","external":false,"refSections":[{"refs":[{"id":"ref-for-abstract-opdef-readablebytestreamcontrollerfillreadrequestfromqueue"}],"title":"4.7.4. Internal methods"},{"refs":[{"id":"ref-for-abstract-opdef-readablebytestreamcontrollerfillreadrequestfromqueue\u2460"}],"title":"4.9.5. Byte stream controllers"}],"url":"#abstract-opdef-readablebytestreamcontrollerfillreadrequestfromqueue"}, "abstract-opdef-readablebytestreamcontrollergetbyobrequest": {"dfnID":"abstract-opdef-readablebytestreamcontrollergetbyobrequest","dfnText":"ReadableByteStreamControllerGetBYOBRequest(controller)","external":false,"refSections":[{"refs":[{"id":"ref-for-abstract-opdef-readablebytestreamcontrollergetbyobrequest"}],"title":"4.7.3. Methods and properties"},{"refs":[{"id":"ref-for-abstract-opdef-readablebytestreamcontrollergetbyobrequest\u2460"},{"id":"ref-for-abstract-opdef-readablebytestreamcontrollergetbyobrequest\u2461"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-abstract-opdef-readablebytestreamcontrollergetbyobrequest\u2462"}],"title":"9.1.1. Creation and manipulation"}],"url":"#abstract-opdef-readablebytestreamcontrollergetbyobrequest"}, "abstract-opdef-readablebytestreamcontrollerprocessreadrequestsusingqueue": {"dfnID":"abstract-opdef-readablebytestreamcontrollerprocessreadrequestsusingqueue","dfnText":"ReadableByteStreamControllerProcessReadRequestsUsingQueue(controller)","external":false,"refSections":[{"refs":[{"id":"ref-for-abstract-opdef-readablebytestreamcontrollerprocessreadrequestsusingqueue"}],"title":"4.9.5. Byte stream controllers"}],"url":"#abstract-opdef-readablebytestreamcontrollerprocessreadrequestsusingqueue"}, "abstract-opdef-readablebytestreamtee": {"dfnID":"abstract-opdef-readablebytestreamtee","dfnText":"ReadableByteStreamTee(stream)","external":false,"refSections":[{"refs":[{"id":"ref-for-abstract-opdef-readablebytestreamtee"}],"title":"4.9.1. Working with readable streams"}],"url":"#abstract-opdef-readablebytestreamtee"}, "abstract-opdef-readablestreambyobreadererrorreadintorequests": {"dfnID":"abstract-opdef-readablestreambyobreadererrorreadintorequests","dfnText":"ReadableStreamBYOBReaderErrorReadIntoRequests(reader, e)","external":false,"refSections":[{"refs":[{"id":"ref-for-abstract-opdef-readablestreambyobreadererrorreadintorequests"}],"title":"4.9.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-abstract-opdef-readablestreambyobreadererrorreadintorequests\u2460"}],"title":"4.9.3. Readers"}],"url":"#abstract-opdef-readablestreambyobreadererrorreadintorequests"}, "abstract-opdef-readablestreambyobreaderrelease": {"dfnID":"abstract-opdef-readablestreambyobreaderrelease","dfnText":"ReadableStreamBYOBReaderRelease(reader)","external":false,"refSections":[{"refs":[{"id":"ref-for-abstract-opdef-readablestreambyobreaderrelease"}],"title":"4.5.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-abstract-opdef-readablestreambyobreaderrelease\u2460"},{"id":"ref-for-abstract-opdef-readablestreambyobreaderrelease\u2461"}],"title":"4.9.1. Working with readable streams"}],"url":"#abstract-opdef-readablestreambyobreaderrelease"}, "abstract-opdef-readablestreamcontroller-cancelsteps": {"dfnID":"abstract-opdef-readablestreamcontroller-cancelsteps","dfnText":"[[CancelSteps]](reason)","external":false,"refSections":[{"refs":[{"id":"ref-for-abstract-opdef-readablestreamcontroller-cancelsteps"}],"title":"4.6.4. Internal methods"},{"refs":[{"id":"ref-for-abstract-opdef-readablestreamcontroller-cancelsteps\u2460"}],"title":"4.7.4. Internal methods"},{"refs":[{"id":"ref-for-abstract-opdef-readablestreamcontroller-cancelsteps\u2461"}],"title":"4.9.2. Interfacing with controllers"}],"url":"#abstract-opdef-readablestreamcontroller-cancelsteps"}, "abstract-opdef-readablestreamcontroller-pullsteps": {"dfnID":"abstract-opdef-readablestreamcontroller-pullsteps","dfnText":"[[PullSteps]](readRequest)","external":false,"refSections":[{"refs":[{"id":"ref-for-abstract-opdef-readablestreamcontroller-pullsteps"}],"title":"4.6.4. Internal methods"},{"refs":[{"id":"ref-for-abstract-opdef-readablestreamcontroller-pullsteps\u2460"}],"title":"4.7.4. Internal methods"},{"refs":[{"id":"ref-for-abstract-opdef-readablestreamcontroller-pullsteps\u2461"}],"title":"4.9.3. Readers"}],"url":"#abstract-opdef-readablestreamcontroller-pullsteps"}, "abstract-opdef-readablestreamcontroller-releasesteps": {"dfnID":"abstract-opdef-readablestreamcontroller-releasesteps","dfnText":"[[ReleaseSteps]]()","external":false,"refSections":[{"refs":[{"id":"ref-for-abstract-opdef-readablestreamcontroller-releasesteps"}],"title":"4.6.4. Internal methods"},{"refs":[{"id":"ref-for-abstract-opdef-readablestreamcontroller-releasesteps\u2460"}],"title":"4.7.4. Internal methods"},{"refs":[{"id":"ref-for-abstract-opdef-readablestreamcontroller-releasesteps\u2461"}],"title":"4.9.3. Readers"}],"url":"#abstract-opdef-readablestreamcontroller-releasesteps"}, "abstract-opdef-readablestreamdefaultcontroller-releasesteps": {"dfnID":"abstract-opdef-readablestreamdefaultcontroller-releasesteps","dfnText":"[[ReleaseSteps]]()","external":false,"refSections":[],"url":"#abstract-opdef-readablestreamdefaultcontroller-releasesteps"}, "abstract-opdef-readablestreamdefaultreadererrorreadrequests": {"dfnID":"abstract-opdef-readablestreamdefaultreadererrorreadrequests","dfnText":"ReadableStreamDefaultReaderErrorReadRequests(reader, e)","external":false,"refSections":[{"refs":[{"id":"ref-for-abstract-opdef-readablestreamdefaultreadererrorreadrequests"}],"title":"4.9.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-abstract-opdef-readablestreamdefaultreadererrorreadrequests\u2460"}],"title":"4.9.3. Readers"}],"url":"#abstract-opdef-readablestreamdefaultreadererrorreadrequests"}, "abstract-opdef-readablestreamdefaultreaderrelease": {"dfnID":"abstract-opdef-readablestreamdefaultreaderrelease","dfnText":"ReadableStreamDefaultReaderRelease(reader)","external":false,"refSections":[{"refs":[{"id":"ref-for-abstract-opdef-readablestreamdefaultreaderrelease"},{"id":"ref-for-abstract-opdef-readablestreamdefaultreaderrelease\u2460"},{"id":"ref-for-abstract-opdef-readablestreamdefaultreaderrelease\u2461"},{"id":"ref-for-abstract-opdef-readablestreamdefaultreaderrelease\u2462"}],"title":"4.2.5. Asynchronous iteration"},{"refs":[{"id":"ref-for-abstract-opdef-readablestreamdefaultreaderrelease\u2463"}],"title":"4.4.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-abstract-opdef-readablestreamdefaultreaderrelease\u2464"},{"id":"ref-for-abstract-opdef-readablestreamdefaultreaderrelease\u2465"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-abstract-opdef-readablestreamdefaultreaderrelease\u2466"}],"title":"9.1.2. Reading"}],"url":"#abstract-opdef-readablestreamdefaultreaderrelease"}, "abstract-opdef-readablestreamdefaulttee": {"dfnID":"abstract-opdef-readablestreamdefaulttee","dfnText":"ReadableStreamDefaultTee(stream,\n cloneForBranch2)","external":false,"refSections":[{"refs":[{"id":"ref-for-abstract-opdef-readablestreamdefaulttee"}],"title":"4.9.1. Working with readable streams"}],"url":"#abstract-opdef-readablestreamdefaulttee"}, "abstract-opdef-setupcrossrealmtransformreadable": {"dfnID":"abstract-opdef-setupcrossrealmtransformreadable","dfnText":"SetUpCrossRealmTransformReadable(stream,\n port)","external":false,"refSections":[{"refs":[{"id":"ref-for-abstract-opdef-setupcrossrealmtransformreadable"}],"title":"4.2.6. Transfer via postMessage()"},{"refs":[{"id":"ref-for-abstract-opdef-setupcrossrealmtransformreadable\u2460"}],"title":"5.2.5. Transfer via postMessage()"}],"url":"#abstract-opdef-setupcrossrealmtransformreadable"}, "abstract-opdef-setupcrossrealmtransformwritable": {"dfnID":"abstract-opdef-setupcrossrealmtransformwritable","dfnText":"SetUpCrossRealmTransformWritable(stream,\n port)","external":false,"refSections":[{"refs":[{"id":"ref-for-abstract-opdef-setupcrossrealmtransformwritable"}],"title":"4.2.6. Transfer via postMessage()"},{"refs":[{"id":"ref-for-abstract-opdef-setupcrossrealmtransformwritable\u2460"}],"title":"5.2.5. Transfer via postMessage()"}],"url":"#abstract-opdef-setupcrossrealmtransformwritable"}, "abstract-opdef-structuredclone": {"dfnID":"abstract-opdef-structuredclone","dfnText":"StructuredClone(v)","external":false,"refSections":[{"refs":[{"id":"ref-for-abstract-opdef-structuredclone"}],"title":"4.9.1. Working with readable streams"}],"url":"#abstract-opdef-structuredclone"}, "abstract-opdef-writablestreamcontroller-abortsteps": {"dfnID":"abstract-opdef-writablestreamcontroller-abortsteps","dfnText":"[[AbortSteps]](reason)","external":false,"refSections":[{"refs":[{"id":"ref-for-abstract-opdef-writablestreamcontroller-abortsteps"}],"title":"5.4.4. Internal methods"},{"refs":[{"id":"ref-for-abstract-opdef-writablestreamcontroller-abortsteps\u2460"}],"title":"5.5.2. Interfacing with controllers"}],"url":"#abstract-opdef-writablestreamcontroller-abortsteps"}, "abstract-opdef-writablestreamcontroller-errorsteps": {"dfnID":"abstract-opdef-writablestreamcontroller-errorsteps","dfnText":"[[ErrorSteps]]()","external":false,"refSections":[{"refs":[{"id":"ref-for-abstract-opdef-writablestreamcontroller-errorsteps"}],"title":"5.4.4. Internal methods"},{"refs":[{"id":"ref-for-abstract-opdef-writablestreamcontroller-errorsteps\u2460"}],"title":"5.5.2. Interfacing with controllers"}],"url":"#abstract-opdef-writablestreamcontroller-errorsteps"}, "acquire-readable-stream-byob-reader": {"dfnID":"acquire-readable-stream-byob-reader","dfnText":"AcquireReadableStreamBYOBReader(stream)","external":false,"refSections":[{"refs":[{"id":"ref-for-acquire-readable-stream-byob-reader"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-acquire-readable-stream-byob-reader\u2460"},{"id":"ref-for-acquire-readable-stream-byob-reader\u2461"}],"title":"4.9.1. Working with readable streams"}],"url":"#acquire-readable-stream-byob-reader"}, "acquire-readable-stream-reader": {"dfnID":"acquire-readable-stream-reader","dfnText":"AcquireReadableStreamDefaultReader(stream)","external":false,"refSections":[{"refs":[{"id":"ref-for-acquire-readable-stream-reader"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-acquire-readable-stream-reader\u2460"}],"title":"4.2.5. Asynchronous iteration"},{"refs":[{"id":"ref-for-acquire-readable-stream-reader\u2461"},{"id":"ref-for-acquire-readable-stream-reader\u2462"},{"id":"ref-for-acquire-readable-stream-reader\u2463"},{"id":"ref-for-acquire-readable-stream-reader\u2464"},{"id":"ref-for-acquire-readable-stream-reader\u2465"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-acquire-readable-stream-reader\u2466"}],"title":"9.1.2. Reading"}],"url":"#acquire-readable-stream-reader"}, "acquire-writable-stream-default-writer": {"dfnID":"acquire-writable-stream-default-writer","dfnText":"AcquireWritableStreamDefaultWriter(stream)","external":false,"refSections":[{"refs":[{"id":"ref-for-acquire-writable-stream-default-writer"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-acquire-writable-stream-default-writer\u2460"}],"title":"5.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-acquire-writable-stream-default-writer\u2461"}],"title":"9.2.2. Writing"}],"url":"#acquire-writable-stream-default-writer"}, "active": {"dfnID":"active","dfnText":"active","external":false,"refSections":[{"refs":[{"id":"ref-for-active"},{"id":"ref-for-active\u2460"}],"title":"4.4.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-active\u2461"},{"id":"ref-for-active\u2462"}],"title":"4.5.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-active\u2463"},{"id":"ref-for-active\u2464"},{"id":"ref-for-active\u2465"}],"title":"5.3.3. Constructor, methods, and properties"}],"url":"#active"}, "ae46556f": {"dfnID":"ae46556f","dfnText":"Function","external":true,"refSections":[{"refs":[{"id":"ref-for-Function"}],"title":"7.2.1. Interface definition"},{"refs":[{"id":"ref-for-Function\u2460"},{"id":"ref-for-Function\u2461"}],"title":"7.2.2. Internal slots"},{"refs":[{"id":"ref-for-Function\u2462"}],"title":"7.3.1. Interface definition"},{"refs":[{"id":"ref-for-Function\u2463"},{"id":"ref-for-Function\u2464"}],"title":"7.3.2. Internal slots"}],"url":"https://webidl.spec.whatwg.org/#Function"}, "b262501e": {"dfnID":"b262501e","dfnText":"reject","external":true,"refSections":[{"refs":[{"id":"ref-for-reject"}],"title":"4.2.5. Asynchronous iteration"},{"refs":[{"id":"ref-for-reject\u2460"}],"title":"4.4.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-reject\u2461"}],"title":"4.5.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-reject\u2462"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-reject\u2463"}],"title":"4.9.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-reject\u2464"}],"title":"4.9.3. Readers"},{"refs":[{"id":"ref-for-reject\u2465"},{"id":"ref-for-reject\u2466"},{"id":"ref-for-reject\u2467"},{"id":"ref-for-reject\u2468"},{"id":"ref-for-reject\u2460\u24ea"},{"id":"ref-for-reject\u2460\u2460"},{"id":"ref-for-reject\u2460\u2461"},{"id":"ref-for-reject\u2460\u2462"}],"title":"5.5.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-reject\u2460\u2463"},{"id":"ref-for-reject\u2460\u2464"}],"title":"5.5.3. Writers"},{"refs":[{"id":"ref-for-reject\u2460\u2465"},{"id":"ref-for-reject\u2460\u2466"},{"id":"ref-for-reject\u2460\u2467"},{"id":"ref-for-reject\u2460\u2468"}],"title":"6.4.3. Default sinks"},{"refs":[{"id":"ref-for-reject\u2461\u24ea"},{"id":"ref-for-reject\u2461\u2460"}],"title":"6.4.4. Default sources"},{"refs":[{"id":"ref-for-reject\u2461\u2461"}],"title":"9.2.1. Creation and manipulation"}],"url":"https://webidl.spec.whatwg.org/#reject"}, "b5d2d271": {"dfnID":"b5d2d271","dfnText":"%Object.prototype%","external":true,"refSections":[{"refs":[{"id":"ref-for-sec-properties-of-the-object-prototype-object"}],"title":"8.2. Transferable streams"}],"url":"https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-properties-of-the-object-prototype-object"}, "backpressure": {"dfnID":"backpressure","dfnText":"backpressure","external":false,"refSections":[{"refs":[{"id":"ref-for-backpressure"}],"title":"1. Introduction"},{"refs":[{"id":"ref-for-backpressure\u2460"}],"title":"2.4. Pipe chains and backpressure"},{"refs":[{"id":"ref-for-backpressure\u2461"}],"title":"2.5. Internal queues and queuing strategies"},{"refs":[{"id":"ref-for-backpressure\u2462"},{"id":"ref-for-backpressure\u2463"}],"title":"4.1. Using readable streams"},{"refs":[{"id":"ref-for-backpressure\u2464"}],"title":"4.6.2. Internal slots"},{"refs":[{"id":"ref-for-backpressure\u2465"}],"title":"4.6.3. Methods and properties"},{"refs":[{"id":"ref-for-backpressure\u2466"}],"title":"4.7.2. Internal slots"},{"refs":[{"id":"ref-for-backpressure\u2467"}],"title":"4.7.3. Methods and properties"},{"refs":[{"id":"ref-for-backpressure\u2468"},{"id":"ref-for-backpressure\u2460\u24ea"},{"id":"ref-for-backpressure\u2460\u2460"}],"title":"5.1. Using writable streams"},{"refs":[{"id":"ref-for-backpressure\u2460\u2461"}],"title":"5.3.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-backpressure\u2460\u2462"}],"title":"5.4.2. Internal slots"},{"refs":[{"id":"ref-for-backpressure\u2460\u2463"}],"title":"6.1. Using transform streams"},{"refs":[{"id":"ref-for-backpressure\u2460\u2464"}],"title":"7.1. The queuing strategy API"},{"refs":[{"id":"ref-for-backpressure\u2460\u2465"},{"id":"ref-for-backpressure\u2460\u2466"}],"title":"7.2. The ByteLengthQueuingStrategy class"},{"refs":[{"id":"ref-for-backpressure\u2460\u2467"},{"id":"ref-for-backpressure\u2460\u2468"}],"title":"7.3. The CountQueuingStrategy class"},{"refs":[{"id":"ref-for-backpressure\u2461\u24ea"}],"title":"7.4. Abstract operations"},{"refs":[{"id":"ref-for-backpressure\u2461\u2460"}],"title":"9.1.1. Creation and manipulation"},{"refs":[{"id":"ref-for-backpressure\u2461\u2461"}],"title":"10.2. A readable stream with an underlying push source and\nbackpressure support"},{"refs":[{"id":"ref-for-backpressure\u2461\u2462"}],"title":"10.6. A writable stream with no backpressure or success signals"},{"refs":[{"id":"ref-for-backpressure\u2461\u2463"}],"title":"10.7. A writable stream with backpressure and success signals"}],"url":"#backpressure"}, "bdbd19d1": {"dfnID":"bdbd19d1","dfnText":"Promise","external":true,"refSections":[{"refs":[{"id":"ref-for-idl-promise"},{"id":"ref-for-idl-promise\u2460"}],"title":"4.2.1. Interface definition"},{"refs":[{"id":"ref-for-idl-promise\u2461"},{"id":"ref-for-idl-promise\u2462"}],"title":"4.2.3. The underlying source API"},{"refs":[{"id":"ref-for-idl-promise\u2463"},{"id":"ref-for-idl-promise\u2464"}],"title":"4.3.1. Mixin definition"},{"refs":[{"id":"ref-for-idl-promise\u2465"}],"title":"4.4.1. Interface definition"},{"refs":[{"id":"ref-for-idl-promise\u2466"}],"title":"4.5.1. Interface definition"},{"refs":[{"id":"ref-for-idl-promise\u2467"},{"id":"ref-for-idl-promise\u2468"}],"title":"5.2.1. Interface definition"},{"refs":[{"id":"ref-for-idl-promise\u2460\u24ea"},{"id":"ref-for-idl-promise\u2460\u2460"},{"id":"ref-for-idl-promise\u2460\u2461"}],"title":"5.2.3. The underlying sink API"},{"refs":[{"id":"ref-for-idl-promise\u2460\u2462"},{"id":"ref-for-idl-promise\u2460\u2463"},{"id":"ref-for-idl-promise\u2460\u2464"},{"id":"ref-for-idl-promise\u2460\u2465"},{"id":"ref-for-idl-promise\u2460\u2466"}],"title":"5.3.1. Interface definition"},{"refs":[{"id":"ref-for-idl-promise\u2460\u2467"},{"id":"ref-for-idl-promise\u2460\u2468"},{"id":"ref-for-idl-promise\u2461\u24ea"}],"title":"6.2.3. The transformer API"},{"refs":[{"id":"ref-for-idl-promise\u2461\u2460"},{"id":"ref-for-idl-promise\u2461\u2461"},{"id":"ref-for-idl-promise\u2461\u2462"},{"id":"ref-for-idl-promise\u2461\u2463"}],"title":"9.1.1. Creation and manipulation"},{"refs":[{"id":"ref-for-idl-promise\u2461\u2464"},{"id":"ref-for-idl-promise\u2461\u2465"}],"title":"9.2.1. Creation and manipulation"},{"refs":[{"id":"ref-for-idl-promise\u2461\u2466"},{"id":"ref-for-idl-promise\u2461\u2467"},{"id":"ref-for-idl-promise\u2461\u2468"}],"title":"9.3.1. Creation and manipulation"},{"refs":[{"id":"ref-for-idl-promise\u2462\u24ea"}],"title":"9.5. Piping"}],"url":"https://webidl.spec.whatwg.org/#idl-promise"}, "blqs-constructor": {"dfnID":"blqs-constructor","dfnText":"new ByteLengthQueuingStrategy(init)","external":false,"refSections":[{"refs":[{"id":"ref-for-blqs-constructor"}],"title":"7.2.1. Interface definition"},{"refs":[{"id":"ref-for-blqs-constructor\u2460"}],"title":"7.2.3. Constructor and properties"}],"url":"#blqs-constructor"}, "blqs-high-water-mark": {"dfnID":"blqs-high-water-mark","dfnText":"highWaterMark","external":false,"refSections":[{"refs":[{"id":"ref-for-blqs-high-water-mark"}],"title":"7.2.1. Interface definition"},{"refs":[{"id":"ref-for-blqs-high-water-mark\u2460"}],"title":"7.2.3. Constructor and properties"}],"url":"#blqs-high-water-mark"}, "blqs-size": {"dfnID":"blqs-size","dfnText":"size","external":false,"refSections":[{"refs":[{"id":"ref-for-blqs-size"}],"title":"7.2.1. Interface definition"},{"refs":[{"id":"ref-for-blqs-size\u2460"}],"title":"7.2.2. Internal slots"},{"refs":[{"id":"ref-for-blqs-size\u2461"}],"title":"7.2.3. Constructor and properties"}],"url":"#blqs-size"}, "branches-of-a-readable-stream-tee": {"dfnID":"branches-of-a-readable-stream-tee","dfnText":"branches","external":false,"refSections":[{"refs":[{"id":"ref-for-branches-of-a-readable-stream-tee"}],"title":"2.4. Pipe chains and backpressure"}],"url":"#branches-of-a-readable-stream-tee"}, "byob-reader": {"dfnID":"byob-reader","dfnText":"BYOB readers","external":false,"refSections":[{"refs":[{"id":"ref-for-byob-reader"}],"title":"2.1. Readable streams"},{"refs":[{"id":"ref-for-byob-reader\u2460"}],"title":"4.1. Using readable streams"},{"refs":[{"id":"ref-for-byob-reader\u2461"},{"id":"ref-for-byob-reader\u2462"}],"title":"4.2.3. The underlying source API"},{"refs":[{"id":"ref-for-byob-reader\u2463"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-byob-reader\u2464"}],"title":"4.5. The ReadableStreamBYOBReader class"},{"refs":[{"id":"ref-for-byob-reader\u2465"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-byob-reader\u2466"},{"id":"ref-for-byob-reader\u2467"},{"id":"ref-for-byob-reader\u2468"}],"title":"10.3. A readable byte stream with an underlying push source (no backpressure\nsupport)"},{"refs":[{"id":"ref-for-byob-reader\u2460\u24ea"}],"title":"10.5. A readable byte stream with an underlying pull source"}],"url":"#byob-reader"}, "byob-reader-constructor": {"dfnID":"byob-reader-constructor","dfnText":"new ReadableStreamBYOBReader(stream)","external":false,"refSections":[{"refs":[{"id":"ref-for-byob-reader-constructor"}],"title":"4.5.1. Interface definition"},{"refs":[{"id":"ref-for-byob-reader-constructor\u2460"}],"title":"4.5.3. Constructor, methods, and properties"}],"url":"#byob-reader-constructor"}, "byob-reader-read": {"dfnID":"byob-reader-read","dfnText":"read(view, options)","external":false,"refSections":[{"refs":[{"id":"ref-for-byob-reader-read"}],"title":"4.1. Using readable streams"},{"refs":[{"id":"ref-for-byob-reader-read\u2460"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-byob-reader-read\u2461"}],"title":"4.5.1. Interface definition"},{"refs":[{"id":"ref-for-byob-reader-read\u2462"},{"id":"ref-for-byob-reader-read\u2463"}],"title":"4.5.2. Internal slots"},{"refs":[{"id":"ref-for-byob-reader-read\u2464"},{"id":"ref-for-byob-reader-read\u2465"}],"title":"4.5.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-byob-reader-read\u2466"}],"title":"4.7.2. Internal slots"},{"refs":[{"id":"ref-for-byob-reader-read\u2467"},{"id":"ref-for-byob-reader-read\u2468"}],"title":"4.9.5. Byte stream controllers"}],"url":"#byob-reader-read"}, "byob-reader-release-lock": {"dfnID":"byob-reader-release-lock","dfnText":"releaseLock()","external":false,"refSections":[{"refs":[{"id":"ref-for-byob-reader-release-lock"}],"title":"2.6. Locking"},{"refs":[{"id":"ref-for-byob-reader-release-lock\u2460"}],"title":"4.5.1. Interface definition"},{"refs":[{"id":"ref-for-byob-reader-release-lock\u2461"}],"title":"4.5.3. Constructor, methods, and properties"}],"url":"#byob-reader-release-lock"}, "byte-length-queuing-strategy-size-function": {"dfnID":"byte-length-queuing-strategy-size-function","dfnText":"byte length queuing\n strategy size function","external":false,"refSections":[{"refs":[{"id":"ref-for-byte-length-queuing-strategy-size-function"}],"title":"7.2.2. Internal slots"},{"refs":[{"id":"ref-for-byte-length-queuing-strategy-size-function\u2460"}],"title":"7.2.3. Constructor and properties"}],"url":"#byte-length-queuing-strategy-size-function"}, "bytelengthqueuingstrategy": {"dfnID":"bytelengthqueuingstrategy","dfnText":"ByteLengthQueuingStrategy","external":false,"refSections":[{"refs":[{"id":"ref-for-bytelengthqueuingstrategy"}],"title":"7.1. The queuing strategy API"},{"refs":[{"id":"ref-for-bytelengthqueuingstrategy\u2460"},{"id":"ref-for-bytelengthqueuingstrategy\u2461"},{"id":"ref-for-bytelengthqueuingstrategy\u2462"}],"title":"7.2. The ByteLengthQueuingStrategy class"},{"refs":[{"id":"ref-for-bytelengthqueuingstrategy\u2463"}],"title":"7.2.1. Interface definition"},{"refs":[{"id":"ref-for-bytelengthqueuingstrategy\u2464"}],"title":"7.2.2. Internal slots"},{"refs":[{"id":"ref-for-bytelengthqueuingstrategy\u2465"},{"id":"ref-for-bytelengthqueuingstrategy\u2466"}],"title":"7.2.3. Constructor and properties"}],"url":"#bytelengthqueuingstrategy"}, "bytelengthqueuingstrategy-highwatermark": {"dfnID":"bytelengthqueuingstrategy-highwatermark","dfnText":"[[highWaterMark]]","external":false,"refSections":[{"refs":[{"id":"ref-for-bytelengthqueuingstrategy-highwatermark"},{"id":"ref-for-bytelengthqueuingstrategy-highwatermark\u2460"}],"title":"7.2.3. Constructor and properties"}],"url":"#bytelengthqueuingstrategy-highwatermark"}, "c01cbda0": {"dfnID":"c01cbda0","dfnText":"EnforceRange","external":true,"refSections":[{"refs":[{"id":"ref-for-EnforceRange"}],"title":"4.2.3. The underlying source API"},{"refs":[{"id":"ref-for-EnforceRange\u2460"}],"title":"4.5.1. Interface definition"},{"refs":[{"id":"ref-for-EnforceRange\u2461"}],"title":"4.8.1. Interface definition"}],"url":"https://webidl.spec.whatwg.org/#EnforceRange"}, "c5c13e72": {"dfnID":"c5c13e72","dfnText":"Completion Records","external":true,"refSections":[{"refs":[{"id":"ref-for-sec-completion-record-specification-type"}],"title":"3. Conventions"},{"refs":[{"id":"ref-for-sec-completion-record-specification-type\u2460"}],"title":"4.9.4. Default controllers"},{"refs":[{"id":"ref-for-sec-completion-record-specification-type\u2461"}],"title":"5.5.4. Default controllers"}],"url":"https://tc39.es/ecma262/multipage/ecmascript-data-types-and-values.html#sec-completion-record-specification-type"}, "c88f3887": {"dfnID":"c88f3887","dfnText":"item","external":true,"refSections":[{"refs":[{"id":"ref-for-struct-item"}],"title":"4.2.5. Asynchronous iteration"},{"refs":[{"id":"ref-for-struct-item\u2460"}],"title":"4.4.2. Internal slots"},{"refs":[{"id":"ref-for-struct-item\u2461"}],"title":"4.4.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-struct-item\u2462"}],"title":"4.5.2. Internal slots"},{"refs":[{"id":"ref-for-struct-item\u2463"}],"title":"4.5.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-struct-item\u2464"},{"id":"ref-for-struct-item\u2465"}],"title":"4.7.2. Internal slots"},{"refs":[{"id":"ref-for-struct-item\u2466"},{"id":"ref-for-struct-item\u2467"},{"id":"ref-for-struct-item\u2468"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-struct-item\u2460\u24ea"}],"title":"5.2.2. Internal slots"},{"refs":[{"id":"ref-for-struct-item\u2460\u2460"}],"title":"8.1. Queue-with-sizes"},{"refs":[{"id":"ref-for-struct-item\u2460\u2461"}],"title":"9.1.2. Reading"}],"url":"https://infra.spec.whatwg.org/#struct-item"}, "cadf5fe9": {"dfnID":"cadf5fe9","dfnText":"converted to an IDL value","external":true,"refSections":[{"refs":[{"id":"ref-for-dfn-convert-ecmascript-to-idl-value"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-dfn-convert-ecmascript-to-idl-value\u2460"}],"title":"5.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-dfn-convert-ecmascript-to-idl-value\u2461"}],"title":"6.2.4. Constructor and properties"}],"url":"https://webidl.spec.whatwg.org/#dfn-convert-ecmascript-to-idl-value"}, "callbackdef-queuingstrategysize": {"dfnID":"callbackdef-queuingstrategysize","dfnText":"QueuingStrategySize","external":false,"refSections":[{"refs":[{"id":"ref-for-callbackdef-queuingstrategysize"},{"id":"ref-for-callbackdef-queuingstrategysize\u2460"}],"title":"7.1. The queuing strategy API"}],"url":"#callbackdef-queuingstrategysize"}, "callbackdef-transformercancelcallback": {"dfnID":"callbackdef-transformercancelcallback","dfnText":"TransformerCancelCallback","external":false,"refSections":[{"refs":[{"id":"ref-for-callbackdef-transformercancelcallback"},{"id":"ref-for-callbackdef-transformercancelcallback\u2460"}],"title":"6.2.3. The transformer API"}],"url":"#callbackdef-transformercancelcallback"}, "callbackdef-transformerflushcallback": {"dfnID":"callbackdef-transformerflushcallback","dfnText":"TransformerFlushCallback","external":false,"refSections":[{"refs":[{"id":"ref-for-callbackdef-transformerflushcallback"},{"id":"ref-for-callbackdef-transformerflushcallback\u2460"}],"title":"6.2.3. The transformer API"}],"url":"#callbackdef-transformerflushcallback"}, "callbackdef-transformerstartcallback": {"dfnID":"callbackdef-transformerstartcallback","dfnText":"TransformerStartCallback","external":false,"refSections":[{"refs":[{"id":"ref-for-callbackdef-transformerstartcallback"},{"id":"ref-for-callbackdef-transformerstartcallback\u2460"}],"title":"6.2.3. The transformer API"}],"url":"#callbackdef-transformerstartcallback"}, "callbackdef-transformertransformcallback": {"dfnID":"callbackdef-transformertransformcallback","dfnText":"TransformerTransformCallback","external":false,"refSections":[{"refs":[{"id":"ref-for-callbackdef-transformertransformcallback"},{"id":"ref-for-callbackdef-transformertransformcallback\u2460"}],"title":"6.2.3. The transformer API"}],"url":"#callbackdef-transformertransformcallback"}, "callbackdef-underlyingsinkabortcallback": {"dfnID":"callbackdef-underlyingsinkabortcallback","dfnText":"UnderlyingSinkAbortCallback","external":false,"refSections":[{"refs":[{"id":"ref-for-callbackdef-underlyingsinkabortcallback"},{"id":"ref-for-callbackdef-underlyingsinkabortcallback\u2460"}],"title":"5.2.3. The underlying sink API"}],"url":"#callbackdef-underlyingsinkabortcallback"}, "callbackdef-underlyingsinkclosecallback": {"dfnID":"callbackdef-underlyingsinkclosecallback","dfnText":"UnderlyingSinkCloseCallback","external":false,"refSections":[{"refs":[{"id":"ref-for-callbackdef-underlyingsinkclosecallback"},{"id":"ref-for-callbackdef-underlyingsinkclosecallback\u2460"}],"title":"5.2.3. The underlying sink API"}],"url":"#callbackdef-underlyingsinkclosecallback"}, "callbackdef-underlyingsinkstartcallback": {"dfnID":"callbackdef-underlyingsinkstartcallback","dfnText":"UnderlyingSinkStartCallback","external":false,"refSections":[{"refs":[{"id":"ref-for-callbackdef-underlyingsinkstartcallback"},{"id":"ref-for-callbackdef-underlyingsinkstartcallback\u2460"}],"title":"5.2.3. The underlying sink API"}],"url":"#callbackdef-underlyingsinkstartcallback"}, "callbackdef-underlyingsinkwritecallback": {"dfnID":"callbackdef-underlyingsinkwritecallback","dfnText":"UnderlyingSinkWriteCallback","external":false,"refSections":[{"refs":[{"id":"ref-for-callbackdef-underlyingsinkwritecallback"},{"id":"ref-for-callbackdef-underlyingsinkwritecallback\u2460"}],"title":"5.2.3. The underlying sink API"}],"url":"#callbackdef-underlyingsinkwritecallback"}, "callbackdef-underlyingsourcecancelcallback": {"dfnID":"callbackdef-underlyingsourcecancelcallback","dfnText":"UnderlyingSourceCancelCallback","external":false,"refSections":[{"refs":[{"id":"ref-for-callbackdef-underlyingsourcecancelcallback"},{"id":"ref-for-callbackdef-underlyingsourcecancelcallback\u2460"}],"title":"4.2.3. The underlying source API"}],"url":"#callbackdef-underlyingsourcecancelcallback"}, "callbackdef-underlyingsourcepullcallback": {"dfnID":"callbackdef-underlyingsourcepullcallback","dfnText":"UnderlyingSourcePullCallback","external":false,"refSections":[{"refs":[{"id":"ref-for-callbackdef-underlyingsourcepullcallback"},{"id":"ref-for-callbackdef-underlyingsourcepullcallback\u2460"}],"title":"4.2.3. The underlying source API"}],"url":"#callbackdef-underlyingsourcepullcallback"}, "callbackdef-underlyingsourcestartcallback": {"dfnID":"callbackdef-underlyingsourcestartcallback","dfnText":"UnderlyingSourceStartCallback","external":false,"refSections":[{"refs":[{"id":"ref-for-callbackdef-underlyingsourcestartcallback"},{"id":"ref-for-callbackdef-underlyingsourcestartcallback\u2460"}],"title":"4.2.3. The underlying source API"}],"url":"#callbackdef-underlyingsourcestartcallback"}, "can-transfer-array-buffer": {"dfnID":"can-transfer-array-buffer","dfnText":"CanTransferArrayBuffer(O)","external":false,"refSections":[{"refs":[{"id":"ref-for-can-transfer-array-buffer"}],"title":"4.9.5. Byte stream controllers"}],"url":"#can-transfer-array-buffer"}, "cancel-a-readable-stream": {"dfnID":"cancel-a-readable-stream","dfnText":"cancel","external":false,"refSections":[{"refs":[{"id":"ref-for-cancel-a-readable-stream"}],"title":"2.6. Locking"},{"refs":[{"id":"ref-for-cancel-a-readable-stream\u2460"}],"title":"4.2.3. The underlying source API"},{"refs":[{"id":"ref-for-cancel-a-readable-stream\u2461"},{"id":"ref-for-cancel-a-readable-stream\u2462"},{"id":"ref-for-cancel-a-readable-stream\u2463"},{"id":"ref-for-cancel-a-readable-stream\u2464"},{"id":"ref-for-cancel-a-readable-stream\u2465"},{"id":"ref-for-cancel-a-readable-stream\u2466"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-cancel-a-readable-stream\u2467"}],"title":"4.2.5. Asynchronous iteration"},{"refs":[{"id":"ref-for-cancel-a-readable-stream\u2468"}],"title":"4.5.2. Internal slots"},{"refs":[{"id":"ref-for-cancel-a-readable-stream\u2460\u24ea"}],"title":"4.5.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-cancel-a-readable-stream\u2460\u2460"}],"title":"4.9.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-cancel-a-readable-stream\u2460\u2461"}],"title":"9.4.1. Duplex streams"}],"url":"#cancel-a-readable-stream"}, "cbdc89b4": {"dfnID":"cbdc89b4","dfnText":"while","external":true,"refSections":[{"refs":[{"id":"ref-for-iteration-while"},{"id":"ref-for-iteration-while\u2460"},{"id":"ref-for-iteration-while\u2461"}],"title":"4.9.5. Byte stream controllers"}],"url":"https://infra.spec.whatwg.org/#iteration-while"}, "cca3cdb2": {"dfnID":"cca3cdb2","dfnText":"AbortSignal","external":true,"refSections":[{"refs":[{"id":"ref-for-abortsignal"}],"title":"4.2.1. Interface definition"},{"refs":[{"id":"ref-for-abortsignal\u2460"},{"id":"ref-for-abortsignal\u2461"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-abortsignal\u2462"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-abortsignal\u2463"}],"title":"5.4.1. Interface definition"},{"refs":[{"id":"ref-for-abortsignal\u2464"}],"title":"9.2.1. Creation and manipulation"},{"refs":[{"id":"ref-for-abortsignal\u2465"},{"id":"ref-for-abortsignal\u2466"}],"title":"9.5. Piping"}],"url":"https://dom.spec.whatwg.org/#abortsignal"}, "chunk": {"dfnID":"chunk","dfnText":"chunk","external":false,"refSections":[{"refs":[{"id":"ref-for-chunk"},{"id":"ref-for-chunk\u2460"}],"title":"2.1. Readable streams"},{"refs":[{"id":"ref-for-chunk\u2461"}],"title":"2.2. Writable streams"},{"refs":[{"id":"ref-for-chunk\u2462"}],"title":"2.3. Transform streams"},{"refs":[{"id":"ref-for-chunk\u2463"},{"id":"ref-for-chunk\u2464"}],"title":"2.4. Pipe chains and backpressure"},{"refs":[{"id":"ref-for-chunk\u2465"},{"id":"ref-for-chunk\u2466"},{"id":"ref-for-chunk\u2467"},{"id":"ref-for-chunk\u2468"}],"title":"2.5. Internal queues and queuing strategies"},{"refs":[{"id":"ref-for-chunk\u2460\u24ea"},{"id":"ref-for-chunk\u2460\u2460"}],"title":"2.6. Locking"},{"refs":[{"id":"ref-for-chunk\u2460\u2461"}],"title":"4.1. Using readable streams"},{"refs":[{"id":"ref-for-chunk\u2460\u2462"}],"title":"4.2. The ReadableStream class"},{"refs":[{"id":"ref-for-chunk\u2460\u2463"}],"title":"4.2.3. The underlying source API"},{"refs":[{"id":"ref-for-chunk\u2460\u2464"},{"id":"ref-for-chunk\u2460\u2465"},{"id":"ref-for-chunk\u2460\u2466"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-chunk\u2460\u2467"}],"title":"4.2.5. Asynchronous iteration"},{"refs":[{"id":"ref-for-chunk\u2460\u2468"},{"id":"ref-for-chunk\u2461\u24ea"},{"id":"ref-for-chunk\u2461\u2460"},{"id":"ref-for-chunk\u2461\u2461"}],"title":"4.4.2. Internal slots"},{"refs":[{"id":"ref-for-chunk\u2461\u2462"}],"title":"4.4.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-chunk\u2461\u2463"},{"id":"ref-for-chunk\u2461\u2464"},{"id":"ref-for-chunk\u2461\u2465"},{"id":"ref-for-chunk\u2461\u2466"},{"id":"ref-for-chunk\u2461\u2467"}],"title":"4.5.2. Internal slots"},{"refs":[{"id":"ref-for-chunk\u2461\u2468"},{"id":"ref-for-chunk\u2462\u24ea"},{"id":"ref-for-chunk\u2462\u2460"}],"title":"4.6.2. Internal slots"},{"refs":[{"id":"ref-for-chunk\u2462\u2461"},{"id":"ref-for-chunk\u2462\u2462"}],"title":"4.6.3. Methods and properties"},{"refs":[{"id":"ref-for-chunk\u2462\u2463"},{"id":"ref-for-chunk\u2462\u2464"},{"id":"ref-for-chunk\u2462\u2465"}],"title":"4.7.2. Internal slots"},{"refs":[{"id":"ref-for-chunk\u2462\u2466"},{"id":"ref-for-chunk\u2462\u2467"}],"title":"4.7.3. Methods and properties"},{"refs":[{"id":"ref-for-chunk\u2462\u2468"},{"id":"ref-for-chunk\u2463\u24ea"},{"id":"ref-for-chunk\u2463\u2460"},{"id":"ref-for-chunk\u2463\u2461"},{"id":"ref-for-chunk\u2463\u2462"},{"id":"ref-for-chunk\u2463\u2463"},{"id":"ref-for-chunk\u2463\u2464"},{"id":"ref-for-chunk\u2463\u2465"},{"id":"ref-for-chunk\u2463\u2466"},{"id":"ref-for-chunk\u2463\u2467"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-chunk\u2463\u2468"}],"title":"4.9.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-chunk\u2464\u24ea"}],"title":"5.1. Using writable streams"},{"refs":[{"id":"ref-for-chunk\u2464\u2460"},{"id":"ref-for-chunk\u2464\u2461"},{"id":"ref-for-chunk\u2464\u2462"}],"title":"5.2.3. The underlying sink API"},{"refs":[{"id":"ref-for-chunk\u2464\u2463"},{"id":"ref-for-chunk\u2464\u2464"}],"title":"5.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-chunk\u2464\u2465"},{"id":"ref-for-chunk\u2464\u2466"},{"id":"ref-for-chunk\u2464\u2467"}],"title":"5.3.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-chunk\u2464\u2468"},{"id":"ref-for-chunk\u2465\u24ea"},{"id":"ref-for-chunk\u2465\u2460"},{"id":"ref-for-chunk\u2465\u2461"}],"title":"5.4.2. Internal slots"},{"refs":[{"id":"ref-for-chunk\u2465\u2462"}],"title":"6.1. Using transform streams"},{"refs":[{"id":"ref-for-chunk\u2465\u2463"},{"id":"ref-for-chunk\u2465\u2464"},{"id":"ref-for-chunk\u2465\u2465"},{"id":"ref-for-chunk\u2465\u2466"},{"id":"ref-for-chunk\u2465\u2467"}],"title":"6.2.3. The transformer API"},{"refs":[{"id":"ref-for-chunk\u2465\u2468"}],"title":"6.3.2. Internal slots"},{"refs":[{"id":"ref-for-chunk\u2466\u24ea"},{"id":"ref-for-chunk\u2466\u2460"},{"id":"ref-for-chunk\u2466\u2461"}],"title":"6.3.3. Methods and properties"},{"refs":[{"id":"ref-for-chunk\u2466\u2462"}],"title":"7.1. The queuing strategy API"},{"refs":[{"id":"ref-for-chunk\u2466\u2463"},{"id":"ref-for-chunk\u2466\u2464"},{"id":"ref-for-chunk\u2466\u2465"}],"title":"7.2. The ByteLengthQueuingStrategy class"},{"refs":[{"id":"ref-for-chunk\u2466\u2466"},{"id":"ref-for-chunk\u2466\u2467"}],"title":"7.3. The CountQueuingStrategy class"},{"refs":[{"id":"ref-for-chunk\u2466\u2468"}],"title":"8.1. Queue-with-sizes"},{"refs":[{"id":"ref-for-chunk\u2467\u24ea"}],"title":"9.1.1. Creation and manipulation"},{"refs":[{"id":"ref-for-chunk\u2467\u2460"}],"title":"9.1.2. Reading"},{"refs":[{"id":"ref-for-chunk\u2467\u2461"},{"id":"ref-for-chunk\u2467\u2462"},{"id":"ref-for-chunk\u2467\u2463"},{"id":"ref-for-chunk\u2467\u2464"}],"title":"9.2.1. Creation and manipulation"},{"refs":[{"id":"ref-for-chunk\u2467\u2465"},{"id":"ref-for-chunk\u2467\u2466"}],"title":"9.3.1. Creation and manipulation"},{"refs":[{"id":"ref-for-chunk\u2467\u2467"}],"title":"10.1. A readable stream with an underlying push source (no\nbackpressure support)"},{"refs":[{"id":"ref-for-chunk\u2467\u2468"}],"title":"10.3. A readable byte stream with an underlying push source (no backpressure\nsupport)"},{"refs":[{"id":"ref-for-chunk\u2468\u24ea"}],"title":"10.7. A writable stream with backpressure and success signals"}],"url":"#chunk"}, "close-sentinel": {"dfnID":"close-sentinel","dfnText":"close sentinel","external":false,"refSections":[{"refs":[{"id":"ref-for-close-sentinel"},{"id":"ref-for-close-sentinel\u2460"}],"title":"5.5.4. Default controllers"}],"url":"#close-sentinel"}, "consumer": {"dfnID":"consumer","dfnText":"consumer","external":false,"refSections":[{"refs":[{"id":"ref-for-consumer"}],"title":"2.6. Locking"},{"refs":[{"id":"ref-for-consumer\u2460"},{"id":"ref-for-consumer\u2461"}],"title":"4.2.3. The underlying source API"},{"refs":[{"id":"ref-for-consumer\u2462"}],"title":"4.4.2. Internal slots"},{"refs":[{"id":"ref-for-consumer\u2463"}],"title":"4.5.2. Internal slots"},{"refs":[{"id":"ref-for-consumer\u2464"}],"title":"4.6.3. Methods and properties"},{"refs":[{"id":"ref-for-consumer\u2465"}],"title":"4.7.3. Methods and properties"},{"refs":[{"id":"ref-for-consumer\u2466"},{"id":"ref-for-consumer\u2467"}],"title":"4.8.3. Methods and properties"},{"refs":[{"id":"ref-for-consumer\u2468"}],"title":"9.1.1. Creation and manipulation"},{"refs":[{"id":"ref-for-consumer\u2460\u24ea"}],"title":"10.3. A readable byte stream with an underlying push source (no backpressure\nsupport)"}],"url":"#consumer"}, "count-queuing-strategy-size-function": {"dfnID":"count-queuing-strategy-size-function","dfnText":"count queuing strategy\n size function","external":false,"refSections":[{"refs":[{"id":"ref-for-count-queuing-strategy-size-function"}],"title":"7.3.2. Internal slots"},{"refs":[{"id":"ref-for-count-queuing-strategy-size-function\u2460"}],"title":"7.3.3. Constructor and properties"}],"url":"#count-queuing-strategy-size-function"}, "countqueuingstrategy": {"dfnID":"countqueuingstrategy","dfnText":"CountQueuingStrategy","external":false,"refSections":[{"refs":[{"id":"ref-for-countqueuingstrategy"}],"title":"2.5. Internal queues and queuing strategies"},{"refs":[{"id":"ref-for-countqueuingstrategy\u2460"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-countqueuingstrategy\u2461"}],"title":"5.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-countqueuingstrategy\u2462"}],"title":"6.2.4. Constructor and properties"},{"refs":[{"id":"ref-for-countqueuingstrategy\u2463"}],"title":"7.1. The queuing strategy API"},{"refs":[{"id":"ref-for-countqueuingstrategy\u2464"}],"title":"7.3. The CountQueuingStrategy class"},{"refs":[{"id":"ref-for-countqueuingstrategy\u2465"}],"title":"7.3.1. Interface definition"},{"refs":[{"id":"ref-for-countqueuingstrategy\u2466"}],"title":"7.3.2. Internal slots"},{"refs":[{"id":"ref-for-countqueuingstrategy\u2467"},{"id":"ref-for-countqueuingstrategy\u2468"}],"title":"7.3.3. Constructor and properties"}],"url":"#countqueuingstrategy"}, "countqueuingstrategy-highwatermark": {"dfnID":"countqueuingstrategy-highwatermark","dfnText":"[[highWaterMark]]","external":false,"refSections":[{"refs":[{"id":"ref-for-countqueuingstrategy-highwatermark"},{"id":"ref-for-countqueuingstrategy-highwatermark\u2460"}],"title":"7.3.3. Constructor and properties"}],"url":"#countqueuingstrategy-highwatermark"}, "cqs-constructor": {"dfnID":"cqs-constructor","dfnText":"new CountQueuingStrategy(init)","external":false,"refSections":[{"refs":[{"id":"ref-for-cqs-constructor"}],"title":"7.3.1. Interface definition"},{"refs":[{"id":"ref-for-cqs-constructor\u2460"}],"title":"7.3.3. Constructor and properties"}],"url":"#cqs-constructor"}, "cqs-high-water-mark": {"dfnID":"cqs-high-water-mark","dfnText":"highWaterMark","external":false,"refSections":[{"refs":[{"id":"ref-for-cqs-high-water-mark"}],"title":"7.3.1. Interface definition"},{"refs":[{"id":"ref-for-cqs-high-water-mark\u2460"}],"title":"7.3.3. Constructor and properties"}],"url":"#cqs-high-water-mark"}, "cqs-size": {"dfnID":"cqs-size","dfnText":"size","external":false,"refSections":[{"refs":[{"id":"ref-for-cqs-size"}],"title":"7.3.1. Interface definition"},{"refs":[{"id":"ref-for-cqs-size\u2460"}],"title":"7.3.2. Internal slots"},{"refs":[{"id":"ref-for-cqs-size\u2461"}],"title":"7.3.3. Constructor and properties"}],"url":"#cqs-size"}, "create-an-identity-transformstream": {"dfnID":"create-an-identity-transformstream","dfnText":"create\n an identity TransformStream","external":false,"refSections":[{"refs":[{"id":"ref-for-create-an-identity-transformstream"}],"title":"9.5. Piping"}],"url":"#create-an-identity-transformstream"}, "create-readable-stream": {"dfnID":"create-readable-stream","dfnText":"CreateReadableStream(startAlgorithm, pullAlgorithm,\n cancelAlgorithm[, highWaterMark, [, sizeAlgorithm]])","external":false,"refSections":[{"refs":[{"id":"ref-for-create-readable-stream"},{"id":"ref-for-create-readable-stream\u2460"},{"id":"ref-for-create-readable-stream\u2461"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-create-readable-stream\u2462"}],"title":"6.4.1. Working with transform streams"}],"url":"#create-readable-stream"}, "create-writable-stream": {"dfnID":"create-writable-stream","dfnText":"CreateWritableStream(startAlgorithm, writeAlgorithm,\n closeAlgorithm, abortAlgorithm, highWaterMark, sizeAlgorithm)","external":false,"refSections":[{"refs":[{"id":"ref-for-create-writable-stream"}],"title":"6.4.1. Working with transform streams"}],"url":"#create-writable-stream"}, "d0b4a948": {"dfnID":"d0b4a948","dfnText":"a promise rejected with","external":true,"refSections":[{"refs":[{"id":"ref-for-a-promise-rejected-with"},{"id":"ref-for-a-promise-rejected-with\u2460"},{"id":"ref-for-a-promise-rejected-with\u2461"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-a-promise-rejected-with\u2462"}],"title":"4.3.3. Methods and properties"},{"refs":[{"id":"ref-for-a-promise-rejected-with\u2463"}],"title":"4.4.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-a-promise-rejected-with\u2464"},{"id":"ref-for-a-promise-rejected-with\u2465"},{"id":"ref-for-a-promise-rejected-with\u2466"},{"id":"ref-for-a-promise-rejected-with\u2467"},{"id":"ref-for-a-promise-rejected-with\u2468"},{"id":"ref-for-a-promise-rejected-with\u2460\u24ea"},{"id":"ref-for-a-promise-rejected-with\u2460\u2460"}],"title":"4.5.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-a-promise-rejected-with\u2460\u2461"},{"id":"ref-for-a-promise-rejected-with\u2460\u2462"},{"id":"ref-for-a-promise-rejected-with\u2460\u2463"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-a-promise-rejected-with\u2460\u2464"}],"title":"4.9.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-a-promise-rejected-with\u2460\u2465"},{"id":"ref-for-a-promise-rejected-with\u2460\u2466"}],"title":"4.9.3. Readers"},{"refs":[{"id":"ref-for-a-promise-rejected-with\u2460\u2467"},{"id":"ref-for-a-promise-rejected-with\u2460\u2468"},{"id":"ref-for-a-promise-rejected-with\u2461\u24ea"}],"title":"5.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-a-promise-rejected-with\u2461\u2460"},{"id":"ref-for-a-promise-rejected-with\u2461\u2461"},{"id":"ref-for-a-promise-rejected-with\u2461\u2462"},{"id":"ref-for-a-promise-rejected-with\u2461\u2463"}],"title":"5.3.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-a-promise-rejected-with\u2461\u2464"},{"id":"ref-for-a-promise-rejected-with\u2461\u2465"},{"id":"ref-for-a-promise-rejected-with\u2461\u2466"},{"id":"ref-for-a-promise-rejected-with\u2461\u2467"}],"title":"5.5.1. Working with writable streams"},{"refs":[{"id":"ref-for-a-promise-rejected-with\u2461\u2468"},{"id":"ref-for-a-promise-rejected-with\u2462\u24ea"},{"id":"ref-for-a-promise-rejected-with\u2462\u2460"},{"id":"ref-for-a-promise-rejected-with\u2462\u2461"},{"id":"ref-for-a-promise-rejected-with\u2462\u2462"},{"id":"ref-for-a-promise-rejected-with\u2462\u2463"},{"id":"ref-for-a-promise-rejected-with\u2462\u2464"}],"title":"5.5.3. Writers"},{"refs":[{"id":"ref-for-a-promise-rejected-with\u2462\u2465"}],"title":"6.4.2. Default controllers"},{"refs":[{"id":"ref-for-a-promise-rejected-with\u2462\u2466"},{"id":"ref-for-a-promise-rejected-with\u2462\u2467"},{"id":"ref-for-a-promise-rejected-with\u2462\u2468"}],"title":"8.2. Transferable streams"},{"refs":[{"id":"ref-for-a-promise-rejected-with\u2463\u24ea"},{"id":"ref-for-a-promise-rejected-with\u2463\u2460"},{"id":"ref-for-a-promise-rejected-with\u2463\u2461"},{"id":"ref-for-a-promise-rejected-with\u2463\u2462"}],"title":"9.1.1. Creation and manipulation"},{"refs":[{"id":"ref-for-a-promise-rejected-with\u2463\u2463"},{"id":"ref-for-a-promise-rejected-with\u2463\u2464"}],"title":"9.2.1. Creation and manipulation"},{"refs":[{"id":"ref-for-a-promise-rejected-with\u2463\u2465"},{"id":"ref-for-a-promise-rejected-with\u2463\u2466"},{"id":"ref-for-a-promise-rejected-with\u2463\u2467"}],"title":"9.3.1. Creation and manipulation"}],"url":"https://webidl.spec.whatwg.org/#a-promise-rejected-with"}, "d1a8bfee": {"dfnID":"d1a8bfee","dfnText":"%ArrayBuffer%","external":true,"refSections":[{"refs":[{"id":"ref-for-sec-arraybuffer-constructor"}],"title":"4.7.4. Internal methods"},{"refs":[{"id":"ref-for-sec-arraybuffer-constructor\u2460"}],"title":"4.9.5. Byte stream controllers"},{"refs":[{"id":"ref-for-sec-arraybuffer-constructor\u2461"}],"title":"8.3. Miscellaneous"}],"url":"https://tc39.es/ecma262/multipage/structured-data.html#sec-arraybuffer-constructor"}, "d2c61922": {"dfnID":"d2c61922","dfnText":"CreateDataProperty","external":true,"refSections":[{"refs":[{"id":"ref-for-sec-createdataproperty"},{"id":"ref-for-sec-createdataproperty\u2460"}],"title":"8.2. Transferable streams"}],"url":"https://tc39.es/ecma262/multipage/abstract-operations.html#sec-createdataproperty"}, "d54f5897": {"dfnID":"d54f5897","dfnText":"DataCloneError","external":true,"refSections":[{"refs":[{"id":"ref-for-datacloneerror"}],"title":"4.2.6. Transfer via postMessage()"},{"refs":[{"id":"ref-for-datacloneerror\u2460"}],"title":"5.2.5. Transfer via postMessage()"},{"refs":[{"id":"ref-for-datacloneerror\u2461"},{"id":"ref-for-datacloneerror\u2462"}],"title":"6.2.5. Transfer via postMessage()"},{"refs":[{"id":"ref-for-datacloneerror\u2463"},{"id":"ref-for-datacloneerror\u2464"}],"title":"8.2. Transferable streams"}],"url":"https://webidl.spec.whatwg.org/#datacloneerror"}, "d7a47d32": {"dfnID":"d7a47d32","dfnText":"DetachArrayBuffer","external":true,"refSections":[{"refs":[{"id":"ref-for-sec-detacharraybuffer"}],"title":"8.3. Miscellaneous"}],"url":"https://tc39.es/ecma262/multipage/structured-data.html#sec-detacharraybuffer"}, "d7f1c677": {"dfnID":"d7f1c677","dfnText":"IsDetachedBuffer","external":true,"refSections":[{"refs":[{"id":"ref-for-sec-isdetachedbuffer"}],"title":"4.5.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-sec-isdetachedbuffer\u2460"},{"id":"ref-for-sec-isdetachedbuffer\u2461"}],"title":"4.8.3. Methods and properties"},{"refs":[{"id":"ref-for-sec-isdetachedbuffer\u2462"},{"id":"ref-for-sec-isdetachedbuffer\u2463"},{"id":"ref-for-sec-isdetachedbuffer\u2464"},{"id":"ref-for-sec-isdetachedbuffer\u2465"}],"title":"4.9.5. Byte stream controllers"},{"refs":[{"id":"ref-for-sec-isdetachedbuffer\u2466"},{"id":"ref-for-sec-isdetachedbuffer\u2467"},{"id":"ref-for-sec-isdetachedbuffer\u2468"},{"id":"ref-for-sec-isdetachedbuffer\u2460\u24ea"},{"id":"ref-for-sec-isdetachedbuffer\u2460\u2460"}],"title":"8.3. Miscellaneous"}],"url":"https://tc39.es/ecma262/multipage/structured-data.html#sec-isdetachedbuffer"}, "d8f8e172": {"dfnID":"d8f8e172","dfnText":"is a String","external":true,"refSections":[{"refs":[{"id":"ref-for-sec-ecmascript-language-types-string-type"},{"id":"ref-for-sec-ecmascript-language-types-string-type\u2460"}],"title":"8.2. Transferable streams"}],"url":"https://tc39.es/ecma262/#sec-ecmascript-language-types-string-type"}, "dacde8b5": {"dfnID":"dacde8b5","dfnText":"a new promise","external":true,"refSections":[{"refs":[{"id":"ref-for-a-new-promise"}],"title":"4.2.5. Asynchronous iteration"},{"refs":[{"id":"ref-for-a-new-promise\u2460"}],"title":"4.4.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-a-new-promise\u2461"}],"title":"4.5.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-a-new-promise\u2462"},{"id":"ref-for-a-new-promise\u2463"},{"id":"ref-for-a-new-promise\u2464"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-a-new-promise\u2465"}],"title":"4.9.3. Readers"},{"refs":[{"id":"ref-for-a-new-promise\u2466"},{"id":"ref-for-a-new-promise\u2467"},{"id":"ref-for-a-new-promise\u2468"},{"id":"ref-for-a-new-promise\u2460\u24ea"},{"id":"ref-for-a-new-promise\u2460\u2460"}],"title":"5.5.1. Working with writable streams"},{"refs":[{"id":"ref-for-a-new-promise\u2460\u2461"},{"id":"ref-for-a-new-promise\u2460\u2462"}],"title":"5.5.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-a-new-promise\u2460\u2463"}],"title":"6.2.4. Constructor and properties"},{"refs":[{"id":"ref-for-a-new-promise\u2460\u2464"}],"title":"6.4.1. Working with transform streams"},{"refs":[{"id":"ref-for-a-new-promise\u2460\u2465"},{"id":"ref-for-a-new-promise\u2460\u2466"}],"title":"8.2. Transferable streams"}],"url":"https://webidl.spec.whatwg.org/#a-new-promise"}, "dbe29252": {"dfnID":"dbe29252","dfnText":"transferable object","external":true,"refSections":[{"refs":[{"id":"ref-for-transferable-objects"}],"title":"4.2.6. Transfer via postMessage()"},{"refs":[{"id":"ref-for-transferable-objects\u2460"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-transferable-objects\u2461"}],"title":"5.2.5. Transfer via postMessage()"},{"refs":[{"id":"ref-for-transferable-objects\u2462"}],"title":"6.2.5. Transfer via postMessage()"}],"url":"https://html.spec.whatwg.org/multipage/structured-data.html#transferable-objects"}, "dca2de17": {"dfnID":"dca2de17","dfnText":"DOMException","external":true,"refSections":[{"refs":[{"id":"ref-for-idl-DOMException"}],"title":"4.2.6. Transfer via postMessage()"},{"refs":[{"id":"ref-for-idl-DOMException\u2460"}],"title":"5.2.5. Transfer via postMessage()"},{"refs":[{"id":"ref-for-idl-DOMException\u2461"},{"id":"ref-for-idl-DOMException\u2462"}],"title":"6.2.5. Transfer via postMessage()"},{"refs":[{"id":"ref-for-idl-DOMException\u2463"},{"id":"ref-for-idl-DOMException\u2464"}],"title":"8.2. Transferable streams"}],"url":"https://webidl.spec.whatwg.org/#idl-DOMException"}, "default-reader": {"dfnID":"default-reader","dfnText":"default readers","external":false,"refSections":[{"refs":[{"id":"ref-for-default-reader"}],"title":"4.1. Using readable streams"},{"refs":[{"id":"ref-for-default-reader\u2460"}],"title":"4.2.3. The underlying source API"},{"refs":[{"id":"ref-for-default-reader\u2461"}],"title":"4.4. The ReadableStreamDefaultReader class"},{"refs":[{"id":"ref-for-default-reader\u2462"}],"title":"4.9.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-default-reader\u2463"},{"id":"ref-for-default-reader\u2464"}],"title":"10.5. A readable byte stream with an underlying pull source"}],"url":"#default-reader"}, "default-reader-constructor": {"dfnID":"default-reader-constructor","dfnText":"new ReadableStreamDefaultReader(stream)","external":false,"refSections":[{"refs":[{"id":"ref-for-default-reader-constructor"}],"title":"4.4.1. Interface definition"},{"refs":[{"id":"ref-for-default-reader-constructor\u2460"}],"title":"4.4.3. Constructor, methods, and properties"}],"url":"#default-reader-constructor"}, "default-reader-read": {"dfnID":"default-reader-read","dfnText":"read()","external":false,"refSections":[{"refs":[{"id":"ref-for-default-reader-read"}],"title":"4.4.1. Interface definition"},{"refs":[{"id":"ref-for-default-reader-read\u2460"},{"id":"ref-for-default-reader-read\u2461"}],"title":"4.4.3. Constructor, methods, and properties"}],"url":"#default-reader-read"}, "default-reader-release-lock": {"dfnID":"default-reader-release-lock","dfnText":"releaseLock()","external":false,"refSections":[{"refs":[{"id":"ref-for-default-reader-release-lock"}],"title":"2.6. Locking"},{"refs":[{"id":"ref-for-default-reader-release-lock\u2460"}],"title":"4.4.1. Interface definition"},{"refs":[{"id":"ref-for-default-reader-release-lock\u2461"}],"title":"4.4.3. Constructor, methods, and properties"}],"url":"#default-reader-release-lock"}, "default-writer-abort": {"dfnID":"default-writer-abort","dfnText":"abort(reason)","external":false,"refSections":[{"refs":[{"id":"ref-for-default-writer-abort"}],"title":"5.2.2. Internal slots"},{"refs":[{"id":"ref-for-default-writer-abort\u2460"},{"id":"ref-for-default-writer-abort\u2461"}],"title":"5.2.3. The underlying sink API"},{"refs":[{"id":"ref-for-default-writer-abort\u2462"}],"title":"5.3.1. Interface definition"},{"refs":[{"id":"ref-for-default-writer-abort\u2463"}],"title":"5.3.3. Constructor, methods, and properties"}],"url":"#default-writer-abort"}, "default-writer-close": {"dfnID":"default-writer-close","dfnText":"close()","external":false,"refSections":[{"refs":[{"id":"ref-for-default-writer-close"},{"id":"ref-for-default-writer-close\u2460"},{"id":"ref-for-default-writer-close\u2461"}],"title":"5.1. Using writable streams"},{"refs":[{"id":"ref-for-default-writer-close\u2462"}],"title":"5.2.2. Internal slots"},{"refs":[{"id":"ref-for-default-writer-close\u2463"},{"id":"ref-for-default-writer-close\u2464"}],"title":"5.2.3. The underlying sink API"},{"refs":[{"id":"ref-for-default-writer-close\u2465"}],"title":"5.3.1. Interface definition"},{"refs":[{"id":"ref-for-default-writer-close\u2466"}],"title":"5.3.3. Constructor, methods, and properties"}],"url":"#default-writer-close"}, "default-writer-closed": {"dfnID":"default-writer-closed","dfnText":"closed","external":false,"refSections":[{"refs":[{"id":"ref-for-default-writer-closed"}],"title":"5.3.1. Interface definition"},{"refs":[{"id":"ref-for-default-writer-closed\u2460"}],"title":"5.3.2. Internal slots"},{"refs":[{"id":"ref-for-default-writer-closed\u2461"}],"title":"5.3.3. Constructor, methods, and properties"}],"url":"#default-writer-closed"}, "default-writer-constructor": {"dfnID":"default-writer-constructor","dfnText":"new WritableStreamDefaultWriter(stream)","external":false,"refSections":[{"refs":[{"id":"ref-for-default-writer-constructor"}],"title":"5.3.1. Interface definition"},{"refs":[{"id":"ref-for-default-writer-constructor\u2460"}],"title":"5.3.3. Constructor, methods, and properties"}],"url":"#default-writer-constructor"}, "default-writer-desired-size": {"dfnID":"default-writer-desired-size","dfnText":"desiredSize","external":false,"refSections":[{"refs":[{"id":"ref-for-default-writer-desired-size"}],"title":"2.4. Pipe chains and backpressure"},{"refs":[{"id":"ref-for-default-writer-desired-size\u2460"},{"id":"ref-for-default-writer-desired-size\u2461"},{"id":"ref-for-default-writer-desired-size\u2462"}],"title":"5.1. Using writable streams"},{"refs":[{"id":"ref-for-default-writer-desired-size\u2463"}],"title":"5.2.3. The underlying sink API"},{"refs":[{"id":"ref-for-default-writer-desired-size\u2464"}],"title":"5.3.1. Interface definition"},{"refs":[{"id":"ref-for-default-writer-desired-size\u2465"}],"title":"5.3.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-default-writer-desired-size\u2466"}],"title":"7.1. The queuing strategy API"}],"url":"#default-writer-desired-size"}, "default-writer-ready": {"dfnID":"default-writer-ready","dfnText":"ready","external":false,"refSections":[{"refs":[{"id":"ref-for-default-writer-ready"},{"id":"ref-for-default-writer-ready\u2460"},{"id":"ref-for-default-writer-ready\u2461"},{"id":"ref-for-default-writer-ready\u2462"},{"id":"ref-for-default-writer-ready\u2463"},{"id":"ref-for-default-writer-ready\u2464"},{"id":"ref-for-default-writer-ready\u2465"}],"title":"5.1. Using writable streams"},{"refs":[{"id":"ref-for-default-writer-ready\u2466"}],"title":"5.3.1. Interface definition"},{"refs":[{"id":"ref-for-default-writer-ready\u2467"}],"title":"5.3.2. Internal slots"},{"refs":[{"id":"ref-for-default-writer-ready\u2468"}],"title":"5.3.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-default-writer-ready\u2460\u24ea"}],"title":"10.6. A writable stream with no backpressure or success signals"},{"refs":[{"id":"ref-for-default-writer-ready\u2460\u2460"}],"title":"10.7. A writable stream with backpressure and success signals"}],"url":"#default-writer-ready"}, "default-writer-release-lock": {"dfnID":"default-writer-release-lock","dfnText":"releaseLock()","external":false,"refSections":[{"refs":[{"id":"ref-for-default-writer-release-lock"}],"title":"2.6. Locking"},{"refs":[{"id":"ref-for-default-writer-release-lock\u2460"}],"title":"5.3.1. Interface definition"},{"refs":[{"id":"ref-for-default-writer-release-lock\u2461"}],"title":"5.3.3. Constructor, methods, and properties"}],"url":"#default-writer-release-lock"}, "default-writer-write": {"dfnID":"default-writer-write","dfnText":"write(chunk)","external":false,"refSections":[{"refs":[{"id":"ref-for-default-writer-write"},{"id":"ref-for-default-writer-write\u2460"},{"id":"ref-for-default-writer-write\u2461"},{"id":"ref-for-default-writer-write\u2462"},{"id":"ref-for-default-writer-write\u2463"},{"id":"ref-for-default-writer-write\u2464"},{"id":"ref-for-default-writer-write\u2465"},{"id":"ref-for-default-writer-write\u2466"},{"id":"ref-for-default-writer-write\u2467"}],"title":"5.1. Using writable streams"},{"refs":[{"id":"ref-for-default-writer-write\u2468"}],"title":"5.2.3. The underlying sink API"},{"refs":[{"id":"ref-for-default-writer-write\u2460\u24ea"}],"title":"5.3.1. Interface definition"},{"refs":[{"id":"ref-for-default-writer-write\u2460\u2460"},{"id":"ref-for-default-writer-write\u2460\u2461"},{"id":"ref-for-default-writer-write\u2460\u2462"},{"id":"ref-for-default-writer-write\u2460\u2463"}],"title":"5.3.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-default-writer-write\u2460\u2464"}],"title":"6.2.3. The transformer API"},{"refs":[{"id":"ref-for-default-writer-write\u2460\u2465"}],"title":"10.6. A writable stream with no backpressure or success signals"}],"url":"#default-writer-write"}, "dequeue-value": {"dfnID":"dequeue-value","dfnText":"DequeueValue(container)","external":false,"refSections":[{"refs":[{"id":"ref-for-dequeue-value"}],"title":"4.6.4. Internal methods"},{"refs":[{"id":"ref-for-dequeue-value\u2460"},{"id":"ref-for-dequeue-value\u2461"}],"title":"5.5.4. Default controllers"}],"url":"#dequeue-value"}, "desired-size-to-fill-a-streams-internal-queue": {"dfnID":"desired-size-to-fill-a-streams-internal-queue","dfnText":"desired size to fill the stream\u2019s queue","external":false,"refSections":[{"refs":[{"id":"ref-for-desired-size-to-fill-a-streams-internal-queue"},{"id":"ref-for-desired-size-to-fill-a-streams-internal-queue\u2460"}],"title":"4.2.3. The underlying source API"},{"refs":[{"id":"ref-for-desired-size-to-fill-a-streams-internal-queue\u2461"}],"title":"4.6.3. Methods and properties"},{"refs":[{"id":"ref-for-desired-size-to-fill-a-streams-internal-queue\u2462"}],"title":"4.7.3. Methods and properties"},{"refs":[{"id":"ref-for-desired-size-to-fill-a-streams-internal-queue\u2463"}],"title":"5.1. Using writable streams"},{"refs":[{"id":"ref-for-desired-size-to-fill-a-streams-internal-queue\u2464"}],"title":"5.2.3. The underlying sink API"},{"refs":[{"id":"ref-for-desired-size-to-fill-a-streams-internal-queue\u2465"},{"id":"ref-for-desired-size-to-fill-a-streams-internal-queue\u2466"},{"id":"ref-for-desired-size-to-fill-a-streams-internal-queue\u2467"}],"title":"5.3.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-desired-size-to-fill-a-streams-internal-queue\u2468"}],"title":"6.3.3. Methods and properties"}],"url":"#desired-size-to-fill-a-streams-internal-queue"}, "df16744f": {"dfnID":"df16744f","dfnText":"MessagePort","external":true,"refSections":[{"refs":[{"id":"ref-for-messageport"},{"id":"ref-for-messageport\u2460"}],"title":"4.2.6. Transfer via postMessage()"},{"refs":[{"id":"ref-for-messageport\u2461"},{"id":"ref-for-messageport\u2462"}],"title":"5.2.5. Transfer via postMessage()"}],"url":"https://html.spec.whatwg.org/multipage/web-messaging.html#messageport"}, "dictdef-queuingstrategy": {"dfnID":"dictdef-queuingstrategy","dfnText":"QueuingStrategy","external":false,"refSections":[{"refs":[{"id":"ref-for-dictdef-queuingstrategy"}],"title":"4.2.1. Interface definition"},{"refs":[{"id":"ref-for-dictdef-queuingstrategy\u2460"}],"title":"5.2.1. Interface definition"},{"refs":[{"id":"ref-for-dictdef-queuingstrategy\u2461"},{"id":"ref-for-dictdef-queuingstrategy\u2462"}],"title":"6.2.1. Interface definition"},{"refs":[{"id":"ref-for-dictdef-queuingstrategy\u2463"}],"title":"7.4. Abstract operations"}],"url":"#dictdef-queuingstrategy"}, "dictdef-queuingstrategyinit": {"dfnID":"dictdef-queuingstrategyinit","dfnText":"QueuingStrategyInit","external":false,"refSections":[{"refs":[{"id":"ref-for-dictdef-queuingstrategyinit"}],"title":"7.2.1. Interface definition"},{"refs":[{"id":"ref-for-dictdef-queuingstrategyinit\u2460"}],"title":"7.3.1. Interface definition"}],"url":"#dictdef-queuingstrategyinit"}, "dictdef-readablestreambyobreaderreadoptions": {"dfnID":"dictdef-readablestreambyobreaderreadoptions","dfnText":"ReadableStreamBYOBReaderReadOptions","external":false,"refSections":[{"refs":[{"id":"ref-for-dictdef-readablestreambyobreaderreadoptions"}],"title":"4.5.1. Interface definition"}],"url":"#dictdef-readablestreambyobreaderreadoptions"}, "dictdef-readablestreamgetreaderoptions": {"dfnID":"dictdef-readablestreamgetreaderoptions","dfnText":"ReadableStreamGetReaderOptions","external":false,"refSections":[{"refs":[{"id":"ref-for-dictdef-readablestreamgetreaderoptions"}],"title":"4.2.1. Interface definition"}],"url":"#dictdef-readablestreamgetreaderoptions"}, "dictdef-readablestreamiteratoroptions": {"dfnID":"dictdef-readablestreamiteratoroptions","dfnText":"ReadableStreamIteratorOptions","external":false,"refSections":[{"refs":[{"id":"ref-for-dictdef-readablestreamiteratoroptions"}],"title":"4.2.1. Interface definition"}],"url":"#dictdef-readablestreamiteratoroptions"}, "dictdef-readablestreamreadresult": {"dfnID":"dictdef-readablestreamreadresult","dfnText":"ReadableStreamReadResult","external":false,"refSections":[{"refs":[{"id":"ref-for-dictdef-readablestreamreadresult"}],"title":"4.4.1. Interface definition"},{"refs":[{"id":"ref-for-dictdef-readablestreamreadresult\u2460"}],"title":"4.5.1. Interface definition"}],"url":"#dictdef-readablestreamreadresult"}, "dictdef-readablewritablepair": {"dfnID":"dictdef-readablewritablepair","dfnText":"ReadableWritablePair","external":false,"refSections":[{"refs":[{"id":"ref-for-dictdef-readablewritablepair"}],"title":"4.2.1. Interface definition"}],"url":"#dictdef-readablewritablepair"}, "dictdef-streampipeoptions": {"dfnID":"dictdef-streampipeoptions","dfnText":"StreamPipeOptions","external":false,"refSections":[{"refs":[{"id":"ref-for-dictdef-streampipeoptions"},{"id":"ref-for-dictdef-streampipeoptions\u2460"}],"title":"4.2.1. Interface definition"}],"url":"#dictdef-streampipeoptions"}, "dictdef-transformer": {"dfnID":"dictdef-transformer","dfnText":"Transformer","external":false,"refSections":[{"refs":[{"id":"ref-for-dictdef-transformer"},{"id":"ref-for-dictdef-transformer\u2460"}],"title":"6.2.4. Constructor and properties"}],"url":"#dictdef-transformer"}, "dictdef-underlyingsink": {"dfnID":"dictdef-underlyingsink","dfnText":"UnderlyingSink","external":false,"refSections":[{"refs":[{"id":"ref-for-dictdef-underlyingsink"},{"id":"ref-for-dictdef-underlyingsink\u2460"}],"title":"5.2.4. Constructor, methods, and properties"}],"url":"#dictdef-underlyingsink"}, "dictdef-underlyingsource": {"dfnID":"dictdef-underlyingsource","dfnText":"UnderlyingSource","external":false,"refSections":[{"refs":[{"id":"ref-for-dictdef-underlyingsource"},{"id":"ref-for-dictdef-underlyingsource\u2460"}],"title":"4.2.4. Constructor, methods, and properties"}],"url":"#dictdef-underlyingsource"}, "dom-bytelengthqueuingstrategy-bytelengthqueuingstrategy-init-init": {"dfnID":"dom-bytelengthqueuingstrategy-bytelengthqueuingstrategy-init-init","dfnText":"init","external":false,"refSections":[],"url":"#dom-bytelengthqueuingstrategy-bytelengthqueuingstrategy-init-init"}, "dom-countqueuingstrategy-countqueuingstrategy-init-init": {"dfnID":"dom-countqueuingstrategy-countqueuingstrategy-init-init","dfnText":"init","external":false,"refSections":[],"url":"#dom-countqueuingstrategy-countqueuingstrategy-init-init"}, "dom-generictransformstream-readable": {"dfnID":"dom-generictransformstream-readable","dfnText":"readable","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-generictransformstream-readable"},{"id":"ref-for-dom-generictransformstream-readable\u2460"}],"title":"9.3.2. Wrapping into a custom class"}],"url":"#dom-generictransformstream-readable"}, "dom-generictransformstream-writable": {"dfnID":"dom-generictransformstream-writable","dfnText":"writable","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-generictransformstream-writable"},{"id":"ref-for-dom-generictransformstream-writable\u2460"}],"title":"9.3.2. Wrapping into a custom class"}],"url":"#dom-generictransformstream-writable"}, "dom-queuingstrategy-highwatermark": {"dfnID":"dom-queuingstrategy-highwatermark","dfnText":"highWaterMark","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-queuingstrategy-highwatermark"},{"id":"ref-for-dom-queuingstrategy-highwatermark\u2460"},{"id":"ref-for-dom-queuingstrategy-highwatermark\u2461"}],"title":"2.5. Internal queues and queuing strategies"},{"refs":[{"id":"ref-for-dom-queuingstrategy-highwatermark\u2462"}],"title":"7.1. The queuing strategy API"},{"refs":[{"id":"ref-for-dom-queuingstrategy-highwatermark\u2463"},{"id":"ref-for-dom-queuingstrategy-highwatermark\u2464"}],"title":"7.4. Abstract operations"}],"url":"#dom-queuingstrategy-highwatermark"}, "dom-queuingstrategy-size": {"dfnID":"dom-queuingstrategy-size","dfnText":"size(chunk)","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-queuingstrategy-size"}],"title":"2.5. Internal queues and queuing strategies"},{"refs":[{"id":"ref-for-dom-queuingstrategy-size\u2460"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-dom-queuingstrategy-size\u2461"}],"title":"7.1. The queuing strategy API"},{"refs":[{"id":"ref-for-dom-queuingstrategy-size\u2462"},{"id":"ref-for-dom-queuingstrategy-size\u2463"}],"title":"7.4. Abstract operations"}],"url":"#dom-queuingstrategy-size"}, "dom-queuingstrategyinit-highwatermark": {"dfnID":"dom-queuingstrategyinit-highwatermark","dfnText":"highWaterMark","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-queuingstrategyinit-highwatermark"},{"id":"ref-for-dom-queuingstrategyinit-highwatermark\u2460"}],"title":"7.2.3. Constructor and properties"},{"refs":[{"id":"ref-for-dom-queuingstrategyinit-highwatermark\u2461"},{"id":"ref-for-dom-queuingstrategyinit-highwatermark\u2462"}],"title":"7.3.3. Constructor and properties"}],"url":"#dom-queuingstrategyinit-highwatermark"}, "dom-queuingstrategysize-chunk": {"dfnID":"dom-queuingstrategysize-chunk","dfnText":"chunk","external":false,"refSections":[],"url":"#dom-queuingstrategysize-chunk"}, "dom-readablebytestreamcontroller-enqueue-chunk-chunk": {"dfnID":"dom-readablebytestreamcontroller-enqueue-chunk-chunk","dfnText":"chunk","external":false,"refSections":[],"url":"#dom-readablebytestreamcontroller-enqueue-chunk-chunk"}, "dom-readablebytestreamcontroller-error-e-e": {"dfnID":"dom-readablebytestreamcontroller-error-e-e","dfnText":"e","external":false,"refSections":[],"url":"#dom-readablebytestreamcontroller-error-e-e"}, "dom-readablestream-cancel-reason-reason": {"dfnID":"dom-readablestream-cancel-reason-reason","dfnText":"reason","external":false,"refSections":[],"url":"#dom-readablestream-cancel-reason-reason"}, "dom-readablestream-from-asynciterable-asynciterable": {"dfnID":"dom-readablestream-from-asynciterable-asynciterable","dfnText":"asyncIterable","external":false,"refSections":[],"url":"#dom-readablestream-from-asynciterable-asynciterable"}, "dom-readablestream-getreader-options-options": {"dfnID":"dom-readablestream-getreader-options-options","dfnText":"options","external":false,"refSections":[],"url":"#dom-readablestream-getreader-options-options"}, "dom-readablestream-options": {"dfnID":"dom-readablestream-options","dfnText":"options","external":false,"refSections":[],"url":"#dom-readablestream-options"}, "dom-readablestream-pipethrough-transform-options-options": {"dfnID":"dom-readablestream-pipethrough-transform-options-options","dfnText":"options","external":false,"refSections":[],"url":"#dom-readablestream-pipethrough-transform-options-options"}, "dom-readablestream-pipethrough-transform-options-transform": {"dfnID":"dom-readablestream-pipethrough-transform-options-transform","dfnText":"transform","external":false,"refSections":[],"url":"#dom-readablestream-pipethrough-transform-options-transform"}, "dom-readablestream-pipeto-destination-options-destination": {"dfnID":"dom-readablestream-pipeto-destination-options-destination","dfnText":"destination","external":false,"refSections":[],"url":"#dom-readablestream-pipeto-destination-options-destination"}, "dom-readablestream-pipeto-destination-options-options": {"dfnID":"dom-readablestream-pipeto-destination-options-options","dfnText":"options","external":false,"refSections":[],"url":"#dom-readablestream-pipeto-destination-options-options"}, "dom-readablestream-readablestream-underlyingsource-strategy-strategy": {"dfnID":"dom-readablestream-readablestream-underlyingsource-strategy-strategy","dfnText":"strategy","external":false,"refSections":[],"url":"#dom-readablestream-readablestream-underlyingsource-strategy-strategy"}, "dom-readablestream-readablestream-underlyingsource-strategy-underlyingsource": {"dfnID":"dom-readablestream-readablestream-underlyingsource-strategy-underlyingsource","dfnText":"underlyingSource","external":false,"refSections":[],"url":"#dom-readablestream-readablestream-underlyingsource-strategy-underlyingsource"}, "dom-readablestreambyobreader-read-view-options-options": {"dfnID":"dom-readablestreambyobreader-read-view-options-options","dfnText":"options","external":false,"refSections":[],"url":"#dom-readablestreambyobreader-read-view-options-options"}, "dom-readablestreambyobreader-read-view-options-view": {"dfnID":"dom-readablestreambyobreader-read-view-options-view","dfnText":"view","external":false,"refSections":[],"url":"#dom-readablestreambyobreader-read-view-options-view"}, "dom-readablestreambyobreader-readablestreambyobreader-stream-stream": {"dfnID":"dom-readablestreambyobreader-readablestreambyobreader-stream-stream","dfnText":"stream","external":false,"refSections":[],"url":"#dom-readablestreambyobreader-readablestreambyobreader-stream-stream"}, "dom-readablestreambyobreaderreadoptions-min": {"dfnID":"dom-readablestreambyobreaderreadoptions-min","dfnText":"min","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-readablestreambyobreaderreadoptions-min"}],"title":"4.1. Using readable streams"},{"refs":[{"id":"ref-for-dom-readablestreambyobreaderreadoptions-min\u2460"},{"id":"ref-for-dom-readablestreambyobreaderreadoptions-min\u2461"},{"id":"ref-for-dom-readablestreambyobreaderreadoptions-min\u2462"},{"id":"ref-for-dom-readablestreambyobreaderreadoptions-min\u2463"},{"id":"ref-for-dom-readablestreambyobreaderreadoptions-min\u2464"},{"id":"ref-for-dom-readablestreambyobreaderreadoptions-min\u2465"}],"title":"4.5.3. Constructor, methods, and properties"}],"url":"#dom-readablestreambyobreaderreadoptions-min"}, "dom-readablestreambyobrequest-respond-byteswritten-byteswritten": {"dfnID":"dom-readablestreambyobrequest-respond-byteswritten-byteswritten","dfnText":"bytesWritten","external":false,"refSections":[],"url":"#dom-readablestreambyobrequest-respond-byteswritten-byteswritten"}, "dom-readablestreambyobrequest-respondwithnewview-view-view": {"dfnID":"dom-readablestreambyobrequest-respondwithnewview-view-view","dfnText":"view","external":false,"refSections":[],"url":"#dom-readablestreambyobrequest-respondwithnewview-view-view"}, "dom-readablestreamdefaultcontroller-enqueue-chunk-chunk": {"dfnID":"dom-readablestreamdefaultcontroller-enqueue-chunk-chunk","dfnText":"chunk","external":false,"refSections":[],"url":"#dom-readablestreamdefaultcontroller-enqueue-chunk-chunk"}, "dom-readablestreamdefaultcontroller-error-e-e": {"dfnID":"dom-readablestreamdefaultcontroller-error-e-e","dfnText":"e","external":false,"refSections":[],"url":"#dom-readablestreamdefaultcontroller-error-e-e"}, "dom-readablestreamdefaultreader-readablestreamdefaultreader-stream-stream": {"dfnID":"dom-readablestreamdefaultreader-readablestreamdefaultreader-stream-stream","dfnText":"stream","external":false,"refSections":[],"url":"#dom-readablestreamdefaultreader-readablestreamdefaultreader-stream-stream"}, "dom-readablestreamgenericreader-cancel-reason-reason": {"dfnID":"dom-readablestreamgenericreader-cancel-reason-reason","dfnText":"reason","external":false,"refSections":[],"url":"#dom-readablestreamgenericreader-cancel-reason-reason"}, "dom-readablestreamgetreaderoptions-mode": {"dfnID":"dom-readablestreamgetreaderoptions-mode","dfnText":"mode","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-readablestreamgetreaderoptions-mode"},{"id":"ref-for-dom-readablestreamgetreaderoptions-mode\u2460"},{"id":"ref-for-dom-readablestreamgetreaderoptions-mode\u2461"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-dom-readablestreamgetreaderoptions-mode\u2462"}],"title":"4.5.3. Constructor, methods, and properties"}],"url":"#dom-readablestreamgetreaderoptions-mode"}, "dom-readablestreamiteratoroptions-preventcancel": {"dfnID":"dom-readablestreamiteratoroptions-preventcancel","dfnText":"preventCancel","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-readablestreamiteratoroptions-preventcancel"},{"id":"ref-for-dom-readablestreamiteratoroptions-preventcancel\u2460"},{"id":"ref-for-dom-readablestreamiteratoroptions-preventcancel\u2461"}],"title":"4.2.5. Asynchronous iteration"}],"url":"#dom-readablestreamiteratoroptions-preventcancel"}, "dom-readablestreamreadermode-byob": {"dfnID":"dom-readablestreamreadermode-byob","dfnText":"\"byob\"","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-readablestreamreadermode-byob"},{"id":"ref-for-dom-readablestreamreadermode-byob\u2460"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-dom-readablestreamreadermode-byob\u2461"}],"title":"4.5.3. Constructor, methods, and properties"}],"url":"#dom-readablestreamreadermode-byob"}, "dom-readablestreamreadresult-done": {"dfnID":"dom-readablestreamreadresult-done","dfnText":"done","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-readablestreamreadresult-done"},{"id":"ref-for-dom-readablestreamreadresult-done\u2460"}],"title":"4.4.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-dom-readablestreamreadresult-done\u2461"},{"id":"ref-for-dom-readablestreamreadresult-done\u2462"}],"title":"4.5.3. Constructor, methods, and properties"}],"url":"#dom-readablestreamreadresult-done"}, "dom-readablestreamreadresult-value": {"dfnID":"dom-readablestreamreadresult-value","dfnText":"value","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-readablestreamreadresult-value"},{"id":"ref-for-dom-readablestreamreadresult-value\u2460"}],"title":"4.4.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-dom-readablestreamreadresult-value\u2461"},{"id":"ref-for-dom-readablestreamreadresult-value\u2462"}],"title":"4.5.3. Constructor, methods, and properties"}],"url":"#dom-readablestreamreadresult-value"}, "dom-readablestreamtype-bytes": {"dfnID":"dom-readablestreamtype-bytes","dfnText":"bytes","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-readablestreamtype-bytes"},{"id":"ref-for-dom-readablestreamtype-bytes\u2460"},{"id":"ref-for-dom-readablestreamtype-bytes\u2461"}],"title":"4.2.3. The underlying source API"},{"refs":[{"id":"ref-for-dom-readablestreamtype-bytes\u2462"}],"title":"4.2.4. Constructor, methods, and properties"}],"url":"#dom-readablestreamtype-bytes"}, "dom-readablewritablepair-readable": {"dfnID":"dom-readablewritablepair-readable","dfnText":"readable","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-readablewritablepair-readable"},{"id":"ref-for-dom-readablewritablepair-readable\u2460"}],"title":"4.2.4. Constructor, methods, and properties"}],"url":"#dom-readablewritablepair-readable"}, "dom-readablewritablepair-writable": {"dfnID":"dom-readablewritablepair-writable","dfnText":"writable","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-readablewritablepair-writable"},{"id":"ref-for-dom-readablewritablepair-writable\u2460"},{"id":"ref-for-dom-readablewritablepair-writable\u2461"}],"title":"4.2.4. Constructor, methods, and properties"}],"url":"#dom-readablewritablepair-writable"}, "dom-streampipeoptions-preventabort": {"dfnID":"dom-streampipeoptions-preventabort","dfnText":"preventAbort","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-streampipeoptions-preventabort"},{"id":"ref-for-dom-streampipeoptions-preventabort\u2460"},{"id":"ref-for-dom-streampipeoptions-preventabort\u2461"},{"id":"ref-for-dom-streampipeoptions-preventabort\u2462"},{"id":"ref-for-dom-streampipeoptions-preventabort\u2463"},{"id":"ref-for-dom-streampipeoptions-preventabort\u2464"},{"id":"ref-for-dom-streampipeoptions-preventabort\u2465"}],"title":"4.2.4. Constructor, methods, and properties"}],"url":"#dom-streampipeoptions-preventabort"}, "dom-streampipeoptions-preventcancel": {"dfnID":"dom-streampipeoptions-preventcancel","dfnText":"preventCancel","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-streampipeoptions-preventcancel"},{"id":"ref-for-dom-streampipeoptions-preventcancel\u2460"},{"id":"ref-for-dom-streampipeoptions-preventcancel\u2461"},{"id":"ref-for-dom-streampipeoptions-preventcancel\u2462"},{"id":"ref-for-dom-streampipeoptions-preventcancel\u2463"},{"id":"ref-for-dom-streampipeoptions-preventcancel\u2464"},{"id":"ref-for-dom-streampipeoptions-preventcancel\u2465"},{"id":"ref-for-dom-streampipeoptions-preventcancel\u2466"}],"title":"4.2.4. Constructor, methods, and properties"}],"url":"#dom-streampipeoptions-preventcancel"}, "dom-streampipeoptions-preventclose": {"dfnID":"dom-streampipeoptions-preventclose","dfnText":"preventClose","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-streampipeoptions-preventclose"},{"id":"ref-for-dom-streampipeoptions-preventclose\u2460"},{"id":"ref-for-dom-streampipeoptions-preventclose\u2461"},{"id":"ref-for-dom-streampipeoptions-preventclose\u2462"},{"id":"ref-for-dom-streampipeoptions-preventclose\u2463"}],"title":"4.2.4. Constructor, methods, and properties"}],"url":"#dom-streampipeoptions-preventclose"}, "dom-streampipeoptions-signal": {"dfnID":"dom-streampipeoptions-signal","dfnText":"signal","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-streampipeoptions-signal"},{"id":"ref-for-dom-streampipeoptions-signal\u2460"},{"id":"ref-for-dom-streampipeoptions-signal\u2461"},{"id":"ref-for-dom-streampipeoptions-signal\u2462"},{"id":"ref-for-dom-streampipeoptions-signal\u2463"}],"title":"4.2.4. Constructor, methods, and properties"}],"url":"#dom-streampipeoptions-signal"}, "dom-transformer-cancel": {"dfnID":"dom-transformer-cancel","dfnText":"cancel(reason)","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-transformer-cancel"},{"id":"ref-for-dom-transformer-cancel\u2460"}],"title":"6.2.3. The transformer API"},{"refs":[{"id":"ref-for-dom-transformer-cancel\u2461"},{"id":"ref-for-dom-transformer-cancel\u2462"}],"title":"6.4.2. Default controllers"}],"url":"#dom-transformer-cancel"}, "dom-transformer-flush": {"dfnID":"dom-transformer-flush","dfnText":"flush(controller)","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-transformer-flush"},{"id":"ref-for-dom-transformer-flush\u2460"},{"id":"ref-for-dom-transformer-flush\u2461"},{"id":"ref-for-dom-transformer-flush\u2462"}],"title":"6.2.3. The transformer API"},{"refs":[{"id":"ref-for-dom-transformer-flush\u2463"},{"id":"ref-for-dom-transformer-flush\u2464"}],"title":"6.4.2. Default controllers"}],"url":"#dom-transformer-flush"}, "dom-transformer-readabletype": {"dfnID":"dom-transformer-readabletype","dfnText":"readableType","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-transformer-readabletype"}],"title":"6.2.3. The transformer API"},{"refs":[{"id":"ref-for-dom-transformer-readabletype\u2460"}],"title":"6.2.4. Constructor and properties"}],"url":"#dom-transformer-readabletype"}, "dom-transformer-start": {"dfnID":"dom-transformer-start","dfnText":"start(controller)","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-transformer-start"},{"id":"ref-for-dom-transformer-start\u2460"},{"id":"ref-for-dom-transformer-start\u2461"}],"title":"6.2.3. The transformer API"},{"refs":[{"id":"ref-for-dom-transformer-start\u2462"},{"id":"ref-for-dom-transformer-start\u2463"}],"title":"6.2.4. Constructor and properties"},{"refs":[{"id":"ref-for-dom-transformer-start\u2464"}],"title":"6.4.1. Working with transform streams"}],"url":"#dom-transformer-start"}, "dom-transformer-transform": {"dfnID":"dom-transformer-transform","dfnText":"transform(chunk, controller)","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-transformer-transform"}],"title":"2.3. Transform streams"},{"refs":[{"id":"ref-for-dom-transformer-transform\u2460"},{"id":"ref-for-dom-transformer-transform\u2461"},{"id":"ref-for-dom-transformer-transform\u2462"},{"id":"ref-for-dom-transformer-transform\u2463"}],"title":"6.2.3. The transformer API"},{"refs":[{"id":"ref-for-dom-transformer-transform\u2464"},{"id":"ref-for-dom-transformer-transform\u2465"}],"title":"6.4.2. Default controllers"}],"url":"#dom-transformer-transform"}, "dom-transformer-writabletype": {"dfnID":"dom-transformer-writabletype","dfnText":"writableType","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-transformer-writabletype"}],"title":"6.2.3. The transformer API"},{"refs":[{"id":"ref-for-dom-transformer-writabletype\u2460"}],"title":"6.2.4. Constructor and properties"}],"url":"#dom-transformer-writabletype"}, "dom-transformercancelcallback-reason": {"dfnID":"dom-transformercancelcallback-reason","dfnText":"reason","external":false,"refSections":[],"url":"#dom-transformercancelcallback-reason"}, "dom-transformerflushcallback-controller": {"dfnID":"dom-transformerflushcallback-controller","dfnText":"controller","external":false,"refSections":[],"url":"#dom-transformerflushcallback-controller"}, "dom-transformerstartcallback-controller": {"dfnID":"dom-transformerstartcallback-controller","dfnText":"controller","external":false,"refSections":[],"url":"#dom-transformerstartcallback-controller"}, "dom-transformertransformcallback-chunk": {"dfnID":"dom-transformertransformcallback-chunk","dfnText":"chunk","external":false,"refSections":[],"url":"#dom-transformertransformcallback-chunk"}, "dom-transformertransformcallback-controller": {"dfnID":"dom-transformertransformcallback-controller","dfnText":"controller","external":false,"refSections":[],"url":"#dom-transformertransformcallback-controller"}, "dom-transformstream-transformstream-transformer-writablestrategy-readablestrategy-readablestrategy": {"dfnID":"dom-transformstream-transformstream-transformer-writablestrategy-readablestrategy-readablestrategy","dfnText":"readableStrategy","external":false,"refSections":[],"url":"#dom-transformstream-transformstream-transformer-writablestrategy-readablestrategy-readablestrategy"}, "dom-transformstream-transformstream-transformer-writablestrategy-readablestrategy-transformer": {"dfnID":"dom-transformstream-transformstream-transformer-writablestrategy-readablestrategy-transformer","dfnText":"transformer","external":false,"refSections":[],"url":"#dom-transformstream-transformstream-transformer-writablestrategy-readablestrategy-transformer"}, "dom-transformstream-transformstream-transformer-writablestrategy-readablestrategy-writablestrategy": {"dfnID":"dom-transformstream-transformstream-transformer-writablestrategy-readablestrategy-writablestrategy","dfnText":"writableStrategy","external":false,"refSections":[],"url":"#dom-transformstream-transformstream-transformer-writablestrategy-readablestrategy-writablestrategy"}, "dom-transformstreamdefaultcontroller-enqueue-chunk-chunk": {"dfnID":"dom-transformstreamdefaultcontroller-enqueue-chunk-chunk","dfnText":"chunk","external":false,"refSections":[],"url":"#dom-transformstreamdefaultcontroller-enqueue-chunk-chunk"}, "dom-transformstreamdefaultcontroller-error-reason-reason": {"dfnID":"dom-transformstreamdefaultcontroller-error-reason-reason","dfnText":"reason","external":false,"refSections":[],"url":"#dom-transformstreamdefaultcontroller-error-reason-reason"}, "dom-underlyingsink-abort": {"dfnID":"dom-underlyingsink-abort","dfnText":"abort(reason)","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-underlyingsink-abort"}],"title":"4.2.3. The underlying source API"},{"refs":[{"id":"ref-for-dom-underlyingsink-abort\u2460"},{"id":"ref-for-dom-underlyingsink-abort\u2461"}],"title":"5.2.3. The underlying sink API"},{"refs":[{"id":"ref-for-dom-underlyingsink-abort\u2462"},{"id":"ref-for-dom-underlyingsink-abort\u2463"}],"title":"5.5.4. Default controllers"}],"url":"#dom-underlyingsink-abort"}, "dom-underlyingsink-close": {"dfnID":"dom-underlyingsink-close","dfnText":"close()","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-underlyingsink-close"}],"title":"4.2.3. The underlying source API"},{"refs":[{"id":"ref-for-dom-underlyingsink-close\u2460"},{"id":"ref-for-dom-underlyingsink-close\u2461"},{"id":"ref-for-dom-underlyingsink-close\u2462"}],"title":"5.2.3. The underlying sink API"},{"refs":[{"id":"ref-for-dom-underlyingsink-close\u2463"},{"id":"ref-for-dom-underlyingsink-close\u2464"}],"title":"5.5.4. Default controllers"}],"url":"#dom-underlyingsink-close"}, "dom-underlyingsink-start": {"dfnID":"dom-underlyingsink-start","dfnText":"start(controller)","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-underlyingsink-start"},{"id":"ref-for-dom-underlyingsink-start\u2460"},{"id":"ref-for-dom-underlyingsink-start\u2461"}],"title":"5.2.3. The underlying sink API"},{"refs":[{"id":"ref-for-dom-underlyingsink-start\u2462"},{"id":"ref-for-dom-underlyingsink-start\u2463"}],"title":"5.5.4. Default controllers"}],"url":"#dom-underlyingsink-start"}, "dom-underlyingsink-type": {"dfnID":"dom-underlyingsink-type","dfnText":"type","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-underlyingsink-type"}],"title":"5.2.3. The underlying sink API"},{"refs":[{"id":"ref-for-dom-underlyingsink-type\u2460"}],"title":"5.2.4. Constructor, methods, and properties"}],"url":"#dom-underlyingsink-type"}, "dom-underlyingsink-write": {"dfnID":"dom-underlyingsink-write","dfnText":"write(chunk,\n controller)","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-underlyingsink-write"}],"title":"4.1. Using readable streams"},{"refs":[{"id":"ref-for-dom-underlyingsink-write\u2460"},{"id":"ref-for-dom-underlyingsink-write\u2461"}],"title":"5.2.3. The underlying sink API"},{"refs":[{"id":"ref-for-dom-underlyingsink-write\u2462"}],"title":"5.3.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-dom-underlyingsink-write\u2463"},{"id":"ref-for-dom-underlyingsink-write\u2464"}],"title":"5.5.4. Default controllers"},{"refs":[{"id":"ref-for-dom-underlyingsink-write\u2465"}],"title":"10.7. A writable stream with backpressure and success signals"}],"url":"#dom-underlyingsink-write"}, "dom-underlyingsinkabortcallback-reason": {"dfnID":"dom-underlyingsinkabortcallback-reason","dfnText":"reason","external":false,"refSections":[],"url":"#dom-underlyingsinkabortcallback-reason"}, "dom-underlyingsinkstartcallback-controller": {"dfnID":"dom-underlyingsinkstartcallback-controller","dfnText":"controller","external":false,"refSections":[],"url":"#dom-underlyingsinkstartcallback-controller"}, "dom-underlyingsinkwritecallback-chunk": {"dfnID":"dom-underlyingsinkwritecallback-chunk","dfnText":"chunk","external":false,"refSections":[],"url":"#dom-underlyingsinkwritecallback-chunk"}, "dom-underlyingsinkwritecallback-controller": {"dfnID":"dom-underlyingsinkwritecallback-controller","dfnText":"controller","external":false,"refSections":[],"url":"#dom-underlyingsinkwritecallback-controller"}, "dom-underlyingsource-autoallocatechunksize": {"dfnID":"dom-underlyingsource-autoallocatechunksize","dfnText":"autoAllocateChunkSize","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-underlyingsource-autoallocatechunksize"}],"title":"4.2.3. The underlying source API"},{"refs":[{"id":"ref-for-dom-underlyingsource-autoallocatechunksize\u2460"}],"title":"4.9.5. Byte stream controllers"},{"refs":[{"id":"ref-for-dom-underlyingsource-autoallocatechunksize\u2461"}],"title":"10.5. A readable byte stream with an underlying pull source"}],"url":"#dom-underlyingsource-autoallocatechunksize"}, "dom-underlyingsource-cancel": {"dfnID":"dom-underlyingsource-cancel","dfnText":"cancel(reason)","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-underlyingsource-cancel"}],"title":"4.2.3. The underlying source API"},{"refs":[{"id":"ref-for-dom-underlyingsource-cancel\u2460"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-dom-underlyingsource-cancel\u2461"},{"id":"ref-for-dom-underlyingsource-cancel\u2462"}],"title":"4.9.4. Default controllers"},{"refs":[{"id":"ref-for-dom-underlyingsource-cancel\u2463"},{"id":"ref-for-dom-underlyingsource-cancel\u2464"}],"title":"4.9.5. Byte stream controllers"}],"url":"#dom-underlyingsource-cancel"}, "dom-underlyingsource-pull": {"dfnID":"dom-underlyingsource-pull","dfnText":"pull(controller)","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-underlyingsource-pull"},{"id":"ref-for-dom-underlyingsource-pull\u2460"},{"id":"ref-for-dom-underlyingsource-pull\u2461"},{"id":"ref-for-dom-underlyingsource-pull\u2462"}],"title":"4.2.3. The underlying source API"},{"refs":[{"id":"ref-for-dom-underlyingsource-pull\u2463"},{"id":"ref-for-dom-underlyingsource-pull\u2464"}],"title":"4.9.4. Default controllers"},{"refs":[{"id":"ref-for-dom-underlyingsource-pull\u2465"},{"id":"ref-for-dom-underlyingsource-pull\u2466"}],"title":"4.9.5. Byte stream controllers"},{"refs":[{"id":"ref-for-dom-underlyingsource-pull\u2467"}],"title":"7.1. The queuing strategy API"},{"refs":[{"id":"ref-for-dom-underlyingsource-pull\u2468"}],"title":"10.4. A readable stream with an underlying pull source"}],"url":"#dom-underlyingsource-pull"}, "dom-underlyingsource-start": {"dfnID":"dom-underlyingsource-start","dfnText":"start(controller)","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-underlyingsource-start"},{"id":"ref-for-dom-underlyingsource-start\u2460"},{"id":"ref-for-dom-underlyingsource-start\u2461"},{"id":"ref-for-dom-underlyingsource-start\u2462"}],"title":"4.2.3. The underlying source API"},{"refs":[{"id":"ref-for-dom-underlyingsource-start\u2463"},{"id":"ref-for-dom-underlyingsource-start\u2464"}],"title":"4.9.4. Default controllers"},{"refs":[{"id":"ref-for-dom-underlyingsource-start\u2465"},{"id":"ref-for-dom-underlyingsource-start\u2466"}],"title":"4.9.5. Byte stream controllers"},{"refs":[{"id":"ref-for-dom-underlyingsource-start\u2467"}],"title":"10.1. A readable stream with an underlying push source (no\nbackpressure support)"},{"refs":[{"id":"ref-for-dom-underlyingsource-start\u2468"}],"title":"10.4. A readable stream with an underlying pull source"}],"url":"#dom-underlyingsource-start"}, "dom-underlyingsource-type": {"dfnID":"dom-underlyingsource-type","dfnText":"type","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-underlyingsource-type"},{"id":"ref-for-dom-underlyingsource-type\u2460"},{"id":"ref-for-dom-underlyingsource-type\u2461"}],"title":"4.2.3. The underlying source API"},{"refs":[{"id":"ref-for-dom-underlyingsource-type\u2462"},{"id":"ref-for-dom-underlyingsource-type\u2463"}],"title":"4.2.4. Constructor, methods, and properties"}],"url":"#dom-underlyingsource-type"}, "dom-underlyingsourcecancelcallback-reason": {"dfnID":"dom-underlyingsourcecancelcallback-reason","dfnText":"reason","external":false,"refSections":[],"url":"#dom-underlyingsourcecancelcallback-reason"}, "dom-underlyingsourcepullcallback-controller": {"dfnID":"dom-underlyingsourcepullcallback-controller","dfnText":"controller","external":false,"refSections":[],"url":"#dom-underlyingsourcepullcallback-controller"}, "dom-underlyingsourcestartcallback-controller": {"dfnID":"dom-underlyingsourcestartcallback-controller","dfnText":"controller","external":false,"refSections":[],"url":"#dom-underlyingsourcestartcallback-controller"}, "dom-writablestream-abort-reason-reason": {"dfnID":"dom-writablestream-abort-reason-reason","dfnText":"reason","external":false,"refSections":[],"url":"#dom-writablestream-abort-reason-reason"}, "dom-writablestream-writablestream-underlyingsink-strategy-strategy": {"dfnID":"dom-writablestream-writablestream-underlyingsink-strategy-strategy","dfnText":"strategy","external":false,"refSections":[],"url":"#dom-writablestream-writablestream-underlyingsink-strategy-strategy"}, "dom-writablestream-writablestream-underlyingsink-strategy-underlyingsink": {"dfnID":"dom-writablestream-writablestream-underlyingsink-strategy-underlyingsink","dfnText":"underlyingSink","external":false,"refSections":[],"url":"#dom-writablestream-writablestream-underlyingsink-strategy-underlyingsink"}, "dom-writablestreamdefaultcontroller-error-e-e": {"dfnID":"dom-writablestreamdefaultcontroller-error-e-e","dfnText":"e","external":false,"refSections":[],"url":"#dom-writablestreamdefaultcontroller-error-e-e"}, "dom-writablestreamdefaultwriter-abort-reason-reason": {"dfnID":"dom-writablestreamdefaultwriter-abort-reason-reason","dfnText":"reason","external":false,"refSections":[],"url":"#dom-writablestreamdefaultwriter-abort-reason-reason"}, "dom-writablestreamdefaultwriter-writablestreamdefaultwriter-stream-stream": {"dfnID":"dom-writablestreamdefaultwriter-writablestreamdefaultwriter-stream-stream","dfnText":"stream","external":false,"refSections":[],"url":"#dom-writablestreamdefaultwriter-writablestreamdefaultwriter-stream-stream"}, "dom-writablestreamdefaultwriter-write-chunk-chunk": {"dfnID":"dom-writablestreamdefaultwriter-write-chunk-chunk","dfnText":"chunk","external":false,"refSections":[],"url":"#dom-writablestreamdefaultwriter-write-chunk-chunk"}, "duplex-stream": {"dfnID":"duplex-stream","dfnText":"duplex stream","external":false,"refSections":[],"url":"#duplex-stream"}, "e050b76b": {"dfnID":"e050b76b","dfnText":"number type","external":true,"refSections":[{"refs":[{"id":"ref-for-sec-ecmascript-language-types-number-type"}],"title":"3. Conventions"}],"url":"https://tc39.es/ecma262/multipage/ecmascript-data-types-and-values.html#sec-ecmascript-language-types-number-type"}, "e1576caa": {"dfnID":"e1576caa","dfnText":"the current Realm","external":true,"refSections":[{"refs":[{"id":"ref-for-current-realm"},{"id":"ref-for-current-realm\u2460"},{"id":"ref-for-current-realm\u2461"},{"id":"ref-for-current-realm\u2462"}],"title":"4.2.6. Transfer via postMessage()"},{"refs":[{"id":"ref-for-current-realm\u2463"},{"id":"ref-for-current-realm\u2464"},{"id":"ref-for-current-realm\u2465"},{"id":"ref-for-current-realm\u2466"}],"title":"5.2.5. Transfer via postMessage()"},{"refs":[{"id":"ref-for-current-realm\u2467"},{"id":"ref-for-current-realm\u2468"}],"title":"6.2.5. Transfer via postMessage()"},{"refs":[{"id":"ref-for-current-realm\u2460\u24ea"},{"id":"ref-for-current-realm\u2460\u2460"}],"title":"8.3. Miscellaneous"}],"url":"https://tc39.es/ecma262/#current-realm"}, "e7409427": {"dfnID":"e7409427","dfnText":"IsInteger","external":true,"refSections":[{"refs":[{"id":"ref-for-sec-isinteger"}],"title":"4.9.5. Byte stream controllers"}],"url":"https://tc39.es/ecma262/#sec-isinteger"}, "e7652812": {"dfnID":"e7652812","dfnText":"get the next iteration result","external":true,"refSections":[{"refs":[{"id":"ref-for-dfn-get-the-next-iteration-result"}],"title":"4.2.5. Asynchronous iteration"}],"url":"https://webidl.spec.whatwg.org/#dfn-get-the-next-iteration-result"}, "e7cb09fb": {"dfnID":"e7cb09fb","dfnText":"StructuredDeserializeWithTransfer","external":true,"refSections":[{"refs":[{"id":"ref-for-structureddeserializewithtransfer"}],"title":"4.2.6. Transfer via postMessage()"},{"refs":[{"id":"ref-for-structureddeserializewithtransfer\u2460"}],"title":"5.2.5. Transfer via postMessage()"},{"refs":[{"id":"ref-for-structureddeserializewithtransfer\u2461"},{"id":"ref-for-structureddeserializewithtransfer\u2462"}],"title":"6.2.5. Transfer via postMessage()"}],"url":"https://html.spec.whatwg.org/multipage/structured-data.html#structureddeserializewithtransfer"}, "e99bd18e": {"dfnID":"e99bd18e","dfnText":"relevant global object","external":true,"refSections":[{"refs":[{"id":"ref-for-concept-relevant-global"}],"title":"7.2.3. Constructor and properties"},{"refs":[{"id":"ref-for-concept-relevant-global\u2460"}],"title":"7.3.3. Constructor and properties"}],"url":"https://html.spec.whatwg.org/multipage/webappapis.html#concept-relevant-global"}, "ebbbef34": {"dfnID":"ebbbef34","dfnText":"OrdinaryObjectCreate","external":true,"refSections":[{"refs":[{"id":"ref-for-sec-ordinaryobjectcreate"}],"title":"8.2. Transferable streams"}],"url":"https://tc39.es/ecma262/multipage/ordinary-and-exotic-objects-behaviours.html#sec-ordinaryobjectcreate"}, "ec878a66": {"dfnID":"ec878a66","dfnText":"RangeError","external":true,"refSections":[{"refs":[{"id":"ref-for-exceptiondef-rangeerror"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-exceptiondef-rangeerror\u2460"},{"id":"ref-for-exceptiondef-rangeerror\u2461"}],"title":"4.5.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-exceptiondef-rangeerror\u2462"},{"id":"ref-for-exceptiondef-rangeerror\u2463"},{"id":"ref-for-exceptiondef-rangeerror\u2464"},{"id":"ref-for-exceptiondef-rangeerror\u2465"}],"title":"4.9.5. Byte stream controllers"},{"refs":[{"id":"ref-for-exceptiondef-rangeerror\u2466"}],"title":"5.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-exceptiondef-rangeerror\u2467"},{"id":"ref-for-exceptiondef-rangeerror\u2468"}],"title":"6.2.4. Constructor and properties"},{"refs":[{"id":"ref-for-exceptiondef-rangeerror\u2460\u24ea"}],"title":"7.4. Abstract operations"},{"refs":[{"id":"ref-for-exceptiondef-rangeerror\u2460\u2460"},{"id":"ref-for-exceptiondef-rangeerror\u2460\u2461"}],"title":"8.1. Queue-with-sizes"}],"url":"https://webidl.spec.whatwg.org/#exceptiondef-rangeerror"}, "ecb78c1d": {"dfnID":"ecb78c1d","dfnText":"ArrayBuffer","external":true,"refSections":[{"refs":[{"id":"ref-for-sec-arraybuffer-objects"},{"id":"ref-for-sec-arraybuffer-objects\u2460"}],"title":"4.1. Using readable streams"},{"refs":[{"id":"ref-for-sec-arraybuffer-objects\u2461"}],"title":"4.2.3. The underlying source API"},{"refs":[{"id":"ref-for-sec-arraybuffer-objects\u2462"},{"id":"ref-for-sec-arraybuffer-objects\u2463"}],"title":"4.7.2. Internal slots"},{"refs":[{"id":"ref-for-sec-arraybuffer-objects\u2464"}],"title":"8.3. Miscellaneous"}],"url":"https://tc39.es/ecma262/#sec-arraybuffer-objects"}, "ee3f3fb3": {"dfnID":"ee3f3fb3","dfnText":"RTCRtpScriptTransformer","external":true,"refSections":[{"refs":[{"id":"ref-for-rtcrtpscripttransformer"}],"title":"9.4.2. Endpoint pairs"}],"url":"https://w3c.github.io/webrtc-encoded-transform/#rtcrtpscripttransformer"}, "efd1ec5d": {"dfnID":"efd1ec5d","dfnText":"object","external":true,"refSections":[{"refs":[{"id":"ref-for-idl-object"}],"title":"4.2.1. Interface definition"},{"refs":[{"id":"ref-for-idl-object\u2460"}],"title":"5.2.1. Interface definition"},{"refs":[{"id":"ref-for-idl-object\u2461"}],"title":"6.2.1. Interface definition"}],"url":"https://webidl.spec.whatwg.org/#idl-object"}, "endpoint-pair": {"dfnID":"endpoint-pair","dfnText":"endpoint pair","external":false,"refSections":[],"url":"#endpoint-pair"}, "enqueue-value-with-size": {"dfnID":"enqueue-value-with-size","dfnText":"EnqueueValueWithSize(container, value, size)","external":false,"refSections":[{"refs":[{"id":"ref-for-enqueue-value-with-size"}],"title":"4.9.4. Default controllers"},{"refs":[{"id":"ref-for-enqueue-value-with-size\u2460"},{"id":"ref-for-enqueue-value-with-size\u2461"}],"title":"5.5.4. Default controllers"}],"url":"#enqueue-value-with-size"}, "enumdef-readablestreamreadermode": {"dfnID":"enumdef-readablestreamreadermode","dfnText":"ReadableStreamReaderMode","external":false,"refSections":[{"refs":[{"id":"ref-for-enumdef-readablestreamreadermode"}],"title":"4.2.1. Interface definition"}],"url":"#enumdef-readablestreamreadermode"}, "enumdef-readablestreamtype": {"dfnID":"enumdef-readablestreamtype","dfnText":"ReadableStreamType","external":false,"refSections":[{"refs":[{"id":"ref-for-enumdef-readablestreamtype"},{"id":"ref-for-enumdef-readablestreamtype\u2460"}],"title":"4.2.3. The underlying source API"}],"url":"#enumdef-readablestreamtype"}, "f0811ff8": {"dfnID":"f0811ff8","dfnText":"img","external":true,"refSections":[{"refs":[{"id":"ref-for-the-img-element"}],"title":"1. Introduction"}],"url":"https://html.spec.whatwg.org/multipage/embedded-content.html#the-img-element"}, "f1041b37": {"dfnID":"f1041b37","dfnText":"unhandledrejection","external":true,"refSections":[{"refs":[{"id":"ref-for-event-unhandledrejection"}],"title":"5.1. Using writable streams"}],"url":"https://html.spec.whatwg.org/multipage/indices.html#event-unhandledrejection"}, "f14b47b8": {"dfnID":"f14b47b8","dfnText":"unsigned long long","external":true,"refSections":[{"refs":[{"id":"ref-for-idl-unsigned-long-long"},{"id":"ref-for-idl-unsigned-long-long\u2460"}],"title":"4.2.3. The underlying source API"},{"refs":[{"id":"ref-for-idl-unsigned-long-long\u2461"}],"title":"4.5.1. Interface definition"},{"refs":[{"id":"ref-for-idl-unsigned-long-long\u2462"}],"title":"4.8.1. Interface definition"}],"url":"https://webidl.spec.whatwg.org/#idl-unsigned-long-long"}, "f14ed351": {"dfnID":"f14ed351","dfnText":"upon rejection","external":true,"refSections":[{"refs":[{"id":"ref-for-upon-rejection"},{"id":"ref-for-upon-rejection\u2460"},{"id":"ref-for-upon-rejection\u2461"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-upon-rejection\u2462"},{"id":"ref-for-upon-rejection\u2463"}],"title":"4.9.4. Default controllers"},{"refs":[{"id":"ref-for-upon-rejection\u2464"},{"id":"ref-for-upon-rejection\u2465"}],"title":"4.9.5. Byte stream controllers"},{"refs":[{"id":"ref-for-upon-rejection\u2466"}],"title":"5.5.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-upon-rejection\u2467"},{"id":"ref-for-upon-rejection\u2468"},{"id":"ref-for-upon-rejection\u2460\u24ea"}],"title":"5.5.4. Default controllers"}],"url":"https://webidl.spec.whatwg.org/#upon-rejection"}, "f32e046f": {"dfnID":"f32e046f","dfnText":"underlying buffer","external":true,"refSections":[{"refs":[{"id":"ref-for-buffersource-underlying-buffer"}],"title":"9.1.1. Creation and manipulation"}],"url":"https://webidl.spec.whatwg.org/#buffersource-underlying-buffer"}, "f3fd9d04": {"dfnID":"f3fd9d04","dfnText":"write (for ArrayBufferView)","external":true,"refSections":[{"refs":[{"id":"ref-for-arraybufferview-write"},{"id":"ref-for-arraybufferview-write\u2460"}],"title":"9.1.1. Creation and manipulation"}],"url":"https://webidl.spec.whatwg.org/#arraybufferview-write"}, "fb8187fa": {"dfnID":"fb8187fa","dfnText":"DataView","external":true,"refSections":[{"refs":[{"id":"ref-for-sec-dataview-objects"},{"id":"ref-for-sec-dataview-objects\u2460"}],"title":"4.5.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-sec-dataview-objects\u2461"}],"title":"4.9.5. Byte stream controllers"}],"url":"https://tc39.es/ecma262/#sec-dataview-objects"}, "ff87eaf9": {"dfnID":"ff87eaf9","dfnText":"remove","external":true,"refSections":[{"refs":[{"id":"ref-for-abortsignal-remove"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-abortsignal-remove\u2460"}],"title":"9.2.1. Creation and manipulation"}],"url":"https://dom.spec.whatwg.org/#abortsignal-remove"}, "generic-reader-cancel": {"dfnID":"generic-reader-cancel","dfnText":"cancel(reason)","external":false,"refSections":[{"refs":[{"id":"ref-for-generic-reader-cancel"}],"title":"4.2.3. The underlying source API"},{"refs":[{"id":"ref-for-generic-reader-cancel\u2460"}],"title":"4.3.1. Mixin definition"},{"refs":[{"id":"ref-for-generic-reader-cancel\u2461"}],"title":"4.4.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-generic-reader-cancel\u2462"}],"title":"4.5.3. Constructor, methods, and properties"}],"url":"#generic-reader-cancel"}, "generic-reader-closed": {"dfnID":"generic-reader-closed","dfnText":"closed","external":false,"refSections":[{"refs":[{"id":"ref-for-generic-reader-closed"}],"title":"4.3.1. Mixin definition"},{"refs":[{"id":"ref-for-generic-reader-closed\u2460"}],"title":"4.3.2. Internal slots"},{"refs":[{"id":"ref-for-generic-reader-closed\u2461"}],"title":"4.4.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-generic-reader-closed\u2462"}],"title":"4.5.3. Constructor, methods, and properties"}],"url":"#generic-reader-closed"}, "generictransformstream": {"dfnID":"generictransformstream","dfnText":"GenericTransformStream","external":false,"refSections":[{"refs":[{"id":"ref-for-generictransformstream"}],"title":"2.3. Transform streams"},{"refs":[{"id":"ref-for-generictransformstream\u2460"},{"id":"ref-for-generictransformstream\u2461"}],"title":"9.3.2. Wrapping into a custom class"}],"url":"#generictransformstream"}, "generictransformstream-transform": {"dfnID":"generictransformstream-transform","dfnText":"transform","external":false,"refSections":[{"refs":[{"id":"ref-for-generictransformstream-transform"},{"id":"ref-for-generictransformstream-transform\u2460"},{"id":"ref-for-generictransformstream-transform\u2461"}],"title":"9.3.2. Wrapping into a custom class"}],"url":"#generictransformstream-transform"}, "high-water-mark": {"dfnID":"high-water-mark","dfnText":"high water mark","external":false,"refSections":[{"refs":[{"id":"ref-for-high-water-mark"}],"title":"4.2.3. The underlying source API"},{"refs":[{"id":"ref-for-high-water-mark\u2460"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-high-water-mark\u2461"},{"id":"ref-for-high-water-mark\u2462"}],"title":"5.1. Using writable streams"},{"refs":[{"id":"ref-for-high-water-mark\u2463"}],"title":"5.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-high-water-mark\u2464"}],"title":"6.2.4. Constructor and properties"},{"refs":[{"id":"ref-for-high-water-mark\u2465"}],"title":"7.1. The queuing strategy API"},{"refs":[{"id":"ref-for-high-water-mark\u2466"},{"id":"ref-for-high-water-mark\u2467"}],"title":"7.2.3. Constructor and properties"},{"refs":[{"id":"ref-for-high-water-mark\u2468"},{"id":"ref-for-high-water-mark\u2460\u24ea"}],"title":"7.3.3. Constructor and properties"},{"refs":[{"id":"ref-for-high-water-mark\u2460\u2460"}],"title":"7.4. Abstract operations"}],"url":"#high-water-mark"}, "identity-transform-stream": {"dfnID":"identity-transform-stream","dfnText":"identity transform stream","external":false,"refSections":[{"refs":[{"id":"ref-for-identity-transform-stream"}],"title":"6.1. Using transform streams"},{"refs":[{"id":"ref-for-identity-transform-stream\u2460"}],"title":"6.2.4. Constructor and properties"},{"refs":[{"id":"ref-for-identity-transform-stream\u2461"},{"id":"ref-for-identity-transform-stream\u2462"}],"title":"10.11. Using an identity transform stream as a primitive to\ncreate new readable streams"}],"url":"#identity-transform-stream"}, "initialize-readable-stream": {"dfnID":"initialize-readable-stream","dfnText":"InitializeReadableStream(stream)","external":false,"refSections":[{"refs":[{"id":"ref-for-initialize-readable-stream"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-initialize-readable-stream\u2460"},{"id":"ref-for-initialize-readable-stream\u2461"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-initialize-readable-stream\u2462"}],"title":"8.2. Transferable streams"},{"refs":[{"id":"ref-for-initialize-readable-stream\u2463"},{"id":"ref-for-initialize-readable-stream\u2464"}],"title":"9.1.1. Creation and manipulation"}],"url":"#initialize-readable-stream"}, "initialize-transform-stream": {"dfnID":"initialize-transform-stream","dfnText":"InitializeTransformStream(stream, startPromise,\n writableHighWaterMark, writableSizeAlgorithm, readableHighWaterMark,\n readableSizeAlgorithm)","external":false,"refSections":[{"refs":[{"id":"ref-for-initialize-transform-stream"}],"title":"6.2.4. Constructor and properties"},{"refs":[{"id":"ref-for-initialize-transform-stream\u2460"}],"title":"9.3.1. Creation and manipulation"}],"url":"#initialize-transform-stream"}, "initialize-writable-stream": {"dfnID":"initialize-writable-stream","dfnText":"InitializeWritableStream(stream)","external":false,"refSections":[{"refs":[{"id":"ref-for-initialize-writable-stream"}],"title":"5.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-initialize-writable-stream\u2460"}],"title":"5.5.1. Working with writable streams"},{"refs":[{"id":"ref-for-initialize-writable-stream\u2461"}],"title":"8.2. Transferable streams"},{"refs":[{"id":"ref-for-initialize-writable-stream\u2462"}],"title":"9.2.1. Creation and manipulation"}],"url":"#initialize-writable-stream"}, "internal-queues": {"dfnID":"internal-queues","dfnText":"internal queues","external":false,"refSections":[{"refs":[{"id":"ref-for-internal-queues"}],"title":"2.2. Writable streams"},{"refs":[{"id":"ref-for-internal-queues\u2460"}],"title":"2.5. Internal queues and queuing strategies"},{"refs":[{"id":"ref-for-internal-queues\u2461"}],"title":"4.2.3. The underlying source API"},{"refs":[{"id":"ref-for-internal-queues\u2462"}],"title":"4.4.2. Internal slots"},{"refs":[{"id":"ref-for-internal-queues\u2463"}],"title":"4.4.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-internal-queues\u2464"}],"title":"4.5.2. Internal slots"},{"refs":[{"id":"ref-for-internal-queues\u2465"}],"title":"4.5.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-internal-queues\u2466"}],"title":"4.6. The ReadableStreamDefaultController class"},{"refs":[{"id":"ref-for-internal-queues\u2467"}],"title":"4.7. The ReadableByteStreamController class"},{"refs":[{"id":"ref-for-internal-queues\u2468"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-internal-queues\u2460\u24ea"}],"title":"4.9.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-internal-queues\u2460\u2460"}],"title":"5.1. Using writable streams"},{"refs":[{"id":"ref-for-internal-queues\u2460\u2461"},{"id":"ref-for-internal-queues\u2460\u2462"}],"title":"10.3. A readable byte stream with an underlying push source (no backpressure\nsupport)"}],"url":"#internal-queues"}, "is-non-negative-number": {"dfnID":"is-non-negative-number","dfnText":"IsNonNegativeNumber(v)","external":false,"refSections":[{"refs":[{"id":"ref-for-is-non-negative-number"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-is-non-negative-number\u2460"}],"title":"5.5.1. Working with writable streams"},{"refs":[{"id":"ref-for-is-non-negative-number\u2461"}],"title":"8.1. Queue-with-sizes"}],"url":"#is-non-negative-number"}, "is-readable-stream-disturbed": {"dfnID":"is-readable-stream-disturbed","dfnText":"disturbed","external":false,"refSections":[{"refs":[{"id":"ref-for-is-readable-stream-disturbed"}],"title":"9.5. Piping"}],"url":"#is-readable-stream-disturbed"}, "is-readable-stream-locked": {"dfnID":"is-readable-stream-locked","dfnText":"IsReadableStreamLocked(stream)","external":false,"refSections":[{"refs":[{"id":"ref-for-is-readable-stream-locked"},{"id":"ref-for-is-readable-stream-locked\u2460"},{"id":"ref-for-is-readable-stream-locked\u2461"},{"id":"ref-for-is-readable-stream-locked\u2462"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-is-readable-stream-locked\u2463"}],"title":"4.2.6. Transfer via postMessage()"},{"refs":[{"id":"ref-for-is-readable-stream-locked\u2464"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-is-readable-stream-locked\u2465"},{"id":"ref-for-is-readable-stream-locked\u2466"}],"title":"4.9.3. Readers"},{"refs":[{"id":"ref-for-is-readable-stream-locked\u2467"},{"id":"ref-for-is-readable-stream-locked\u2468"}],"title":"4.9.4. Default controllers"},{"refs":[{"id":"ref-for-is-readable-stream-locked\u2460\u24ea"}],"title":"4.9.5. Byte stream controllers"},{"refs":[{"id":"ref-for-is-readable-stream-locked\u2460\u2460"}],"title":"6.2.5. Transfer via postMessage()"},{"refs":[{"id":"ref-for-is-readable-stream-locked\u2460\u2461"}],"title":"9.1.3. Introspection"},{"refs":[{"id":"ref-for-is-readable-stream-locked\u2460\u2462"},{"id":"ref-for-is-readable-stream-locked\u2460\u2463"}],"title":"9.5. Piping"}],"url":"#is-readable-stream-locked"}, "is-writable-stream-locked": {"dfnID":"is-writable-stream-locked","dfnText":"IsWritableStreamLocked(stream)","external":false,"refSections":[{"refs":[{"id":"ref-for-is-writable-stream-locked"},{"id":"ref-for-is-writable-stream-locked\u2460"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-is-writable-stream-locked\u2461"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-is-writable-stream-locked\u2462"},{"id":"ref-for-is-writable-stream-locked\u2463"},{"id":"ref-for-is-writable-stream-locked\u2464"}],"title":"5.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-is-writable-stream-locked\u2465"}],"title":"5.2.5. Transfer via postMessage()"},{"refs":[{"id":"ref-for-is-writable-stream-locked\u2466"}],"title":"5.5.1. Working with writable streams"},{"refs":[{"id":"ref-for-is-writable-stream-locked\u2467"}],"title":"5.5.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-is-writable-stream-locked\u2468"}],"title":"6.2.5. Transfer via postMessage()"},{"refs":[{"id":"ref-for-is-writable-stream-locked\u2460\u24ea"},{"id":"ref-for-is-writable-stream-locked\u2460\u2460"}],"title":"9.5. Piping"}],"url":"#is-writable-stream-locked"}, "lock": {"dfnID":"lock","dfnText":"locked","external":false,"refSections":[{"refs":[{"id":"ref-for-lock"}],"title":"2.1. Readable streams"},{"refs":[{"id":"ref-for-lock\u2460"}],"title":"2.4. Pipe chains and backpressure"},{"refs":[{"id":"ref-for-lock\u2461"}],"title":"4.2.2. Internal slots"},{"refs":[{"id":"ref-for-lock\u2462"},{"id":"ref-for-lock\u2463"},{"id":"ref-for-lock\u2464"},{"id":"ref-for-lock\u2465"},{"id":"ref-for-lock\u2466"},{"id":"ref-for-lock\u2467"},{"id":"ref-for-lock\u2468"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-lock\u2460\u24ea"}],"title":"4.2.5. Asynchronous iteration"},{"refs":[{"id":"ref-for-lock\u2460\u2460"}],"title":"4.2.6. Transfer via postMessage()"},{"refs":[{"id":"ref-for-lock\u2460\u2461"}],"title":"5.2.2. Internal slots"},{"refs":[{"id":"ref-for-lock\u2460\u2462"},{"id":"ref-for-lock\u2460\u2463"},{"id":"ref-for-lock\u2460\u2464"},{"id":"ref-for-lock\u2460\u2465"}],"title":"5.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-lock\u2460\u2466"}],"title":"5.2.5. Transfer via postMessage()"}],"url":"#lock"}, "make-size-algorithm-from-size-function": {"dfnID":"make-size-algorithm-from-size-function","dfnText":"ExtractSizeAlgorithm(strategy)","external":false,"refSections":[{"refs":[{"id":"ref-for-make-size-algorithm-from-size-function"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-make-size-algorithm-from-size-function\u2460"}],"title":"5.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-make-size-algorithm-from-size-function\u2461"},{"id":"ref-for-make-size-algorithm-from-size-function\u2462"}],"title":"6.2.4. Constructor and properties"}],"url":"#make-size-algorithm-from-size-function"}, "original-source": {"dfnID":"original-source","dfnText":"original source","external":false,"refSections":[{"refs":[{"id":"ref-for-original-source"}],"title":"2.4. Pipe chains and backpressure"}],"url":"#original-source"}, "peek-queue-value": {"dfnID":"peek-queue-value","dfnText":"PeekQueueValue(container)","external":false,"refSections":[{"refs":[{"id":"ref-for-peek-queue-value"}],"title":"5.5.4. Default controllers"}],"url":"#peek-queue-value"}, "pending-abort-request": {"dfnID":"pending-abort-request","dfnText":"pending abort request","external":false,"refSections":[{"refs":[{"id":"ref-for-pending-abort-request"}],"title":"5.2.2. Internal slots"},{"refs":[{"id":"ref-for-pending-abort-request\u2460"}],"title":"5.5.1. Working with writable streams"}],"url":"#pending-abort-request"}, "pending-abort-request-promise": {"dfnID":"pending-abort-request-promise","dfnText":"promise","external":false,"refSections":[{"refs":[{"id":"ref-for-pending-abort-request-promise"},{"id":"ref-for-pending-abort-request-promise\u2460"}],"title":"5.5.1. Working with writable streams"},{"refs":[{"id":"ref-for-pending-abort-request-promise\u2461"},{"id":"ref-for-pending-abort-request-promise\u2462"},{"id":"ref-for-pending-abort-request-promise\u2463"},{"id":"ref-for-pending-abort-request-promise\u2464"},{"id":"ref-for-pending-abort-request-promise\u2465"}],"title":"5.5.2. Interfacing with controllers"}],"url":"#pending-abort-request-promise"}, "pending-abort-request-reason": {"dfnID":"pending-abort-request-reason","dfnText":"reason","external":false,"refSections":[{"refs":[{"id":"ref-for-pending-abort-request-reason"}],"title":"5.5.1. Working with writable streams"},{"refs":[{"id":"ref-for-pending-abort-request-reason\u2460"}],"title":"5.5.2. Interfacing with controllers"}],"url":"#pending-abort-request-reason"}, "pending-abort-request-was-already-erroring": {"dfnID":"pending-abort-request-was-already-erroring","dfnText":"was already erroring","external":false,"refSections":[{"refs":[{"id":"ref-for-pending-abort-request-was-already-erroring"}],"title":"5.5.1. Working with writable streams"},{"refs":[{"id":"ref-for-pending-abort-request-was-already-erroring\u2460"}],"title":"5.5.2. Interfacing with controllers"}],"url":"#pending-abort-request-was-already-erroring"}, "pipe-chain": {"dfnID":"pipe-chain","dfnText":"pipe chain","external":false,"refSections":[{"refs":[{"id":"ref-for-pipe-chain"}],"title":"1. Introduction"},{"refs":[{"id":"ref-for-pipe-chain\u2460"}],"title":"2.4. Pipe chains and backpressure"},{"refs":[{"id":"ref-for-pipe-chain\u2461"}],"title":"4.2.4. Constructor, methods, and properties"}],"url":"#pipe-chain"}, "piping": {"dfnID":"piping","dfnText":"piping","external":false,"refSections":[{"refs":[{"id":"ref-for-piping"},{"id":"ref-for-piping\u2460"}],"title":"2.6. Locking"},{"refs":[{"id":"ref-for-piping\u2461"},{"id":"ref-for-piping\u2462"},{"id":"ref-for-piping\u2463"}],"title":"4.1. Using readable streams"},{"refs":[{"id":"ref-for-piping\u2464"}],"title":"4.2.3. The underlying source API"},{"refs":[{"id":"ref-for-piping\u2465"},{"id":"ref-for-piping\u2466"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-piping\u2467"}],"title":"5.1. Using writable streams"},{"refs":[{"id":"ref-for-piping\u2468"}],"title":"5.2.3. The underlying sink API"},{"refs":[{"id":"ref-for-piping\u2460\u24ea"}],"title":"6.1. Using transform streams"},{"refs":[{"id":"ref-for-piping\u2460\u2460"}],"title":"10.1. A readable stream with an underlying push source (no\nbackpressure support)"}],"url":"#piping"}, "producer": {"dfnID":"producer","dfnText":"producer","external":false,"refSections":[{"refs":[{"id":"ref-for-producer"}],"title":"2.6. Locking"},{"refs":[{"id":"ref-for-producer\u2460"}],"title":"4.2.3. The underlying source API"},{"refs":[{"id":"ref-for-producer\u2461"}],"title":"5.1. Using writable streams"},{"refs":[{"id":"ref-for-producer\u2462"},{"id":"ref-for-producer\u2463"},{"id":"ref-for-producer\u2464"},{"id":"ref-for-producer\u2465"}],"title":"5.2.3. The underlying sink API"},{"refs":[{"id":"ref-for-producer\u2466"},{"id":"ref-for-producer\u2467"},{"id":"ref-for-producer\u2468"}],"title":"5.3.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-producer\u2460\u24ea"},{"id":"ref-for-producer\u2460\u2460"}],"title":"6.2.3. The transformer API"},{"refs":[{"id":"ref-for-producer\u2460\u2461"}],"title":"7.2. The ByteLengthQueuingStrategy class"},{"refs":[{"id":"ref-for-producer\u2460\u2462"}],"title":"7.3. The CountQueuingStrategy class"},{"refs":[{"id":"ref-for-producer\u2460\u2463"}],"title":"10.6. A writable stream with no backpressure or success signals"},{"refs":[{"id":"ref-for-producer\u2460\u2464"}],"title":"10.7. A writable stream with backpressure and success signals"}],"url":"#producer"}, "pull-into-descriptor": {"dfnID":"pull-into-descriptor","dfnText":"pull-into descriptor","external":false,"refSections":[{"refs":[{"id":"ref-for-pull-into-descriptor"}],"title":"4.7.2. Internal slots"},{"refs":[{"id":"ref-for-pull-into-descriptor\u2460"}],"title":"4.7.4. Internal methods"},{"refs":[{"id":"ref-for-pull-into-descriptor\u2461"}],"title":"4.9.5. Byte stream controllers"}],"url":"#pull-into-descriptor"}, "pull-into-descriptor-buffer": {"dfnID":"pull-into-descriptor-buffer","dfnText":"buffer","external":false,"refSections":[{"refs":[{"id":"ref-for-pull-into-descriptor-buffer"},{"id":"ref-for-pull-into-descriptor-buffer\u2460"},{"id":"ref-for-pull-into-descriptor-buffer\u2461"},{"id":"ref-for-pull-into-descriptor-buffer\u2462"},{"id":"ref-for-pull-into-descriptor-buffer\u2463"},{"id":"ref-for-pull-into-descriptor-buffer\u2464"},{"id":"ref-for-pull-into-descriptor-buffer\u2465"}],"title":"4.7.2. Internal slots"},{"refs":[{"id":"ref-for-pull-into-descriptor-buffer\u2466"}],"title":"4.7.4. Internal methods"},{"refs":[{"id":"ref-for-pull-into-descriptor-buffer\u2467"},{"id":"ref-for-pull-into-descriptor-buffer\u2468"},{"id":"ref-for-pull-into-descriptor-buffer\u2460\u24ea"},{"id":"ref-for-pull-into-descriptor-buffer\u2460\u2460"},{"id":"ref-for-pull-into-descriptor-buffer\u2460\u2461"},{"id":"ref-for-pull-into-descriptor-buffer\u2460\u2462"},{"id":"ref-for-pull-into-descriptor-buffer\u2460\u2463"},{"id":"ref-for-pull-into-descriptor-buffer\u2460\u2464"},{"id":"ref-for-pull-into-descriptor-buffer\u2460\u2465"},{"id":"ref-for-pull-into-descriptor-buffer\u2460\u2466"},{"id":"ref-for-pull-into-descriptor-buffer\u2460\u2467"},{"id":"ref-for-pull-into-descriptor-buffer\u2460\u2468"},{"id":"ref-for-pull-into-descriptor-buffer\u2461\u24ea"},{"id":"ref-for-pull-into-descriptor-buffer\u2461\u2460"},{"id":"ref-for-pull-into-descriptor-buffer\u2461\u2461"},{"id":"ref-for-pull-into-descriptor-buffer\u2461\u2462"}],"title":"4.9.5. Byte stream controllers"}],"url":"#pull-into-descriptor-buffer"}, "pull-into-descriptor-buffer-byte-length": {"dfnID":"pull-into-descriptor-buffer-byte-length","dfnText":"buffer byte length","external":false,"refSections":[{"refs":[{"id":"ref-for-pull-into-descriptor-buffer-byte-length"}],"title":"4.7.4. Internal methods"},{"refs":[{"id":"ref-for-pull-into-descriptor-buffer-byte-length\u2460"},{"id":"ref-for-pull-into-descriptor-buffer-byte-length\u2461"}],"title":"4.9.5. Byte stream controllers"}],"url":"#pull-into-descriptor-buffer-byte-length"}, "pull-into-descriptor-byte-length": {"dfnID":"pull-into-descriptor-byte-length","dfnText":"byte length","external":false,"refSections":[{"refs":[{"id":"ref-for-pull-into-descriptor-byte-length"}],"title":"4.7.4. Internal methods"},{"refs":[{"id":"ref-for-pull-into-descriptor-byte-length\u2460"},{"id":"ref-for-pull-into-descriptor-byte-length\u2461"},{"id":"ref-for-pull-into-descriptor-byte-length\u2462"},{"id":"ref-for-pull-into-descriptor-byte-length\u2463"},{"id":"ref-for-pull-into-descriptor-byte-length\u2464"},{"id":"ref-for-pull-into-descriptor-byte-length\u2465"},{"id":"ref-for-pull-into-descriptor-byte-length\u2466"}],"title":"4.9.5. Byte stream controllers"}],"url":"#pull-into-descriptor-byte-length"}, "pull-into-descriptor-byte-offset": {"dfnID":"pull-into-descriptor-byte-offset","dfnText":"byte offset","external":false,"refSections":[{"refs":[{"id":"ref-for-pull-into-descriptor-byte-offset"}],"title":"4.7.4. Internal methods"},{"refs":[{"id":"ref-for-pull-into-descriptor-byte-offset\u2460"},{"id":"ref-for-pull-into-descriptor-byte-offset\u2461"},{"id":"ref-for-pull-into-descriptor-byte-offset\u2462"},{"id":"ref-for-pull-into-descriptor-byte-offset\u2463"},{"id":"ref-for-pull-into-descriptor-byte-offset\u2464"},{"id":"ref-for-pull-into-descriptor-byte-offset\u2465"},{"id":"ref-for-pull-into-descriptor-byte-offset\u2466"},{"id":"ref-for-pull-into-descriptor-byte-offset\u2467"}],"title":"4.9.5. Byte stream controllers"}],"url":"#pull-into-descriptor-byte-offset"}, "pull-into-descriptor-bytes-filled": {"dfnID":"pull-into-descriptor-bytes-filled","dfnText":"bytes filled","external":false,"refSections":[{"refs":[{"id":"ref-for-pull-into-descriptor-bytes-filled"}],"title":"4.7.4. Internal methods"},{"refs":[{"id":"ref-for-pull-into-descriptor-bytes-filled\u2460"},{"id":"ref-for-pull-into-descriptor-bytes-filled\u2461"},{"id":"ref-for-pull-into-descriptor-bytes-filled\u2462"},{"id":"ref-for-pull-into-descriptor-bytes-filled\u2463"},{"id":"ref-for-pull-into-descriptor-bytes-filled\u2464"},{"id":"ref-for-pull-into-descriptor-bytes-filled\u2465"},{"id":"ref-for-pull-into-descriptor-bytes-filled\u2466"},{"id":"ref-for-pull-into-descriptor-bytes-filled\u2467"},{"id":"ref-for-pull-into-descriptor-bytes-filled\u2468"},{"id":"ref-for-pull-into-descriptor-bytes-filled\u2460\u24ea"},{"id":"ref-for-pull-into-descriptor-bytes-filled\u2460\u2460"},{"id":"ref-for-pull-into-descriptor-bytes-filled\u2460\u2461"},{"id":"ref-for-pull-into-descriptor-bytes-filled\u2460\u2462"},{"id":"ref-for-pull-into-descriptor-bytes-filled\u2460\u2463"},{"id":"ref-for-pull-into-descriptor-bytes-filled\u2460\u2464"},{"id":"ref-for-pull-into-descriptor-bytes-filled\u2460\u2465"},{"id":"ref-for-pull-into-descriptor-bytes-filled\u2460\u2466"},{"id":"ref-for-pull-into-descriptor-bytes-filled\u2460\u2467"},{"id":"ref-for-pull-into-descriptor-bytes-filled\u2460\u2468"},{"id":"ref-for-pull-into-descriptor-bytes-filled\u2461\u24ea"},{"id":"ref-for-pull-into-descriptor-bytes-filled\u2461\u2460"},{"id":"ref-for-pull-into-descriptor-bytes-filled\u2461\u2461"},{"id":"ref-for-pull-into-descriptor-bytes-filled\u2461\u2462"},{"id":"ref-for-pull-into-descriptor-bytes-filled\u2461\u2463"},{"id":"ref-for-pull-into-descriptor-bytes-filled\u2461\u2464"},{"id":"ref-for-pull-into-descriptor-bytes-filled\u2461\u2465"},{"id":"ref-for-pull-into-descriptor-bytes-filled\u2461\u2466"}],"title":"4.9.5. Byte stream controllers"}],"url":"#pull-into-descriptor-bytes-filled"}, "pull-into-descriptor-element-size": {"dfnID":"pull-into-descriptor-element-size","dfnText":"element size","external":false,"refSections":[{"refs":[{"id":"ref-for-pull-into-descriptor-element-size"}],"title":"4.7.2. Internal slots"},{"refs":[{"id":"ref-for-pull-into-descriptor-element-size\u2460"}],"title":"4.7.4. Internal methods"},{"refs":[{"id":"ref-for-pull-into-descriptor-element-size\u2461"},{"id":"ref-for-pull-into-descriptor-element-size\u2462"},{"id":"ref-for-pull-into-descriptor-element-size\u2463"},{"id":"ref-for-pull-into-descriptor-element-size\u2464"},{"id":"ref-for-pull-into-descriptor-element-size\u2465"},{"id":"ref-for-pull-into-descriptor-element-size\u2466"},{"id":"ref-for-pull-into-descriptor-element-size\u2467"}],"title":"4.9.5. Byte stream controllers"}],"url":"#pull-into-descriptor-element-size"}, "pull-into-descriptor-minimum-fill": {"dfnID":"pull-into-descriptor-minimum-fill","dfnText":"minimum fill","external":false,"refSections":[{"refs":[{"id":"ref-for-pull-into-descriptor-minimum-fill"}],"title":"4.7.4. Internal methods"},{"refs":[{"id":"ref-for-pull-into-descriptor-minimum-fill\u2460"},{"id":"ref-for-pull-into-descriptor-minimum-fill\u2461"},{"id":"ref-for-pull-into-descriptor-minimum-fill\u2462"},{"id":"ref-for-pull-into-descriptor-minimum-fill\u2463"},{"id":"ref-for-pull-into-descriptor-minimum-fill\u2464"}],"title":"4.9.5. Byte stream controllers"}],"url":"#pull-into-descriptor-minimum-fill"}, "pull-into-descriptor-reader-type": {"dfnID":"pull-into-descriptor-reader-type","dfnText":"reader type","external":false,"refSections":[{"refs":[{"id":"ref-for-pull-into-descriptor-reader-type"},{"id":"ref-for-pull-into-descriptor-reader-type\u2460"}],"title":"4.7.4. Internal methods"},{"refs":[{"id":"ref-for-pull-into-descriptor-reader-type\u2461"},{"id":"ref-for-pull-into-descriptor-reader-type\u2462"},{"id":"ref-for-pull-into-descriptor-reader-type\u2463"},{"id":"ref-for-pull-into-descriptor-reader-type\u2464"},{"id":"ref-for-pull-into-descriptor-reader-type\u2465"},{"id":"ref-for-pull-into-descriptor-reader-type\u2466"},{"id":"ref-for-pull-into-descriptor-reader-type\u2467"},{"id":"ref-for-pull-into-descriptor-reader-type\u2468"},{"id":"ref-for-pull-into-descriptor-reader-type\u2460\u24ea"}],"title":"4.9.5. Byte stream controllers"}],"url":"#pull-into-descriptor-reader-type"}, "pull-into-descriptor-view-constructor": {"dfnID":"pull-into-descriptor-view-constructor","dfnText":"view constructor","external":false,"refSections":[{"refs":[{"id":"ref-for-pull-into-descriptor-view-constructor"}],"title":"4.7.2. Internal slots"},{"refs":[{"id":"ref-for-pull-into-descriptor-view-constructor\u2460"}],"title":"4.7.4. Internal methods"},{"refs":[{"id":"ref-for-pull-into-descriptor-view-constructor\u2461"},{"id":"ref-for-pull-into-descriptor-view-constructor\u2462"}],"title":"4.9.5. Byte stream controllers"}],"url":"#pull-into-descriptor-view-constructor"}, "pull-source": {"dfnID":"pull-source","dfnText":"Pull sources","external":false,"refSections":[{"refs":[{"id":"ref-for-pull-source"},{"id":"ref-for-pull-source\u2460"}],"title":"4.2.3. The underlying source API"},{"refs":[{"id":"ref-for-pull-source\u2461"}],"title":"10.4. A readable stream with an underlying pull source"}],"url":"#pull-source"}, "push-source": {"dfnID":"push-source","dfnText":"Push sources","external":false,"refSections":[{"refs":[{"id":"ref-for-push-source"},{"id":"ref-for-push-source\u2460"}],"title":"4.2.3. The underlying source API"},{"refs":[{"id":"ref-for-push-source\u2461"}],"title":"10.1. A readable stream with an underlying push source (no\nbackpressure support)"}],"url":"#push-source"}, "queuing-strategy": {"dfnID":"queuing-strategy","dfnText":"queuing strategy","external":false,"refSections":[{"refs":[{"id":"ref-for-queuing-strategy"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-queuing-strategy\u2460"},{"id":"ref-for-queuing-strategy\u2461"}],"title":"4.6.2. Internal slots"},{"refs":[{"id":"ref-for-queuing-strategy\u2462"}],"title":"4.7.2. Internal slots"},{"refs":[{"id":"ref-for-queuing-strategy\u2463"}],"title":"5.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-queuing-strategy\u2464"},{"id":"ref-for-queuing-strategy\u2465"}],"title":"5.4.2. Internal slots"},{"refs":[{"id":"ref-for-queuing-strategy\u2466"}],"title":"6.2.4. Constructor and properties"},{"refs":[{"id":"ref-for-queuing-strategy\u2467"}],"title":"7.1. The queuing strategy API"},{"refs":[{"id":"ref-for-queuing-strategy\u2468"},{"id":"ref-for-queuing-strategy\u2460\u24ea"}],"title":"7.2. The ByteLengthQueuingStrategy class"},{"refs":[{"id":"ref-for-queuing-strategy\u2460\u2460"}],"title":"7.3. The CountQueuingStrategy class"}],"url":"#queuing-strategy"}, "rbs-controller-byob-request": {"dfnID":"rbs-controller-byob-request","dfnText":"byobRequest","external":false,"refSections":[{"refs":[{"id":"ref-for-rbs-controller-byob-request"}],"title":"4.2.3. The underlying source API"},{"refs":[{"id":"ref-for-rbs-controller-byob-request\u2460"}],"title":"4.7.1. Interface definition"},{"refs":[{"id":"ref-for-rbs-controller-byob-request\u2461"}],"title":"4.7.3. Methods and properties"}],"url":"#rbs-controller-byob-request"}, "rbs-controller-close": {"dfnID":"rbs-controller-close","dfnText":"close()","external":false,"refSections":[{"refs":[{"id":"ref-for-rbs-controller-close"}],"title":"4.7.1. Interface definition"},{"refs":[{"id":"ref-for-rbs-controller-close\u2460"}],"title":"4.7.3. Methods and properties"}],"url":"#rbs-controller-close"}, "rbs-controller-desired-size": {"dfnID":"rbs-controller-desired-size","dfnText":"desiredSize","external":false,"refSections":[{"refs":[{"id":"ref-for-rbs-controller-desired-size"}],"title":"2.4. Pipe chains and backpressure"},{"refs":[{"id":"ref-for-rbs-controller-desired-size\u2460"}],"title":"4.7.1. Interface definition"},{"refs":[{"id":"ref-for-rbs-controller-desired-size\u2461"}],"title":"4.7.3. Methods and properties"},{"refs":[{"id":"ref-for-rbs-controller-desired-size\u2462"}],"title":"7.1. The queuing strategy API"},{"refs":[{"id":"ref-for-rbs-controller-desired-size\u2463"},{"id":"ref-for-rbs-controller-desired-size\u2464"}],"title":"10.3. A readable byte stream with an underlying push source (no backpressure\nsupport)"}],"url":"#rbs-controller-desired-size"}, "rbs-controller-enqueue": {"dfnID":"rbs-controller-enqueue","dfnText":"enqueue(chunk)","external":false,"refSections":[{"refs":[{"id":"ref-for-rbs-controller-enqueue"}],"title":"4.7.1. Interface definition"},{"refs":[{"id":"ref-for-rbs-controller-enqueue\u2460"}],"title":"4.7.3. Methods and properties"}],"url":"#rbs-controller-enqueue"}, "rbs-controller-error": {"dfnID":"rbs-controller-error","dfnText":"error(e)","external":false,"refSections":[{"refs":[{"id":"ref-for-rbs-controller-error"}],"title":"4.7.1. Interface definition"},{"refs":[{"id":"ref-for-rbs-controller-error\u2460"}],"title":"4.7.3. Methods and properties"}],"url":"#rbs-controller-error"}, "rbs-controller-private-cancel": {"dfnID":"rbs-controller-private-cancel","dfnText":"[[CancelSteps]](reason)","external":false,"refSections":[],"url":"#rbs-controller-private-cancel"}, "rbs-controller-private-pull": {"dfnID":"rbs-controller-private-pull","dfnText":"[[PullSteps]](readRequest)","external":false,"refSections":[],"url":"#rbs-controller-private-pull"}, "read-into-request": {"dfnID":"read-into-request","dfnText":"read-into request","external":false,"refSections":[{"refs":[{"id":"ref-for-read-into-request"}],"title":"4.5.2. Internal slots"},{"refs":[{"id":"ref-for-read-into-request\u2460"}],"title":"4.5.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-read-into-request\u2461"}],"title":"4.9.1. Working with readable streams"}],"url":"#read-into-request"}, "read-into-request-chunk-steps": {"dfnID":"read-into-request-chunk-steps","dfnText":"chunk steps","external":false,"refSections":[{"refs":[{"id":"ref-for-read-into-request-chunk-steps"}],"title":"4.5.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-read-into-request-chunk-steps\u2460"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-read-into-request-chunk-steps\u2461"}],"title":"4.9.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-read-into-request-chunk-steps\u2462"}],"title":"4.9.5. Byte stream controllers"}],"url":"#read-into-request-chunk-steps"}, "read-into-request-close-steps": {"dfnID":"read-into-request-close-steps","dfnText":"close steps","external":false,"refSections":[{"refs":[{"id":"ref-for-read-into-request-close-steps"}],"title":"4.5.2. Internal slots"},{"refs":[{"id":"ref-for-read-into-request-close-steps\u2460"}],"title":"4.5.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-read-into-request-close-steps\u2461"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-read-into-request-close-steps\u2462"},{"id":"ref-for-read-into-request-close-steps\u2463"}],"title":"4.9.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-read-into-request-close-steps\u2464"}],"title":"4.9.5. Byte stream controllers"}],"url":"#read-into-request-close-steps"}, "read-into-request-error-steps": {"dfnID":"read-into-request-error-steps","dfnText":"error steps","external":false,"refSections":[{"refs":[{"id":"ref-for-read-into-request-error-steps"}],"title":"4.5.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-read-into-request-error-steps\u2460"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-read-into-request-error-steps\u2461"},{"id":"ref-for-read-into-request-error-steps\u2462"}],"title":"4.9.3. Readers"},{"refs":[{"id":"ref-for-read-into-request-error-steps\u2463"},{"id":"ref-for-read-into-request-error-steps\u2464"}],"title":"4.9.5. Byte stream controllers"}],"url":"#read-into-request-error-steps"}, "read-loop": {"dfnID":"read-loop","dfnText":"read-loop","external":false,"refSections":[{"refs":[{"id":"ref-for-read-loop"},{"id":"ref-for-read-loop\u2460"}],"title":"9.1.2. Reading"}],"url":"#read-loop"}, "read-request": {"dfnID":"read-request","dfnText":"read request","external":false,"refSections":[{"refs":[{"id":"ref-for-read-request"}],"title":"4.2.5. Asynchronous iteration"},{"refs":[{"id":"ref-for-read-request\u2460"}],"title":"4.4.2. Internal slots"},{"refs":[{"id":"ref-for-read-request\u2461"}],"title":"4.4.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-read-request\u2462"},{"id":"ref-for-read-request\u2463"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-read-request\u2464"},{"id":"ref-for-read-request\u2465"}],"title":"9.1.2. Reading"}],"url":"#read-request"}, "read-request-chunk-steps": {"dfnID":"read-request-chunk-steps","dfnText":"chunk steps","external":false,"refSections":[{"refs":[{"id":"ref-for-read-request-chunk-steps"}],"title":"4.2.5. Asynchronous iteration"},{"refs":[{"id":"ref-for-read-request-chunk-steps\u2460"}],"title":"4.4.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-read-request-chunk-steps\u2461"}],"title":"4.6.4. Internal methods"},{"refs":[{"id":"ref-for-read-request-chunk-steps\u2462"},{"id":"ref-for-read-request-chunk-steps\u2463"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-read-request-chunk-steps\u2464"}],"title":"4.9.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-read-request-chunk-steps\u2465"}],"title":"4.9.5. Byte stream controllers"},{"refs":[{"id":"ref-for-read-request-chunk-steps\u2466"}],"title":"9.1.2. Reading"}],"url":"#read-request-chunk-steps"}, "read-request-close-steps": {"dfnID":"read-request-close-steps","dfnText":"close steps","external":false,"refSections":[{"refs":[{"id":"ref-for-read-request-close-steps"}],"title":"4.2.5. Asynchronous iteration"},{"refs":[{"id":"ref-for-read-request-close-steps\u2460"}],"title":"4.4.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-read-request-close-steps\u2461"},{"id":"ref-for-read-request-close-steps\u2462"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-read-request-close-steps\u2463"},{"id":"ref-for-read-request-close-steps\u2464"}],"title":"4.9.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-read-request-close-steps\u2465"}],"title":"4.9.3. Readers"},{"refs":[{"id":"ref-for-read-request-close-steps\u2466"}],"title":"9.1.2. Reading"}],"url":"#read-request-close-steps"}, "read-request-error-steps": {"dfnID":"read-request-error-steps","dfnText":"error steps","external":false,"refSections":[{"refs":[{"id":"ref-for-read-request-error-steps"}],"title":"4.2.5. Asynchronous iteration"},{"refs":[{"id":"ref-for-read-request-error-steps\u2460"}],"title":"4.4.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-read-request-error-steps\u2461"}],"title":"4.7.4. Internal methods"},{"refs":[{"id":"ref-for-read-request-error-steps\u2462"},{"id":"ref-for-read-request-error-steps\u2463"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-read-request-error-steps\u2464"},{"id":"ref-for-read-request-error-steps\u2465"}],"title":"4.9.3. Readers"},{"refs":[{"id":"ref-for-read-request-error-steps\u2466"}],"title":"9.1.2. Reading"}],"url":"#read-request-error-steps"}, "readable-byte-stream": {"dfnID":"readable-byte-stream","dfnText":"readable byte stream","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-byte-stream"}],"title":"2.6. Locking"},{"refs":[{"id":"ref-for-readable-byte-stream\u2460"}],"title":"4.1. Using readable streams"},{"refs":[{"id":"ref-for-readable-byte-stream\u2461"}],"title":"4.2.3. The underlying source API"},{"refs":[{"id":"ref-for-readable-byte-stream\u2462"},{"id":"ref-for-readable-byte-stream\u2463"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-readable-byte-stream\u2464"}],"title":"4.5.2. Internal slots"},{"refs":[{"id":"ref-for-readable-byte-stream\u2465"}],"title":"4.6. The ReadableStreamDefaultController class"},{"refs":[{"id":"ref-for-readable-byte-stream\u2466"}],"title":"4.7. The ReadableByteStreamController class"},{"refs":[{"id":"ref-for-readable-byte-stream\u2467"}],"title":"4.7.2. Internal slots"},{"refs":[{"id":"ref-for-readable-byte-stream\u2468"},{"id":"ref-for-readable-byte-stream\u2460\u24ea"},{"id":"ref-for-readable-byte-stream\u2460\u2460"}],"title":"4.8.3. Methods and properties"},{"refs":[{"id":"ref-for-readable-byte-stream\u2460\u2461"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-readable-byte-stream\u2460\u2462"}],"title":"4.9.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-readable-byte-stream\u2460\u2463"}],"title":"5.5.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-readable-byte-stream\u2460\u2464"}],"title":"7.1. The queuing strategy API"},{"refs":[{"id":"ref-for-readable-byte-stream\u2460\u2465"}],"title":"7.2. The ByteLengthQueuingStrategy class"},{"refs":[{"id":"ref-for-readable-byte-stream\u2460\u2466"}],"title":"10.3. A readable byte stream with an underlying push source (no backpressure\nsupport)"},{"refs":[{"id":"ref-for-readable-byte-stream\u2460\u2467"}],"title":"10.5. A readable byte stream with an underlying pull source"}],"url":"#readable-byte-stream"}, "readable-byte-stream-controller-call-pull-if-needed": {"dfnID":"readable-byte-stream-controller-call-pull-if-needed","dfnText":"ReadableByteStreamControllerCallPullIfNeeded(controller)","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-byte-stream-controller-call-pull-if-needed"}],"title":"4.7.4. Internal methods"},{"refs":[{"id":"ref-for-readable-byte-stream-controller-call-pull-if-needed\u2460"},{"id":"ref-for-readable-byte-stream-controller-call-pull-if-needed\u2461"},{"id":"ref-for-readable-byte-stream-controller-call-pull-if-needed\u2462"},{"id":"ref-for-readable-byte-stream-controller-call-pull-if-needed\u2463"},{"id":"ref-for-readable-byte-stream-controller-call-pull-if-needed\u2464"},{"id":"ref-for-readable-byte-stream-controller-call-pull-if-needed\u2465"}],"title":"4.9.5. Byte stream controllers"}],"url":"#readable-byte-stream-controller-call-pull-if-needed"}, "readable-byte-stream-controller-clear-algorithms": {"dfnID":"readable-byte-stream-controller-clear-algorithms","dfnText":"ReadableByteStreamControllerClearAlgorithms(controller)","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-byte-stream-controller-clear-algorithms"}],"title":"4.7.4. Internal methods"},{"refs":[{"id":"ref-for-readable-byte-stream-controller-clear-algorithms\u2460"},{"id":"ref-for-readable-byte-stream-controller-clear-algorithms\u2461"},{"id":"ref-for-readable-byte-stream-controller-clear-algorithms\u2462"}],"title":"4.9.5. Byte stream controllers"}],"url":"#readable-byte-stream-controller-clear-algorithms"}, "readable-byte-stream-controller-clear-pending-pull-intos": {"dfnID":"readable-byte-stream-controller-clear-pending-pull-intos","dfnText":"ReadableByteStreamControllerClearPendingPullIntos(controller)","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-byte-stream-controller-clear-pending-pull-intos"}],"title":"4.7.4. Internal methods"},{"refs":[{"id":"ref-for-readable-byte-stream-controller-clear-pending-pull-intos\u2460"}],"title":"4.9.5. Byte stream controllers"}],"url":"#readable-byte-stream-controller-clear-pending-pull-intos"}, "readable-byte-stream-controller-close": {"dfnID":"readable-byte-stream-controller-close","dfnText":"ReadableByteStreamControllerClose(controller)","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-byte-stream-controller-close"}],"title":"4.7.3. Methods and properties"},{"refs":[{"id":"ref-for-readable-byte-stream-controller-close\u2460"},{"id":"ref-for-readable-byte-stream-controller-close\u2461"},{"id":"ref-for-readable-byte-stream-controller-close\u2462"},{"id":"ref-for-readable-byte-stream-controller-close\u2463"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-readable-byte-stream-controller-close\u2464"}],"title":"9.1.1. Creation and manipulation"}],"url":"#readable-byte-stream-controller-close"}, "readable-byte-stream-controller-commit-pull-into-descriptor": {"dfnID":"readable-byte-stream-controller-commit-pull-into-descriptor","dfnText":"ReadableByteStreamControllerCommitPullIntoDescriptor(stream,\n pullIntoDescriptor)","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-byte-stream-controller-commit-pull-into-descriptor"},{"id":"ref-for-readable-byte-stream-controller-commit-pull-into-descriptor\u2460"},{"id":"ref-for-readable-byte-stream-controller-commit-pull-into-descriptor\u2461"},{"id":"ref-for-readable-byte-stream-controller-commit-pull-into-descriptor\u2462"},{"id":"ref-for-readable-byte-stream-controller-commit-pull-into-descriptor\u2463"}],"title":"4.9.5. Byte stream controllers"}],"url":"#readable-byte-stream-controller-commit-pull-into-descriptor"}, "readable-byte-stream-controller-convert-pull-into-descriptor": {"dfnID":"readable-byte-stream-controller-convert-pull-into-descriptor","dfnText":"ReadableByteStreamControllerConvertPullIntoDescriptor(pullIntoDescriptor)","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-byte-stream-controller-convert-pull-into-descriptor"},{"id":"ref-for-readable-byte-stream-controller-convert-pull-into-descriptor\u2460"}],"title":"4.9.5. Byte stream controllers"}],"url":"#readable-byte-stream-controller-convert-pull-into-descriptor"}, "readable-byte-stream-controller-enqueue": {"dfnID":"readable-byte-stream-controller-enqueue","dfnText":"ReadableByteStreamControllerEnqueue(controller,\n chunk)","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-byte-stream-controller-enqueue"}],"title":"4.7.3. Methods and properties"},{"refs":[{"id":"ref-for-readable-byte-stream-controller-enqueue\u2460"},{"id":"ref-for-readable-byte-stream-controller-enqueue\u2461"},{"id":"ref-for-readable-byte-stream-controller-enqueue\u2462"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-readable-byte-stream-controller-enqueue\u2463"},{"id":"ref-for-readable-byte-stream-controller-enqueue\u2464"}],"title":"9.1.1. Creation and manipulation"}],"url":"#readable-byte-stream-controller-enqueue"}, "readable-byte-stream-controller-enqueue-chunk-to-queue": {"dfnID":"readable-byte-stream-controller-enqueue-chunk-to-queue","dfnText":"ReadableByteStreamControllerEnqueueChunkToQueue(controller,\n buffer, byteOffset, byteLength)","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-byte-stream-controller-enqueue-chunk-to-queue"},{"id":"ref-for-readable-byte-stream-controller-enqueue-chunk-to-queue\u2460"},{"id":"ref-for-readable-byte-stream-controller-enqueue-chunk-to-queue\u2461"},{"id":"ref-for-readable-byte-stream-controller-enqueue-chunk-to-queue\u2462"}],"title":"4.9.5. Byte stream controllers"}],"url":"#readable-byte-stream-controller-enqueue-chunk-to-queue"}, "readable-byte-stream-controller-error": {"dfnID":"readable-byte-stream-controller-error","dfnText":"ReadableByteStreamControllerError(controller,\n e)","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-byte-stream-controller-error"}],"title":"4.7.3. Methods and properties"},{"refs":[{"id":"ref-for-readable-byte-stream-controller-error\u2460"},{"id":"ref-for-readable-byte-stream-controller-error\u2461"},{"id":"ref-for-readable-byte-stream-controller-error\u2462"},{"id":"ref-for-readable-byte-stream-controller-error\u2463"},{"id":"ref-for-readable-byte-stream-controller-error\u2464"},{"id":"ref-for-readable-byte-stream-controller-error\u2465"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-readable-byte-stream-controller-error\u2466"},{"id":"ref-for-readable-byte-stream-controller-error\u2467"},{"id":"ref-for-readable-byte-stream-controller-error\u2468"},{"id":"ref-for-readable-byte-stream-controller-error\u2460\u24ea"},{"id":"ref-for-readable-byte-stream-controller-error\u2460\u2460"},{"id":"ref-for-readable-byte-stream-controller-error\u2460\u2461"}],"title":"4.9.5. Byte stream controllers"},{"refs":[{"id":"ref-for-readable-byte-stream-controller-error\u2460\u2462"}],"title":"9.1.1. Creation and manipulation"}],"url":"#readable-byte-stream-controller-error"}, "readable-byte-stream-controller-fill-head-pull-into-descriptor": {"dfnID":"readable-byte-stream-controller-fill-head-pull-into-descriptor","dfnText":"ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller,\n size, pullIntoDescriptor)","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-byte-stream-controller-fill-head-pull-into-descriptor"},{"id":"ref-for-readable-byte-stream-controller-fill-head-pull-into-descriptor\u2460"}],"title":"4.9.5. Byte stream controllers"}],"url":"#readable-byte-stream-controller-fill-head-pull-into-descriptor"}, "readable-byte-stream-controller-fill-pull-into-descriptor-from-queue": {"dfnID":"readable-byte-stream-controller-fill-pull-into-descriptor-from-queue","dfnText":"ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller,\n pullIntoDescriptor)","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-byte-stream-controller-fill-pull-into-descriptor-from-queue"},{"id":"ref-for-readable-byte-stream-controller-fill-pull-into-descriptor-from-queue\u2460"}],"title":"4.9.5. Byte stream controllers"}],"url":"#readable-byte-stream-controller-fill-pull-into-descriptor-from-queue"}, "readable-byte-stream-controller-get-desired-size": {"dfnID":"readable-byte-stream-controller-get-desired-size","dfnText":"ReadableByteStreamControllerGetDesiredSize(controller)","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-byte-stream-controller-get-desired-size"}],"title":"4.7.3. Methods and properties"},{"refs":[{"id":"ref-for-readable-byte-stream-controller-get-desired-size\u2460"}],"title":"4.9.5. Byte stream controllers"},{"refs":[{"id":"ref-for-readable-byte-stream-controller-get-desired-size\u2461"}],"title":"9.1.1. Creation and manipulation"}],"url":"#readable-byte-stream-controller-get-desired-size"}, "readable-byte-stream-controller-handle-queue-drain": {"dfnID":"readable-byte-stream-controller-handle-queue-drain","dfnText":"ReadableByteStreamControllerHandleQueueDrain(controller)","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-byte-stream-controller-handle-queue-drain"},{"id":"ref-for-readable-byte-stream-controller-handle-queue-drain\u2460"}],"title":"4.9.5. Byte stream controllers"}],"url":"#readable-byte-stream-controller-handle-queue-drain"}, "readable-byte-stream-controller-invalidate-byob-request": {"dfnID":"readable-byte-stream-controller-invalidate-byob-request","dfnText":"ReadableByteStreamControllerInvalidateBYOBRequest(controller)","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-byte-stream-controller-invalidate-byob-request"},{"id":"ref-for-readable-byte-stream-controller-invalidate-byob-request\u2460"},{"id":"ref-for-readable-byte-stream-controller-invalidate-byob-request\u2461"}],"title":"4.9.5. Byte stream controllers"}],"url":"#readable-byte-stream-controller-invalidate-byob-request"}, "readable-byte-stream-controller-process-pull-into-descriptors-using-queue": {"dfnID":"readable-byte-stream-controller-process-pull-into-descriptors-using-queue","dfnText":"ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller)","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-byte-stream-controller-process-pull-into-descriptors-using-queue"},{"id":"ref-for-readable-byte-stream-controller-process-pull-into-descriptors-using-queue\u2460"},{"id":"ref-for-readable-byte-stream-controller-process-pull-into-descriptors-using-queue\u2461"}],"title":"4.9.5. Byte stream controllers"}],"url":"#readable-byte-stream-controller-process-pull-into-descriptors-using-queue"}, "readable-byte-stream-controller-pull-into": {"dfnID":"readable-byte-stream-controller-pull-into","dfnText":"ReadableByteStreamControllerPullInto(controller,\n view, min, readIntoRequest)","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-byte-stream-controller-pull-into"}],"title":"4.9.3. Readers"}],"url":"#readable-byte-stream-controller-pull-into"}, "readable-byte-stream-controller-respond": {"dfnID":"readable-byte-stream-controller-respond","dfnText":"ReadableByteStreamControllerRespond(controller,\n bytesWritten)","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-byte-stream-controller-respond"}],"title":"4.8.3. Methods and properties"},{"refs":[{"id":"ref-for-readable-byte-stream-controller-respond\u2460"},{"id":"ref-for-readable-byte-stream-controller-respond\u2461"},{"id":"ref-for-readable-byte-stream-controller-respond\u2462"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-readable-byte-stream-controller-respond\u2463"},{"id":"ref-for-readable-byte-stream-controller-respond\u2464"},{"id":"ref-for-readable-byte-stream-controller-respond\u2465"}],"title":"9.1.1. Creation and manipulation"}],"url":"#readable-byte-stream-controller-respond"}, "readable-byte-stream-controller-respond-in-closed-state": {"dfnID":"readable-byte-stream-controller-respond-in-closed-state","dfnText":"ReadableByteStreamControllerRespondInClosedState(controller,\n firstDescriptor)","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-byte-stream-controller-respond-in-closed-state"}],"title":"4.9.5. Byte stream controllers"}],"url":"#readable-byte-stream-controller-respond-in-closed-state"}, "readable-byte-stream-controller-respond-in-readable-state": {"dfnID":"readable-byte-stream-controller-respond-in-readable-state","dfnText":"ReadableByteStreamControllerRespondInReadableState(controller,\n bytesWritten, pullIntoDescriptor)","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-byte-stream-controller-respond-in-readable-state"}],"title":"4.9.5. Byte stream controllers"}],"url":"#readable-byte-stream-controller-respond-in-readable-state"}, "readable-byte-stream-controller-respond-internal": {"dfnID":"readable-byte-stream-controller-respond-internal","dfnText":"ReadableByteStreamControllerRespondInternal(controller,\n bytesWritten)","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-byte-stream-controller-respond-internal"},{"id":"ref-for-readable-byte-stream-controller-respond-internal\u2460"}],"title":"4.9.5. Byte stream controllers"}],"url":"#readable-byte-stream-controller-respond-internal"}, "readable-byte-stream-controller-respond-with-new-view": {"dfnID":"readable-byte-stream-controller-respond-with-new-view","dfnText":"ReadableByteStreamControllerRespondWithNewView(controller,\n view)","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-byte-stream-controller-respond-with-new-view"}],"title":"4.8.3. Methods and properties"},{"refs":[{"id":"ref-for-readable-byte-stream-controller-respond-with-new-view\u2460"},{"id":"ref-for-readable-byte-stream-controller-respond-with-new-view\u2461"},{"id":"ref-for-readable-byte-stream-controller-respond-with-new-view\u2462"}],"title":"4.9.1. Working with readable streams"}],"url":"#readable-byte-stream-controller-respond-with-new-view"}, "readable-byte-stream-controller-shift-pending-pull-into": {"dfnID":"readable-byte-stream-controller-shift-pending-pull-into","dfnText":"ReadableByteStreamControllerShiftPendingPullInto(controller)","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-byte-stream-controller-shift-pending-pull-into"},{"id":"ref-for-readable-byte-stream-controller-shift-pending-pull-into\u2460"},{"id":"ref-for-readable-byte-stream-controller-shift-pending-pull-into\u2461"},{"id":"ref-for-readable-byte-stream-controller-shift-pending-pull-into\u2462"},{"id":"ref-for-readable-byte-stream-controller-shift-pending-pull-into\u2463"},{"id":"ref-for-readable-byte-stream-controller-shift-pending-pull-into\u2464"}],"title":"4.9.5. Byte stream controllers"}],"url":"#readable-byte-stream-controller-shift-pending-pull-into"}, "readable-byte-stream-controller-should-call-pull": {"dfnID":"readable-byte-stream-controller-should-call-pull","dfnText":"ReadableByteStreamControllerShouldCallPull(controller)","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-byte-stream-controller-should-call-pull"}],"title":"4.9.5. Byte stream controllers"}],"url":"#readable-byte-stream-controller-should-call-pull"}, "readable-byte-stream-queue-entry": {"dfnID":"readable-byte-stream-queue-entry","dfnText":"readable byte stream queue entry","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-byte-stream-queue-entry"}],"title":"4.7.2. Internal slots"},{"refs":[{"id":"ref-for-readable-byte-stream-queue-entry\u2460"}],"title":"4.9.5. Byte stream controllers"}],"url":"#readable-byte-stream-queue-entry"}, "readable-byte-stream-queue-entry-buffer": {"dfnID":"readable-byte-stream-queue-entry-buffer","dfnText":"buffer","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-byte-stream-queue-entry-buffer"},{"id":"ref-for-readable-byte-stream-queue-entry-buffer\u2460"},{"id":"ref-for-readable-byte-stream-queue-entry-buffer\u2461"},{"id":"ref-for-readable-byte-stream-queue-entry-buffer\u2462"}],"title":"4.9.5. Byte stream controllers"}],"url":"#readable-byte-stream-queue-entry-buffer"}, "readable-byte-stream-queue-entry-byte-length": {"dfnID":"readable-byte-stream-queue-entry-byte-length","dfnText":"byte length","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-byte-stream-queue-entry-byte-length"},{"id":"ref-for-readable-byte-stream-queue-entry-byte-length\u2460"},{"id":"ref-for-readable-byte-stream-queue-entry-byte-length\u2461"},{"id":"ref-for-readable-byte-stream-queue-entry-byte-length\u2462"},{"id":"ref-for-readable-byte-stream-queue-entry-byte-length\u2463"},{"id":"ref-for-readable-byte-stream-queue-entry-byte-length\u2464"},{"id":"ref-for-readable-byte-stream-queue-entry-byte-length\u2465"}],"title":"4.9.5. Byte stream controllers"}],"url":"#readable-byte-stream-queue-entry-byte-length"}, "readable-byte-stream-queue-entry-byte-offset": {"dfnID":"readable-byte-stream-queue-entry-byte-offset","dfnText":"byte offset","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-byte-stream-queue-entry-byte-offset"},{"id":"ref-for-readable-byte-stream-queue-entry-byte-offset\u2460"},{"id":"ref-for-readable-byte-stream-queue-entry-byte-offset\u2461"},{"id":"ref-for-readable-byte-stream-queue-entry-byte-offset\u2462"},{"id":"ref-for-readable-byte-stream-queue-entry-byte-offset\u2463"},{"id":"ref-for-readable-byte-stream-queue-entry-byte-offset\u2464"}],"title":"4.9.5. Byte stream controllers"}],"url":"#readable-byte-stream-queue-entry-byte-offset"}, "readable-side": {"dfnID":"readable-side","dfnText":"readable\nside","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-side"}],"title":"2.3. Transform streams"},{"refs":[{"id":"ref-for-readable-side\u2460"}],"title":"6.1. Using transform streams"},{"refs":[{"id":"ref-for-readable-side\u2461"},{"id":"ref-for-readable-side\u2462"},{"id":"ref-for-readable-side\u2463"},{"id":"ref-for-readable-side\u2464"},{"id":"ref-for-readable-side\u2465"}],"title":"6.2.3. The transformer API"},{"refs":[{"id":"ref-for-readable-side\u2466"},{"id":"ref-for-readable-side\u2467"}],"title":"6.2.4. Constructor and properties"},{"refs":[{"id":"ref-for-readable-side\u2468"}],"title":"6.2.5. Transfer via postMessage()"},{"refs":[{"id":"ref-for-readable-side\u2460\u24ea"},{"id":"ref-for-readable-side\u2460\u2460"},{"id":"ref-for-readable-side\u2460\u2461"}],"title":"6.3.3. Methods and properties"},{"refs":[{"id":"ref-for-readable-side\u2460\u2462"}],"title":"6.4.4. Default sources"},{"refs":[{"id":"ref-for-readable-side\u2460\u2463"}],"title":"8.2. Transferable streams"},{"refs":[{"id":"ref-for-readable-side\u2460\u2464"}],"title":"9.5. Piping"},{"refs":[{"id":"ref-for-readable-side\u2460\u2465"},{"id":"ref-for-readable-side\u2460\u2466"}],"title":"10.11. Using an identity transform stream as a primitive to\ncreate new readable streams"}],"url":"#readable-side"}, "readable-stream": {"dfnID":"readable-stream","dfnText":"readable stream","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-stream"}],"title":"1. Introduction"},{"refs":[{"id":"ref-for-readable-stream\u2460"}],"title":"2.1. Readable streams"},{"refs":[{"id":"ref-for-readable-stream\u2461"}],"title":"2.3. Transform streams"},{"refs":[{"id":"ref-for-readable-stream\u2462"}],"title":"2.6. Locking"},{"refs":[{"id":"ref-for-readable-stream\u2463"}],"title":"4.2. The ReadableStream class"},{"refs":[{"id":"ref-for-readable-stream\u2464"},{"id":"ref-for-readable-stream\u2465"},{"id":"ref-for-readable-stream\u2466"},{"id":"ref-for-readable-stream\u2467"},{"id":"ref-for-readable-stream\u2468"},{"id":"ref-for-readable-stream\u2460\u24ea"},{"id":"ref-for-readable-stream\u2460\u2460"},{"id":"ref-for-readable-stream\u2460\u2461"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-readable-stream\u2460\u2462"}],"title":"4.4.2. Internal slots"},{"refs":[{"id":"ref-for-readable-stream\u2460\u2463"}],"title":"5.1. Using writable streams"},{"refs":[{"id":"ref-for-readable-stream\u2460\u2464"},{"id":"ref-for-readable-stream\u2460\u2465"},{"id":"ref-for-readable-stream\u2460\u2466"}],"title":"6.1. Using transform streams"},{"refs":[{"id":"ref-for-readable-stream\u2460\u2467"}],"title":"7.2. The ByteLengthQueuingStrategy class"},{"refs":[{"id":"ref-for-readable-stream\u2460\u2468"}],"title":"7.3. The CountQueuingStrategy class"},{"refs":[{"id":"ref-for-readable-stream\u2461\u24ea"}],"title":"9.4. Other stream pairs"},{"refs":[{"id":"ref-for-readable-stream\u2461\u2460"}],"title":"10.1. A readable stream with an underlying push source (no\nbackpressure support)"},{"refs":[{"id":"ref-for-readable-stream\u2461\u2461"}],"title":"10.2. A readable stream with an underlying push source and\nbackpressure support"},{"refs":[{"id":"ref-for-readable-stream\u2461\u2462"}],"title":"10.4. A readable stream with an underlying pull source"},{"refs":[{"id":"ref-for-readable-stream\u2461\u2463"}],"title":"10.11. Using an identity transform stream as a primitive to\ncreate new readable streams"}],"url":"#readable-stream"}, "readable-stream-add-read-into-request": {"dfnID":"readable-stream-add-read-into-request","dfnText":"ReadableStreamAddReadIntoRequest(stream,\n readRequest)","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-stream-add-read-into-request"},{"id":"ref-for-readable-stream-add-read-into-request\u2460"}],"title":"4.9.5. Byte stream controllers"}],"url":"#readable-stream-add-read-into-request"}, "readable-stream-add-read-request": {"dfnID":"readable-stream-add-read-request","dfnText":"ReadableStreamAddReadRequest(stream, readRequest)","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-stream-add-read-request"}],"title":"4.6.4. Internal methods"},{"refs":[{"id":"ref-for-readable-stream-add-read-request\u2460"}],"title":"4.7.4. Internal methods"}],"url":"#readable-stream-add-read-request"}, "readable-stream-byob-reader-read": {"dfnID":"readable-stream-byob-reader-read","dfnText":"ReadableStreamBYOBReaderRead(reader, view, min,\n readIntoRequest)","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-stream-byob-reader-read"}],"title":"4.5.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-readable-stream-byob-reader-read\u2460"}],"title":"4.9.1. Working with readable streams"}],"url":"#readable-stream-byob-reader-read"}, "readable-stream-cancel": {"dfnID":"readable-stream-cancel","dfnText":"ReadableStreamCancel(stream, reason)","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-stream-cancel"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-readable-stream-cancel\u2460"},{"id":"ref-for-readable-stream-cancel\u2461"},{"id":"ref-for-readable-stream-cancel\u2462"},{"id":"ref-for-readable-stream-cancel\u2463"},{"id":"ref-for-readable-stream-cancel\u2464"},{"id":"ref-for-readable-stream-cancel\u2465"},{"id":"ref-for-readable-stream-cancel\u2466"},{"id":"ref-for-readable-stream-cancel\u2467"},{"id":"ref-for-readable-stream-cancel\u2468"},{"id":"ref-for-readable-stream-cancel\u2460\u24ea"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-readable-stream-cancel\u2460\u2460"}],"title":"4.9.3. Readers"},{"refs":[{"id":"ref-for-readable-stream-cancel\u2460\u2461"}],"title":"9.1.2. Reading"}],"url":"#readable-stream-cancel"}, "readable-stream-close": {"dfnID":"readable-stream-close","dfnText":"ReadableStreamClose(stream)","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-stream-close"}],"title":"4.6.4. Internal methods"},{"refs":[{"id":"ref-for-readable-stream-close\u2460"}],"title":"4.9.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-readable-stream-close\u2461"}],"title":"4.9.4. Default controllers"},{"refs":[{"id":"ref-for-readable-stream-close\u2462"},{"id":"ref-for-readable-stream-close\u2463"}],"title":"4.9.5. Byte stream controllers"}],"url":"#readable-stream-close"}, "readable-stream-default-controller-call-pull-if-needed": {"dfnID":"readable-stream-default-controller-call-pull-if-needed","dfnText":"ReadableStreamDefaultControllerCallPullIfNeeded(controller)","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-stream-default-controller-call-pull-if-needed"},{"id":"ref-for-readable-stream-default-controller-call-pull-if-needed\u2460"}],"title":"4.6.4. Internal methods"},{"refs":[{"id":"ref-for-readable-stream-default-controller-call-pull-if-needed\u2461"},{"id":"ref-for-readable-stream-default-controller-call-pull-if-needed\u2462"},{"id":"ref-for-readable-stream-default-controller-call-pull-if-needed\u2463"}],"title":"4.9.4. Default controllers"}],"url":"#readable-stream-default-controller-call-pull-if-needed"}, "readable-stream-default-controller-can-close-or-enqueue": {"dfnID":"readable-stream-default-controller-can-close-or-enqueue","dfnText":"ReadableStreamDefaultControllerCanCloseOrEnqueue(controller)","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-stream-default-controller-can-close-or-enqueue"},{"id":"ref-for-readable-stream-default-controller-can-close-or-enqueue\u2460"}],"title":"4.6.3. Methods and properties"},{"refs":[{"id":"ref-for-readable-stream-default-controller-can-close-or-enqueue\u2461"},{"id":"ref-for-readable-stream-default-controller-can-close-or-enqueue\u2462"},{"id":"ref-for-readable-stream-default-controller-can-close-or-enqueue\u2463"}],"title":"4.9.4. Default controllers"},{"refs":[{"id":"ref-for-readable-stream-default-controller-can-close-or-enqueue\u2464"}],"title":"6.4.2. Default controllers"}],"url":"#readable-stream-default-controller-can-close-or-enqueue"}, "readable-stream-default-controller-clear-algorithms": {"dfnID":"readable-stream-default-controller-clear-algorithms","dfnText":"ReadableStreamDefaultControllerClearAlgorithms(controller)","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-stream-default-controller-clear-algorithms"},{"id":"ref-for-readable-stream-default-controller-clear-algorithms\u2460"}],"title":"4.6.4. Internal methods"},{"refs":[{"id":"ref-for-readable-stream-default-controller-clear-algorithms\u2461"},{"id":"ref-for-readable-stream-default-controller-clear-algorithms\u2462"}],"title":"4.9.4. Default controllers"}],"url":"#readable-stream-default-controller-clear-algorithms"}, "readable-stream-default-controller-close": {"dfnID":"readable-stream-default-controller-close","dfnText":"ReadableStreamDefaultControllerClose(controller)","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-stream-default-controller-close"}],"title":"4.6.3. Methods and properties"},{"refs":[{"id":"ref-for-readable-stream-default-controller-close\u2460"},{"id":"ref-for-readable-stream-default-controller-close\u2461"},{"id":"ref-for-readable-stream-default-controller-close\u2462"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-readable-stream-default-controller-close\u2463"}],"title":"6.4.2. Default controllers"},{"refs":[{"id":"ref-for-readable-stream-default-controller-close\u2464"}],"title":"6.4.3. Default sinks"},{"refs":[{"id":"ref-for-readable-stream-default-controller-close\u2465"}],"title":"8.2. Transferable streams"},{"refs":[{"id":"ref-for-readable-stream-default-controller-close\u2466"}],"title":"9.1.1. Creation and manipulation"}],"url":"#readable-stream-default-controller-close"}, "readable-stream-default-controller-enqueue": {"dfnID":"readable-stream-default-controller-enqueue","dfnText":"ReadableStreamDefaultControllerEnqueue(controller,\n chunk)","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-stream-default-controller-enqueue"}],"title":"4.6.3. Methods and properties"},{"refs":[{"id":"ref-for-readable-stream-default-controller-enqueue\u2460"},{"id":"ref-for-readable-stream-default-controller-enqueue\u2461"},{"id":"ref-for-readable-stream-default-controller-enqueue\u2462"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-readable-stream-default-controller-enqueue\u2463"}],"title":"6.4.2. Default controllers"},{"refs":[{"id":"ref-for-readable-stream-default-controller-enqueue\u2464"}],"title":"8.2. Transferable streams"},{"refs":[{"id":"ref-for-readable-stream-default-controller-enqueue\u2465"}],"title":"9.1.1. Creation and manipulation"}],"url":"#readable-stream-default-controller-enqueue"}, "readable-stream-default-controller-error": {"dfnID":"readable-stream-default-controller-error","dfnText":"ReadableStreamDefaultControllerError(controller,\n e)","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-stream-default-controller-error"}],"title":"4.6.3. Methods and properties"},{"refs":[{"id":"ref-for-readable-stream-default-controller-error\u2460"},{"id":"ref-for-readable-stream-default-controller-error\u2461"},{"id":"ref-for-readable-stream-default-controller-error\u2462"},{"id":"ref-for-readable-stream-default-controller-error\u2463"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-readable-stream-default-controller-error\u2464"},{"id":"ref-for-readable-stream-default-controller-error\u2465"},{"id":"ref-for-readable-stream-default-controller-error\u2466"},{"id":"ref-for-readable-stream-default-controller-error\u2467"}],"title":"4.9.4. Default controllers"},{"refs":[{"id":"ref-for-readable-stream-default-controller-error\u2468"}],"title":"6.4.1. Working with transform streams"},{"refs":[{"id":"ref-for-readable-stream-default-controller-error\u2460\u24ea"},{"id":"ref-for-readable-stream-default-controller-error\u2460\u2460"},{"id":"ref-for-readable-stream-default-controller-error\u2460\u2461"}],"title":"6.4.3. Default sinks"},{"refs":[{"id":"ref-for-readable-stream-default-controller-error\u2460\u2462"},{"id":"ref-for-readable-stream-default-controller-error\u2460\u2463"}],"title":"8.2. Transferable streams"},{"refs":[{"id":"ref-for-readable-stream-default-controller-error\u2460\u2464"}],"title":"9.1.1. Creation and manipulation"}],"url":"#readable-stream-default-controller-error"}, "readable-stream-default-controller-get-desired-size": {"dfnID":"readable-stream-default-controller-get-desired-size","dfnText":"ReadableStreamDefaultControllerGetDesiredSize(controller)","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-stream-default-controller-get-desired-size"}],"title":"4.6.3. Methods and properties"},{"refs":[{"id":"ref-for-readable-stream-default-controller-get-desired-size\u2460"}],"title":"4.9.4. Default controllers"},{"refs":[{"id":"ref-for-readable-stream-default-controller-get-desired-size\u2461"}],"title":"6.3.3. Methods and properties"},{"refs":[{"id":"ref-for-readable-stream-default-controller-get-desired-size\u2462"}],"title":"9.1.1. Creation and manipulation"}],"url":"#readable-stream-default-controller-get-desired-size"}, "readable-stream-default-controller-should-call-pull": {"dfnID":"readable-stream-default-controller-should-call-pull","dfnText":"ReadableStreamDefaultControllerShouldCallPull(controller)","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-stream-default-controller-should-call-pull"},{"id":"ref-for-readable-stream-default-controller-should-call-pull\u2460"}],"title":"4.9.4. Default controllers"}],"url":"#readable-stream-default-controller-should-call-pull"}, "readable-stream-default-reader-read": {"dfnID":"readable-stream-default-reader-read","dfnText":"ReadableStreamDefaultReaderRead(reader,\n readRequest)","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-stream-default-reader-read"}],"title":"4.2.5. Asynchronous iteration"},{"refs":[{"id":"ref-for-readable-stream-default-reader-read\u2460"}],"title":"4.4.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-readable-stream-default-reader-read\u2461"},{"id":"ref-for-readable-stream-default-reader-read\u2462"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-readable-stream-default-reader-read\u2463"},{"id":"ref-for-readable-stream-default-reader-read\u2464"}],"title":"9.1.2. Reading"}],"url":"#readable-stream-default-reader-read"}, "readable-stream-error": {"dfnID":"readable-stream-error","dfnText":"ReadableStreamError(stream,\n e)","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-stream-error"}],"title":"4.9.4. Default controllers"},{"refs":[{"id":"ref-for-readable-stream-error\u2460"}],"title":"4.9.5. Byte stream controllers"}],"url":"#readable-stream-error"}, "readable-stream-from-iterable": {"dfnID":"readable-stream-from-iterable","dfnText":"\n ReadableStreamFromIterable(asyncIterable)","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-stream-from-iterable"}],"title":"4.2.4. Constructor, methods, and properties"}],"url":"#readable-stream-from-iterable"}, "readable-stream-fulfill-read-into-request": {"dfnID":"readable-stream-fulfill-read-into-request","dfnText":"ReadableStreamFulfillReadIntoRequest(stream,\n chunk, done)","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-stream-fulfill-read-into-request"}],"title":"4.9.5. Byte stream controllers"}],"url":"#readable-stream-fulfill-read-into-request"}, "readable-stream-fulfill-read-request": {"dfnID":"readable-stream-fulfill-read-request","dfnText":"ReadableStreamFulfillReadRequest(stream, chunk,\n done)","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-stream-fulfill-read-request"}],"title":"4.9.4. Default controllers"},{"refs":[{"id":"ref-for-readable-stream-fulfill-read-request\u2460"},{"id":"ref-for-readable-stream-fulfill-read-request\u2461"}],"title":"4.9.5. Byte stream controllers"}],"url":"#readable-stream-fulfill-read-request"}, "readable-stream-get-num-read-into-requests": {"dfnID":"readable-stream-get-num-read-into-requests","dfnText":"ReadableStreamGetNumReadIntoRequests(stream)","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-stream-get-num-read-into-requests"},{"id":"ref-for-readable-stream-get-num-read-into-requests\u2460"}],"title":"4.9.5. Byte stream controllers"}],"url":"#readable-stream-get-num-read-into-requests"}, "readable-stream-get-num-read-requests": {"dfnID":"readable-stream-get-num-read-requests","dfnText":"ReadableStreamGetNumReadRequests(stream)","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-stream-get-num-read-requests"}],"title":"4.7.4. Internal methods"},{"refs":[{"id":"ref-for-readable-stream-get-num-read-requests\u2460"},{"id":"ref-for-readable-stream-get-num-read-requests\u2461"}],"title":"4.9.4. Default controllers"},{"refs":[{"id":"ref-for-readable-stream-get-num-read-requests\u2462"},{"id":"ref-for-readable-stream-get-num-read-requests\u2463"}],"title":"4.9.5. Byte stream controllers"}],"url":"#readable-stream-get-num-read-requests"}, "readable-stream-has-byob-reader": {"dfnID":"readable-stream-has-byob-reader","dfnText":"ReadableStreamHasBYOBReader(stream)","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-stream-has-byob-reader"},{"id":"ref-for-readable-stream-has-byob-reader\u2460"}],"title":"4.9.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-readable-stream-has-byob-reader\u2461"},{"id":"ref-for-readable-stream-has-byob-reader\u2462"},{"id":"ref-for-readable-stream-has-byob-reader\u2463"}],"title":"4.9.5. Byte stream controllers"}],"url":"#readable-stream-has-byob-reader"}, "readable-stream-has-default-reader": {"dfnID":"readable-stream-has-default-reader","dfnText":"ReadableStreamHasDefaultReader(stream)","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-stream-has-default-reader"}],"title":"4.7.4. Internal methods"},{"refs":[{"id":"ref-for-readable-stream-has-default-reader\u2460"},{"id":"ref-for-readable-stream-has-default-reader\u2461"}],"title":"4.9.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-readable-stream-has-default-reader\u2462"},{"id":"ref-for-readable-stream-has-default-reader\u2463"}],"title":"4.9.5. Byte stream controllers"}],"url":"#readable-stream-has-default-reader"}, "readable-stream-pipe-to": {"dfnID":"readable-stream-pipe-to","dfnText":"ReadableStreamPipeTo(source, dest, preventClose, preventAbort,\n preventCancel[, signal])","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-stream-pipe-to"},{"id":"ref-for-readable-stream-pipe-to\u2460"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-readable-stream-pipe-to\u2461"}],"title":"4.2.6. Transfer via postMessage()"},{"refs":[{"id":"ref-for-readable-stream-pipe-to\u2462"}],"title":"5.2.5. Transfer via postMessage()"},{"refs":[{"id":"ref-for-readable-stream-pipe-to\u2463"},{"id":"ref-for-readable-stream-pipe-to\u2464"}],"title":"9.5. Piping"}],"url":"#readable-stream-pipe-to"}, "readable-stream-reader-generic-cancel": {"dfnID":"readable-stream-reader-generic-cancel","dfnText":"ReadableStreamReaderGenericCancel(reader,\n reason)","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-stream-reader-generic-cancel"}],"title":"4.2.5. Asynchronous iteration"},{"refs":[{"id":"ref-for-readable-stream-reader-generic-cancel\u2460"}],"title":"4.3.3. Methods and properties"},{"refs":[{"id":"ref-for-readable-stream-reader-generic-cancel\u2461"}],"title":"9.1.2. Reading"}],"url":"#readable-stream-reader-generic-cancel"}, "readable-stream-reader-generic-initialize": {"dfnID":"readable-stream-reader-generic-initialize","dfnText":"ReadableStreamReaderGenericInitialize(reader,\n stream)","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-stream-reader-generic-initialize"},{"id":"ref-for-readable-stream-reader-generic-initialize\u2460"}],"title":"4.9.3. Readers"}],"url":"#readable-stream-reader-generic-initialize"}, "readable-stream-reader-generic-release": {"dfnID":"readable-stream-reader-generic-release","dfnText":"ReadableStreamReaderGenericRelease(reader)","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-stream-reader-generic-release"},{"id":"ref-for-readable-stream-reader-generic-release\u2460"}],"title":"4.9.3. Readers"}],"url":"#readable-stream-reader-generic-release"}, "readable-stream-tee": {"dfnID":"readable-stream-tee","dfnText":"ReadableStreamTee(stream,\n cloneForBranch2)","external":false,"refSections":[{"refs":[{"id":"ref-for-readable-stream-tee"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-readable-stream-tee\u2460"},{"id":"ref-for-readable-stream-tee\u2461"}],"title":"9.1.2. Reading"}],"url":"#readable-stream-tee"}, "readablebytestreamcontroller": {"dfnID":"readablebytestreamcontroller","dfnText":"ReadableByteStreamController","external":false,"refSections":[{"refs":[{"id":"ref-for-readablebytestreamcontroller"}],"title":"4.2.2. Internal slots"},{"refs":[{"id":"ref-for-readablebytestreamcontroller\u2460"},{"id":"ref-for-readablebytestreamcontroller\u2461"}],"title":"4.2.3. The underlying source API"},{"refs":[{"id":"ref-for-readablebytestreamcontroller\u2462"},{"id":"ref-for-readablebytestreamcontroller\u2463"},{"id":"ref-for-readablebytestreamcontroller\u2464"}],"title":"4.7. The ReadableByteStreamController class"},{"refs":[{"id":"ref-for-readablebytestreamcontroller\u2465"}],"title":"4.7.1. Interface definition"},{"refs":[{"id":"ref-for-readablebytestreamcontroller\u2466"},{"id":"ref-for-readablebytestreamcontroller\u2467"}],"title":"4.7.2. Internal slots"},{"refs":[{"id":"ref-for-readablebytestreamcontroller\u2468"}],"title":"4.7.4. Internal methods"},{"refs":[{"id":"ref-for-readablebytestreamcontroller\u2460\u24ea"}],"title":"4.8. The ReadableStreamBYOBRequest class"},{"refs":[{"id":"ref-for-readablebytestreamcontroller\u2460\u2460"}],"title":"4.8.2. Internal slots"},{"refs":[{"id":"ref-for-readablebytestreamcontroller\u2460\u2461"},{"id":"ref-for-readablebytestreamcontroller\u2460\u2462"},{"id":"ref-for-readablebytestreamcontroller\u2460\u2463"},{"id":"ref-for-readablebytestreamcontroller\u2460\u2464"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-readablebytestreamcontroller\u2460\u2465"}],"title":"4.9.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-readablebytestreamcontroller\u2460\u2466"}],"title":"4.9.3. Readers"},{"refs":[{"id":"ref-for-readablebytestreamcontroller\u2460\u2467"}],"title":"4.9.5. Byte stream controllers"},{"refs":[{"id":"ref-for-readablebytestreamcontroller\u2460\u2468"},{"id":"ref-for-readablebytestreamcontroller\u2461\u24ea"},{"id":"ref-for-readablebytestreamcontroller\u2461\u2460"},{"id":"ref-for-readablebytestreamcontroller\u2461\u2461"},{"id":"ref-for-readablebytestreamcontroller\u2461\u2462"},{"id":"ref-for-readablebytestreamcontroller\u2461\u2463"},{"id":"ref-for-readablebytestreamcontroller\u2461\u2464"}],"title":"9.1.1. Creation and manipulation"}],"url":"#readablebytestreamcontroller"}, "readablebytestreamcontroller-autoallocatechunksize": {"dfnID":"readablebytestreamcontroller-autoallocatechunksize","dfnText":"[[autoAllocateChunkSize]]","external":false,"refSections":[{"refs":[{"id":"ref-for-readablebytestreamcontroller-autoallocatechunksize"}],"title":"4.7.4. Internal methods"},{"refs":[{"id":"ref-for-readablebytestreamcontroller-autoallocatechunksize\u2460"}],"title":"4.9.5. Byte stream controllers"}],"url":"#readablebytestreamcontroller-autoallocatechunksize"}, "readablebytestreamcontroller-byobrequest": {"dfnID":"readablebytestreamcontroller-byobrequest","dfnText":"[[byobRequest]]","external":false,"refSections":[{"refs":[{"id":"ref-for-readablebytestreamcontroller-byobrequest"},{"id":"ref-for-readablebytestreamcontroller-byobrequest\u2460"},{"id":"ref-for-readablebytestreamcontroller-byobrequest\u2461"},{"id":"ref-for-readablebytestreamcontroller-byobrequest\u2462"},{"id":"ref-for-readablebytestreamcontroller-byobrequest\u2463"},{"id":"ref-for-readablebytestreamcontroller-byobrequest\u2464"},{"id":"ref-for-readablebytestreamcontroller-byobrequest\u2465"},{"id":"ref-for-readablebytestreamcontroller-byobrequest\u2466"},{"id":"ref-for-readablebytestreamcontroller-byobrequest\u2467"},{"id":"ref-for-readablebytestreamcontroller-byobrequest\u2468"}],"title":"4.9.5. Byte stream controllers"}],"url":"#readablebytestreamcontroller-byobrequest"}, "readablebytestreamcontroller-cancelalgorithm": {"dfnID":"readablebytestreamcontroller-cancelalgorithm","dfnText":"[[cancelAlgorithm]]","external":false,"refSections":[{"refs":[{"id":"ref-for-readablebytestreamcontroller-cancelalgorithm"}],"title":"4.7.4. Internal methods"},{"refs":[{"id":"ref-for-readablebytestreamcontroller-cancelalgorithm\u2460"},{"id":"ref-for-readablebytestreamcontroller-cancelalgorithm\u2461"}],"title":"4.9.5. Byte stream controllers"}],"url":"#readablebytestreamcontroller-cancelalgorithm"}, "readablebytestreamcontroller-closerequested": {"dfnID":"readablebytestreamcontroller-closerequested","dfnText":"[[closeRequested]]","external":false,"refSections":[{"refs":[{"id":"ref-for-readablebytestreamcontroller-closerequested"},{"id":"ref-for-readablebytestreamcontroller-closerequested\u2460"}],"title":"4.7.3. Methods and properties"},{"refs":[{"id":"ref-for-readablebytestreamcontroller-closerequested\u2461"},{"id":"ref-for-readablebytestreamcontroller-closerequested\u2462"},{"id":"ref-for-readablebytestreamcontroller-closerequested\u2463"},{"id":"ref-for-readablebytestreamcontroller-closerequested\u2464"},{"id":"ref-for-readablebytestreamcontroller-closerequested\u2465"},{"id":"ref-for-readablebytestreamcontroller-closerequested\u2466"},{"id":"ref-for-readablebytestreamcontroller-closerequested\u2467"},{"id":"ref-for-readablebytestreamcontroller-closerequested\u2468"}],"title":"4.9.5. Byte stream controllers"}],"url":"#readablebytestreamcontroller-closerequested"}, "readablebytestreamcontroller-pendingpullintos": {"dfnID":"readablebytestreamcontroller-pendingpullintos","dfnText":"[[pendingPullIntos]]","external":false,"refSections":[{"refs":[{"id":"ref-for-readablebytestreamcontroller-pendingpullintos"},{"id":"ref-for-readablebytestreamcontroller-pendingpullintos\u2460"},{"id":"ref-for-readablebytestreamcontroller-pendingpullintos\u2461"},{"id":"ref-for-readablebytestreamcontroller-pendingpullintos\u2462"}],"title":"4.7.4. Internal methods"},{"refs":[{"id":"ref-for-readablebytestreamcontroller-pendingpullintos\u2463"},{"id":"ref-for-readablebytestreamcontroller-pendingpullintos\u2464"},{"id":"ref-for-readablebytestreamcontroller-pendingpullintos\u2465"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-readablebytestreamcontroller-pendingpullintos\u2466"},{"id":"ref-for-readablebytestreamcontroller-pendingpullintos\u2467"},{"id":"ref-for-readablebytestreamcontroller-pendingpullintos\u2468"},{"id":"ref-for-readablebytestreamcontroller-pendingpullintos\u2460\u24ea"},{"id":"ref-for-readablebytestreamcontroller-pendingpullintos\u2460\u2460"},{"id":"ref-for-readablebytestreamcontroller-pendingpullintos\u2460\u2461"},{"id":"ref-for-readablebytestreamcontroller-pendingpullintos\u2460\u2462"},{"id":"ref-for-readablebytestreamcontroller-pendingpullintos\u2460\u2463"},{"id":"ref-for-readablebytestreamcontroller-pendingpullintos\u2460\u2464"},{"id":"ref-for-readablebytestreamcontroller-pendingpullintos\u2460\u2465"},{"id":"ref-for-readablebytestreamcontroller-pendingpullintos\u2460\u2466"},{"id":"ref-for-readablebytestreamcontroller-pendingpullintos\u2460\u2467"},{"id":"ref-for-readablebytestreamcontroller-pendingpullintos\u2460\u2468"},{"id":"ref-for-readablebytestreamcontroller-pendingpullintos\u2461\u24ea"},{"id":"ref-for-readablebytestreamcontroller-pendingpullintos\u2461\u2460"},{"id":"ref-for-readablebytestreamcontroller-pendingpullintos\u2461\u2461"},{"id":"ref-for-readablebytestreamcontroller-pendingpullintos\u2461\u2462"},{"id":"ref-for-readablebytestreamcontroller-pendingpullintos\u2461\u2463"},{"id":"ref-for-readablebytestreamcontroller-pendingpullintos\u2461\u2464"},{"id":"ref-for-readablebytestreamcontroller-pendingpullintos\u2461\u2465"},{"id":"ref-for-readablebytestreamcontroller-pendingpullintos\u2461\u2466"},{"id":"ref-for-readablebytestreamcontroller-pendingpullintos\u2461\u2467"},{"id":"ref-for-readablebytestreamcontroller-pendingpullintos\u2461\u2468"},{"id":"ref-for-readablebytestreamcontroller-pendingpullintos\u2462\u24ea"},{"id":"ref-for-readablebytestreamcontroller-pendingpullintos\u2462\u2460"}],"title":"4.9.5. Byte stream controllers"},{"refs":[{"id":"ref-for-readablebytestreamcontroller-pendingpullintos\u2462\u2461"}],"title":"9.1.1. Creation and manipulation"}],"url":"#readablebytestreamcontroller-pendingpullintos"}, "readablebytestreamcontroller-pullagain": {"dfnID":"readablebytestreamcontroller-pullagain","dfnText":"[[pullAgain]]","external":false,"refSections":[{"refs":[{"id":"ref-for-readablebytestreamcontroller-pullagain"},{"id":"ref-for-readablebytestreamcontroller-pullagain\u2460"},{"id":"ref-for-readablebytestreamcontroller-pullagain\u2461"},{"id":"ref-for-readablebytestreamcontroller-pullagain\u2462"},{"id":"ref-for-readablebytestreamcontroller-pullagain\u2463"},{"id":"ref-for-readablebytestreamcontroller-pullagain\u2464"}],"title":"4.9.5. Byte stream controllers"}],"url":"#readablebytestreamcontroller-pullagain"}, "readablebytestreamcontroller-pullalgorithm": {"dfnID":"readablebytestreamcontroller-pullalgorithm","dfnText":"[[pullAlgorithm]]","external":false,"refSections":[{"refs":[{"id":"ref-for-readablebytestreamcontroller-pullalgorithm"},{"id":"ref-for-readablebytestreamcontroller-pullalgorithm\u2460"},{"id":"ref-for-readablebytestreamcontroller-pullalgorithm\u2461"}],"title":"4.9.5. Byte stream controllers"}],"url":"#readablebytestreamcontroller-pullalgorithm"}, "readablebytestreamcontroller-pulling": {"dfnID":"readablebytestreamcontroller-pulling","dfnText":"[[pulling]]","external":false,"refSections":[{"refs":[{"id":"ref-for-readablebytestreamcontroller-pulling"},{"id":"ref-for-readablebytestreamcontroller-pulling\u2460"},{"id":"ref-for-readablebytestreamcontroller-pulling\u2461"},{"id":"ref-for-readablebytestreamcontroller-pulling\u2462"},{"id":"ref-for-readablebytestreamcontroller-pulling\u2463"}],"title":"4.9.5. Byte stream controllers"}],"url":"#readablebytestreamcontroller-pulling"}, "readablebytestreamcontroller-queue": {"dfnID":"readablebytestreamcontroller-queue","dfnText":"[[queue]]","external":false,"refSections":[{"refs":[{"id":"ref-for-readablebytestreamcontroller-queue"},{"id":"ref-for-readablebytestreamcontroller-queue\u2460"}],"title":"4.7.2. Internal slots"},{"refs":[{"id":"ref-for-readablebytestreamcontroller-queue\u2461"},{"id":"ref-for-readablebytestreamcontroller-queue\u2462"},{"id":"ref-for-readablebytestreamcontroller-queue\u2463"},{"id":"ref-for-readablebytestreamcontroller-queue\u2464"},{"id":"ref-for-readablebytestreamcontroller-queue\u2465"}],"title":"4.9.5. Byte stream controllers"}],"url":"#readablebytestreamcontroller-queue"}, "readablebytestreamcontroller-queuetotalsize": {"dfnID":"readablebytestreamcontroller-queuetotalsize","dfnText":"[[queueTotalSize]]","external":false,"refSections":[{"refs":[{"id":"ref-for-readablebytestreamcontroller-queuetotalsize"}],"title":"4.7.2. Internal slots"},{"refs":[{"id":"ref-for-readablebytestreamcontroller-queuetotalsize\u2460"}],"title":"4.7.4. Internal methods"},{"refs":[{"id":"ref-for-readablebytestreamcontroller-queuetotalsize\u2461"},{"id":"ref-for-readablebytestreamcontroller-queuetotalsize\u2462"},{"id":"ref-for-readablebytestreamcontroller-queuetotalsize\u2463"},{"id":"ref-for-readablebytestreamcontroller-queuetotalsize\u2464"},{"id":"ref-for-readablebytestreamcontroller-queuetotalsize\u2465"},{"id":"ref-for-readablebytestreamcontroller-queuetotalsize\u2466"},{"id":"ref-for-readablebytestreamcontroller-queuetotalsize\u2467"},{"id":"ref-for-readablebytestreamcontroller-queuetotalsize\u2468"},{"id":"ref-for-readablebytestreamcontroller-queuetotalsize\u2460\u24ea"},{"id":"ref-for-readablebytestreamcontroller-queuetotalsize\u2460\u2460"},{"id":"ref-for-readablebytestreamcontroller-queuetotalsize\u2460\u2461"},{"id":"ref-for-readablebytestreamcontroller-queuetotalsize\u2460\u2462"},{"id":"ref-for-readablebytestreamcontroller-queuetotalsize\u2460\u2463"},{"id":"ref-for-readablebytestreamcontroller-queuetotalsize\u2460\u2464"},{"id":"ref-for-readablebytestreamcontroller-queuetotalsize\u2460\u2465"}],"title":"4.9.5. Byte stream controllers"}],"url":"#readablebytestreamcontroller-queuetotalsize"}, "readablebytestreamcontroller-started": {"dfnID":"readablebytestreamcontroller-started","dfnText":"[[started]]","external":false,"refSections":[{"refs":[{"id":"ref-for-readablebytestreamcontroller-started"},{"id":"ref-for-readablebytestreamcontroller-started\u2460"},{"id":"ref-for-readablebytestreamcontroller-started\u2461"}],"title":"4.9.5. Byte stream controllers"}],"url":"#readablebytestreamcontroller-started"}, "readablebytestreamcontroller-strategyhwm": {"dfnID":"readablebytestreamcontroller-strategyhwm","dfnText":"[[strategyHWM]]","external":false,"refSections":[{"refs":[{"id":"ref-for-readablebytestreamcontroller-strategyhwm"},{"id":"ref-for-readablebytestreamcontroller-strategyhwm\u2460"}],"title":"4.9.5. Byte stream controllers"}],"url":"#readablebytestreamcontroller-strategyhwm"}, "readablebytestreamcontroller-stream": {"dfnID":"readablebytestreamcontroller-stream","dfnText":"[[stream]]","external":false,"refSections":[{"refs":[{"id":"ref-for-readablebytestreamcontroller-stream"},{"id":"ref-for-readablebytestreamcontroller-stream\u2460"}],"title":"4.7.3. Methods and properties"},{"refs":[{"id":"ref-for-readablebytestreamcontroller-stream\u2461"}],"title":"4.7.4. Internal methods"},{"refs":[{"id":"ref-for-readablebytestreamcontroller-stream\u2462"},{"id":"ref-for-readablebytestreamcontroller-stream\u2463"},{"id":"ref-for-readablebytestreamcontroller-stream\u2464"},{"id":"ref-for-readablebytestreamcontroller-stream\u2465"},{"id":"ref-for-readablebytestreamcontroller-stream\u2466"},{"id":"ref-for-readablebytestreamcontroller-stream\u2467"},{"id":"ref-for-readablebytestreamcontroller-stream\u2468"},{"id":"ref-for-readablebytestreamcontroller-stream\u2460\u24ea"},{"id":"ref-for-readablebytestreamcontroller-stream\u2460\u2460"},{"id":"ref-for-readablebytestreamcontroller-stream\u2460\u2461"},{"id":"ref-for-readablebytestreamcontroller-stream\u2460\u2462"},{"id":"ref-for-readablebytestreamcontroller-stream\u2460\u2463"},{"id":"ref-for-readablebytestreamcontroller-stream\u2460\u2464"},{"id":"ref-for-readablebytestreamcontroller-stream\u2460\u2465"},{"id":"ref-for-readablebytestreamcontroller-stream\u2460\u2466"},{"id":"ref-for-readablebytestreamcontroller-stream\u2460\u2467"},{"id":"ref-for-readablebytestreamcontroller-stream\u2460\u2468"},{"id":"ref-for-readablebytestreamcontroller-stream\u2461\u24ea"}],"title":"4.9.5. Byte stream controllers"}],"url":"#readablebytestreamcontroller-stream"}, "readablestream": {"dfnID":"readablestream","dfnText":"ReadableStream","external":false,"refSections":[{"refs":[{"id":"ref-for-readablestream"}],"title":"1. Introduction"},{"refs":[{"id":"ref-for-readablestream\u2460"}],"title":"2.1. Readable streams"},{"refs":[{"id":"ref-for-readablestream\u2461"},{"id":"ref-for-readablestream\u2462"}],"title":"4.2. The ReadableStream class"},{"refs":[{"id":"ref-for-readablestream\u2463"},{"id":"ref-for-readablestream\u2464"},{"id":"ref-for-readablestream\u2465"},{"id":"ref-for-readablestream\u2466"},{"id":"ref-for-readablestream\u2467"}],"title":"4.2.1. Interface definition"},{"refs":[{"id":"ref-for-readablestream\u2468"}],"title":"4.2.2. Internal slots"},{"refs":[{"id":"ref-for-readablestream\u2460\u24ea"},{"id":"ref-for-readablestream\u2460\u2460"},{"id":"ref-for-readablestream\u2460\u2461"}],"title":"4.2.3. The underlying source API"},{"refs":[{"id":"ref-for-readablestream\u2460\u2462"},{"id":"ref-for-readablestream\u2460\u2463"},{"id":"ref-for-readablestream\u2460\u2464"},{"id":"ref-for-readablestream\u2460\u2465"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-readablestream\u2460\u2466"},{"id":"ref-for-readablestream\u2460\u2467"},{"id":"ref-for-readablestream\u2460\u2468"}],"title":"4.2.5. Asynchronous iteration"},{"refs":[{"id":"ref-for-readablestream\u2461\u24ea"},{"id":"ref-for-readablestream\u2461\u2460"}],"title":"4.2.6. Transfer via postMessage()"},{"refs":[{"id":"ref-for-readablestream\u2461\u2461"}],"title":"4.3.2. Internal slots"},{"refs":[{"id":"ref-for-readablestream\u2461\u2462"}],"title":"4.4. The ReadableStreamDefaultReader class"},{"refs":[{"id":"ref-for-readablestream\u2461\u2463"}],"title":"4.4.1. Interface definition"},{"refs":[{"id":"ref-for-readablestream\u2461\u2464"}],"title":"4.5. The ReadableStreamBYOBReader class"},{"refs":[{"id":"ref-for-readablestream\u2461\u2465"}],"title":"4.5.1. Interface definition"},{"refs":[{"id":"ref-for-readablestream\u2461\u2466"},{"id":"ref-for-readablestream\u2461\u2467"}],"title":"4.6. The ReadableStreamDefaultController class"},{"refs":[{"id":"ref-for-readablestream\u2461\u2468"}],"title":"4.6.2. Internal slots"},{"refs":[{"id":"ref-for-readablestream\u2462\u24ea"},{"id":"ref-for-readablestream\u2462\u2460"}],"title":"4.7. The ReadableByteStreamController class"},{"refs":[{"id":"ref-for-readablestream\u2462\u2461"}],"title":"4.7.2. Internal slots"},{"refs":[{"id":"ref-for-readablestream\u2462\u2462"},{"id":"ref-for-readablestream\u2462\u2463"},{"id":"ref-for-readablestream\u2462\u2464"},{"id":"ref-for-readablestream\u2462\u2465"},{"id":"ref-for-readablestream\u2462\u2466"},{"id":"ref-for-readablestream\u2462\u2467"},{"id":"ref-for-readablestream\u2462\u2468"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-readablestream\u2463\u24ea"},{"id":"ref-for-readablestream\u2463\u2460"},{"id":"ref-for-readablestream\u2463\u2461"},{"id":"ref-for-readablestream\u2463\u2462"},{"id":"ref-for-readablestream\u2463\u2463"}],"title":"4.9.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-readablestream\u2463\u2464"}],"title":"4.9.4. Default controllers"},{"refs":[{"id":"ref-for-readablestream\u2463\u2465"}],"title":"4.9.5. Byte stream controllers"},{"refs":[{"id":"ref-for-readablestream\u2463\u2466"}],"title":"5.2.5. Transfer via postMessage()"},{"refs":[{"id":"ref-for-readablestream\u2463\u2467"}],"title":"5.5.3. Writers"},{"refs":[{"id":"ref-for-readablestream\u2463\u2468"}],"title":"6.2.1. Interface definition"},{"refs":[{"id":"ref-for-readablestream\u2464\u24ea"}],"title":"6.2.2. Internal slots"},{"refs":[{"id":"ref-for-readablestream\u2464\u2460"},{"id":"ref-for-readablestream\u2464\u2461"}],"title":"6.2.4. Constructor and properties"},{"refs":[{"id":"ref-for-readablestream\u2464\u2462"}],"title":"6.3. The TransformStreamDefaultController class"},{"refs":[{"id":"ref-for-readablestream\u2464\u2463"},{"id":"ref-for-readablestream\u2464\u2464"},{"id":"ref-for-readablestream\u2464\u2465"},{"id":"ref-for-readablestream\u2464\u2466"},{"id":"ref-for-readablestream\u2464\u2467"},{"id":"ref-for-readablestream\u2464\u2468"},{"id":"ref-for-readablestream\u2465\u24ea"},{"id":"ref-for-readablestream\u2465\u2460"},{"id":"ref-for-readablestream\u2465\u2461"},{"id":"ref-for-readablestream\u2465\u2462"},{"id":"ref-for-readablestream\u2465\u2463"},{"id":"ref-for-readablestream\u2465\u2464"},{"id":"ref-for-readablestream\u2465\u2465"},{"id":"ref-for-readablestream\u2465\u2466"},{"id":"ref-for-readablestream\u2465\u2467"}],"title":"9.1.1. Creation and manipulation"},{"refs":[{"id":"ref-for-readablestream\u2465\u2468"},{"id":"ref-for-readablestream\u2466\u24ea"},{"id":"ref-for-readablestream\u2466\u2460"},{"id":"ref-for-readablestream\u2466\u2461"},{"id":"ref-for-readablestream\u2466\u2462"}],"title":"9.1.2. Reading"},{"refs":[{"id":"ref-for-readablestream\u2466\u2463"},{"id":"ref-for-readablestream\u2466\u2464"},{"id":"ref-for-readablestream\u2466\u2465"},{"id":"ref-for-readablestream\u2466\u2466"},{"id":"ref-for-readablestream\u2466\u2467"},{"id":"ref-for-readablestream\u2466\u2468"}],"title":"9.1.3. Introspection"},{"refs":[{"id":"ref-for-readablestream\u2467\u24ea"}],"title":"9.3.2. Wrapping into a custom class"},{"refs":[{"id":"ref-for-readablestream\u2467\u2460"},{"id":"ref-for-readablestream\u2467\u2461"},{"id":"ref-for-readablestream\u2467\u2462"},{"id":"ref-for-readablestream\u2467\u2463"}],"title":"9.5. Piping"},{"refs":[{"id":"ref-for-readablestream\u2467\u2464"}],"title":"10. Examples of creating streams"},{"refs":[{"id":"ref-for-readablestream\u2467\u2465"}],"title":"10.1. A readable stream with an underlying push source (no\nbackpressure support)"},{"refs":[{"id":"ref-for-readablestream\u2467\u2466"}],"title":"10.3. A readable byte stream with an underlying push source (no backpressure\nsupport)"},{"refs":[{"id":"ref-for-readablestream\u2467\u2467"}],"title":"10.5. A readable byte stream with an underlying pull source"}],"url":"#readablestream"}, "readablestream-async-iterator-prevent-cancel": {"dfnID":"readablestream-async-iterator-prevent-cancel","dfnText":"prevent cancel","external":false,"refSections":[{"refs":[{"id":"ref-for-readablestream-async-iterator-prevent-cancel"}],"title":"4.2.5. Asynchronous iteration"}],"url":"#readablestream-async-iterator-prevent-cancel"}, "readablestream-async-iterator-reader": {"dfnID":"readablestream-async-iterator-reader","dfnText":"reader","external":false,"refSections":[{"refs":[{"id":"ref-for-readablestream-async-iterator-reader"},{"id":"ref-for-readablestream-async-iterator-reader\u2460"}],"title":"4.2.5. Asynchronous iteration"}],"url":"#readablestream-async-iterator-reader"}, "readablestream-cancel": {"dfnID":"readablestream-cancel","dfnText":"cancel","external":false,"refSections":[],"url":"#readablestream-cancel"}, "readablestream-close": {"dfnID":"readablestream-close","dfnText":"close","external":false,"refSections":[{"refs":[{"id":"ref-for-readablestream-close"},{"id":"ref-for-readablestream-close\u2460"}],"title":"9.1.1. Creation and manipulation"}],"url":"#readablestream-close"}, "readablestream-closed": {"dfnID":"readablestream-closed","dfnText":"closed","external":false,"refSections":[],"url":"#readablestream-closed"}, "readablestream-controller": {"dfnID":"readablestream-controller","dfnText":"[[controller]]","external":false,"refSections":[{"refs":[{"id":"ref-for-readablestream-controller"},{"id":"ref-for-readablestream-controller\u2460"},{"id":"ref-for-readablestream-controller\u2461"},{"id":"ref-for-readablestream-controller\u2462"},{"id":"ref-for-readablestream-controller\u2463"},{"id":"ref-for-readablestream-controller\u2464"},{"id":"ref-for-readablestream-controller\u2465"},{"id":"ref-for-readablestream-controller\u2466"},{"id":"ref-for-readablestream-controller\u2467"},{"id":"ref-for-readablestream-controller\u2468"},{"id":"ref-for-readablestream-controller\u2460\u24ea"},{"id":"ref-for-readablestream-controller\u2460\u2460"},{"id":"ref-for-readablestream-controller\u2460\u2461"},{"id":"ref-for-readablestream-controller\u2460\u2462"},{"id":"ref-for-readablestream-controller\u2460\u2463"},{"id":"ref-for-readablestream-controller\u2460\u2464"},{"id":"ref-for-readablestream-controller\u2460\u2465"},{"id":"ref-for-readablestream-controller\u2460\u2466"},{"id":"ref-for-readablestream-controller\u2460\u2467"},{"id":"ref-for-readablestream-controller\u2460\u2468"},{"id":"ref-for-readablestream-controller\u2461\u24ea"},{"id":"ref-for-readablestream-controller\u2461\u2460"},{"id":"ref-for-readablestream-controller\u2461\u2461"},{"id":"ref-for-readablestream-controller\u2461\u2462"},{"id":"ref-for-readablestream-controller\u2461\u2463"},{"id":"ref-for-readablestream-controller\u2461\u2464"},{"id":"ref-for-readablestream-controller\u2461\u2465"},{"id":"ref-for-readablestream-controller\u2461\u2466"},{"id":"ref-for-readablestream-controller\u2461\u2467"},{"id":"ref-for-readablestream-controller\u2461\u2468"},{"id":"ref-for-readablestream-controller\u2462\u24ea"},{"id":"ref-for-readablestream-controller\u2462\u2460"},{"id":"ref-for-readablestream-controller\u2462\u2461"},{"id":"ref-for-readablestream-controller\u2462\u2462"},{"id":"ref-for-readablestream-controller\u2462\u2463"},{"id":"ref-for-readablestream-controller\u2462\u2464"},{"id":"ref-for-readablestream-controller\u2462\u2465"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-readablestream-controller\u2462\u2466"}],"title":"4.9.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-readablestream-controller\u2462\u2467"},{"id":"ref-for-readablestream-controller\u2462\u2468"},{"id":"ref-for-readablestream-controller\u2463\u24ea"},{"id":"ref-for-readablestream-controller\u2463\u2460"}],"title":"4.9.3. Readers"},{"refs":[{"id":"ref-for-readablestream-controller\u2463\u2461"},{"id":"ref-for-readablestream-controller\u2463\u2462"}],"title":"4.9.4. Default controllers"},{"refs":[{"id":"ref-for-readablestream-controller\u2463\u2463"},{"id":"ref-for-readablestream-controller\u2463\u2464"}],"title":"4.9.5. Byte stream controllers"},{"refs":[{"id":"ref-for-readablestream-controller\u2463\u2465"}],"title":"6.3.3. Methods and properties"},{"refs":[{"id":"ref-for-readablestream-controller\u2463\u2466"}],"title":"6.4.1. Working with transform streams"},{"refs":[{"id":"ref-for-readablestream-controller\u2463\u2467"},{"id":"ref-for-readablestream-controller\u2463\u2468"}],"title":"6.4.2. Default controllers"},{"refs":[{"id":"ref-for-readablestream-controller\u2464\u24ea"},{"id":"ref-for-readablestream-controller\u2464\u2460"},{"id":"ref-for-readablestream-controller\u2464\u2461"},{"id":"ref-for-readablestream-controller\u2464\u2462"}],"title":"6.4.3. Default sinks"},{"refs":[{"id":"ref-for-readablestream-controller\u2464\u2463"},{"id":"ref-for-readablestream-controller\u2464\u2464"},{"id":"ref-for-readablestream-controller\u2464\u2465"},{"id":"ref-for-readablestream-controller\u2464\u2466"},{"id":"ref-for-readablestream-controller\u2464\u2467"},{"id":"ref-for-readablestream-controller\u2464\u2468"},{"id":"ref-for-readablestream-controller\u2465\u24ea"},{"id":"ref-for-readablestream-controller\u2465\u2460"},{"id":"ref-for-readablestream-controller\u2465\u2461"},{"id":"ref-for-readablestream-controller\u2465\u2462"},{"id":"ref-for-readablestream-controller\u2465\u2463"},{"id":"ref-for-readablestream-controller\u2465\u2464"},{"id":"ref-for-readablestream-controller\u2465\u2465"},{"id":"ref-for-readablestream-controller\u2465\u2466"},{"id":"ref-for-readablestream-controller\u2465\u2467"},{"id":"ref-for-readablestream-controller\u2465\u2468"},{"id":"ref-for-readablestream-controller\u2466\u24ea"},{"id":"ref-for-readablestream-controller\u2466\u2460"},{"id":"ref-for-readablestream-controller\u2466\u2461"},{"id":"ref-for-readablestream-controller\u2466\u2462"},{"id":"ref-for-readablestream-controller\u2466\u2463"}],"title":"9.1.1. Creation and manipulation"}],"url":"#readablestream-controller"}, "readablestream-create-a-proxy": {"dfnID":"readablestream-create-a-proxy","dfnText":"create a proxy","external":false,"refSections":[],"url":"#readablestream-create-a-proxy"}, "readablestream-current-byob-request-view": {"dfnID":"readablestream-current-byob-request-view","dfnText":"current BYOB request view","external":false,"refSections":[{"refs":[{"id":"ref-for-readablestream-current-byob-request-view"},{"id":"ref-for-readablestream-current-byob-request-view\u2460"},{"id":"ref-for-readablestream-current-byob-request-view\u2461"},{"id":"ref-for-readablestream-current-byob-request-view\u2462"},{"id":"ref-for-readablestream-current-byob-request-view\u2463"},{"id":"ref-for-readablestream-current-byob-request-view\u2464"},{"id":"ref-for-readablestream-current-byob-request-view\u2465"},{"id":"ref-for-readablestream-current-byob-request-view\u2466"},{"id":"ref-for-readablestream-current-byob-request-view\u2467"},{"id":"ref-for-readablestream-current-byob-request-view\u2468"},{"id":"ref-for-readablestream-current-byob-request-view\u2460\u24ea"}],"title":"9.1.1. Creation and manipulation"}],"url":"#readablestream-current-byob-request-view"}, "readablestream-desired-size-to-fill-up-to-the-high-water-mark": {"dfnID":"readablestream-desired-size-to-fill-up-to-the-high-water-mark","dfnText":"desired size to fill up to the\n high water mark","external":false,"refSections":[{"refs":[{"id":"ref-for-readablestream-desired-size-to-fill-up-to-the-high-water-mark"}],"title":"9.1.1. Creation and manipulation"}],"url":"#readablestream-desired-size-to-fill-up-to-the-high-water-mark"}, "readablestream-detached": {"dfnID":"readablestream-detached","dfnText":"[[Detached]]","external":false,"refSections":[],"url":"#readablestream-detached"}, "readablestream-disturbed": {"dfnID":"readablestream-disturbed","dfnText":"[[disturbed]]","external":false,"refSections":[{"refs":[{"id":"ref-for-readablestream-disturbed"},{"id":"ref-for-readablestream-disturbed\u2460"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-readablestream-disturbed\u2461"}],"title":"4.9.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-readablestream-disturbed\u2462"},{"id":"ref-for-readablestream-disturbed\u2463"}],"title":"4.9.3. Readers"},{"refs":[{"id":"ref-for-readablestream-disturbed\u2464"}],"title":"9.1.3. Introspection"}],"url":"#readablestream-disturbed"}, "readablestream-enqueue": {"dfnID":"readablestream-enqueue","dfnText":"enqueue","external":false,"refSections":[{"refs":[{"id":"ref-for-readablestream-enqueue"},{"id":"ref-for-readablestream-enqueue\u2460"},{"id":"ref-for-readablestream-enqueue\u2461"},{"id":"ref-for-readablestream-enqueue\u2462"}],"title":"9.1.1. Creation and manipulation"}],"url":"#readablestream-enqueue"}, "readablestream-error": {"dfnID":"readablestream-error","dfnText":"error","external":false,"refSections":[],"url":"#readablestream-error"}, "readablestream-errored": {"dfnID":"readablestream-errored","dfnText":"errored","external":false,"refSections":[],"url":"#readablestream-errored"}, "readablestream-get-a-reader": {"dfnID":"readablestream-get-a-reader","dfnText":"get a reader","external":false,"refSections":[{"refs":[{"id":"ref-for-readablestream-get-a-reader"}],"title":"9.1.3. Introspection"}],"url":"#readablestream-get-a-reader"}, "readablestream-locked": {"dfnID":"readablestream-locked","dfnText":"locked","external":false,"refSections":[{"refs":[{"id":"ref-for-readablestream-locked"}],"title":"9.1.2. Reading"},{"refs":[{"id":"ref-for-readablestream-locked\u2460"}],"title":"9.1.3. Introspection"},{"refs":[{"id":"ref-for-readablestream-locked\u2461"}],"title":"9.5. Piping"}],"url":"#readablestream-locked"}, "readablestream-need-more-data": {"dfnID":"readablestream-need-more-data","dfnText":"needs more data","external":false,"refSections":[],"url":"#readablestream-need-more-data"}, "readablestream-pipe": {"dfnID":"readablestream-pipe","dfnText":"piped to","external":false,"refSections":[{"refs":[{"id":"ref-for-readablestream-pipe"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-readablestream-pipe\u2460"}],"title":"6.1. Using transform streams"},{"refs":[{"id":"ref-for-readablestream-pipe\u2461"}],"title":"6.2.4. Constructor and properties"},{"refs":[{"id":"ref-for-readablestream-pipe\u2462"}],"title":"9.5. Piping"}],"url":"#readablestream-pipe"}, "readablestream-pipe-through": {"dfnID":"readablestream-pipe-through","dfnText":"piped through","external":false,"refSections":[{"refs":[{"id":"ref-for-readablestream-pipe-through"}],"title":"9.5. Piping"}],"url":"#readablestream-pipe-through"}, "readablestream-pipe-through-preventabort": {"dfnID":"readablestream-pipe-through-preventabort","dfnText":"preventAbort","external":false,"refSections":[],"url":"#readablestream-pipe-through-preventabort"}, "readablestream-pipe-through-preventcancel": {"dfnID":"readablestream-pipe-through-preventcancel","dfnText":"preventCancel","external":false,"refSections":[],"url":"#readablestream-pipe-through-preventcancel"}, "readablestream-pipe-through-preventclose": {"dfnID":"readablestream-pipe-through-preventclose","dfnText":"preventClose","external":false,"refSections":[],"url":"#readablestream-pipe-through-preventclose"}, "readablestream-pipe-through-signal": {"dfnID":"readablestream-pipe-through-signal","dfnText":"signal","external":false,"refSections":[],"url":"#readablestream-pipe-through-signal"}, "readablestream-pipe-to-preventabort": {"dfnID":"readablestream-pipe-to-preventabort","dfnText":"preventAbort","external":false,"refSections":[],"url":"#readablestream-pipe-to-preventabort"}, "readablestream-pipe-to-preventcancel": {"dfnID":"readablestream-pipe-to-preventcancel","dfnText":"preventCancel","external":false,"refSections":[],"url":"#readablestream-pipe-to-preventcancel"}, "readablestream-pipe-to-preventclose": {"dfnID":"readablestream-pipe-to-preventclose","dfnText":"preventClose","external":false,"refSections":[],"url":"#readablestream-pipe-to-preventclose"}, "readablestream-pipe-to-signal": {"dfnID":"readablestream-pipe-to-signal","dfnText":"signal","external":false,"refSections":[],"url":"#readablestream-pipe-to-signal"}, "readablestream-pull-from-bytes": {"dfnID":"readablestream-pull-from-bytes","dfnText":"pull from bytes","external":false,"refSections":[{"refs":[{"id":"ref-for-readablestream-pull-from-bytes"},{"id":"ref-for-readablestream-pull-from-bytes\u2460"}],"title":"9.1.1. Creation and manipulation"}],"url":"#readablestream-pull-from-bytes"}, "readablestream-readable": {"dfnID":"readablestream-readable","dfnText":"readable","external":false,"refSections":[{"refs":[{"id":"ref-for-readablestream-readable"}],"title":"9.1.1. Creation and manipulation"},{"refs":[{"id":"ref-for-readablestream-readable\u2460"}],"title":"9.1.3. Introspection"}],"url":"#readablestream-readable"}, "readablestream-reader": {"dfnID":"readablestream-reader","dfnText":"[[reader]]","external":false,"refSections":[{"refs":[{"id":"ref-for-readablestream-reader"},{"id":"ref-for-readablestream-reader\u2460"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-readablestream-reader\u2461"},{"id":"ref-for-readablestream-reader\u2462"},{"id":"ref-for-readablestream-reader\u2463"},{"id":"ref-for-readablestream-reader\u2464"},{"id":"ref-for-readablestream-reader\u2465"},{"id":"ref-for-readablestream-reader\u2466"},{"id":"ref-for-readablestream-reader\u2467"},{"id":"ref-for-readablestream-reader\u2468"},{"id":"ref-for-readablestream-reader\u2460\u24ea"},{"id":"ref-for-readablestream-reader\u2460\u2460"},{"id":"ref-for-readablestream-reader\u2460\u2461"},{"id":"ref-for-readablestream-reader\u2460\u2462"},{"id":"ref-for-readablestream-reader\u2460\u2463"}],"title":"4.9.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-readablestream-reader\u2460\u2464"},{"id":"ref-for-readablestream-reader\u2460\u2465"},{"id":"ref-for-readablestream-reader\u2460\u2466"}],"title":"4.9.3. Readers"},{"refs":[{"id":"ref-for-readablestream-reader\u2460\u2467"}],"title":"4.9.5. Byte stream controllers"}],"url":"#readablestream-reader"}, "readablestream-set-up": {"dfnID":"readablestream-set-up","dfnText":"set up","external":false,"refSections":[{"refs":[{"id":"ref-for-readablestream-set-up"},{"id":"ref-for-readablestream-set-up\u2460"},{"id":"ref-for-readablestream-set-up\u2461"}],"title":"9.1.1. Creation and manipulation"}],"url":"#readablestream-set-up"}, "readablestream-set-up-cancelalgorithm": {"dfnID":"readablestream-set-up-cancelalgorithm","dfnText":"cancelAlgorithm","external":false,"refSections":[{"refs":[{"id":"ref-for-readablestream-set-up-cancelalgorithm"}],"title":"9.4.1. Duplex streams"}],"url":"#readablestream-set-up-cancelalgorithm"}, "readablestream-set-up-highwatermark": {"dfnID":"readablestream-set-up-highwatermark","dfnText":"highWaterMark","external":false,"refSections":[],"url":"#readablestream-set-up-highwatermark"}, "readablestream-set-up-pullalgorithm": {"dfnID":"readablestream-set-up-pullalgorithm","dfnText":"pullAlgorithm","external":false,"refSections":[],"url":"#readablestream-set-up-pullalgorithm"}, "readablestream-set-up-sizealgorithm": {"dfnID":"readablestream-set-up-sizealgorithm","dfnText":"sizeAlgorithm","external":false,"refSections":[],"url":"#readablestream-set-up-sizealgorithm"}, "readablestream-set-up-with-byte-reading-support": {"dfnID":"readablestream-set-up-with-byte-reading-support","dfnText":"set up with byte reading support","external":false,"refSections":[{"refs":[{"id":"ref-for-readablestream-set-up-with-byte-reading-support"},{"id":"ref-for-readablestream-set-up-with-byte-reading-support\u2460"},{"id":"ref-for-readablestream-set-up-with-byte-reading-support\u2461"}],"title":"9.1.1. Creation and manipulation"}],"url":"#readablestream-set-up-with-byte-reading-support"}, "readablestream-set-up-with-byte-reading-support-cancelalgorithm": {"dfnID":"readablestream-set-up-with-byte-reading-support-cancelalgorithm","dfnText":"cancelAlgorithm","external":false,"refSections":[],"url":"#readablestream-set-up-with-byte-reading-support-cancelalgorithm"}, "readablestream-set-up-with-byte-reading-support-highwatermark": {"dfnID":"readablestream-set-up-with-byte-reading-support-highwatermark","dfnText":"highWaterMark","external":false,"refSections":[],"url":"#readablestream-set-up-with-byte-reading-support-highwatermark"}, "readablestream-set-up-with-byte-reading-support-pullalgorithm": {"dfnID":"readablestream-set-up-with-byte-reading-support-pullalgorithm","dfnText":"pullAlgorithm","external":false,"refSections":[],"url":"#readablestream-set-up-with-byte-reading-support-pullalgorithm"}, "readablestream-state": {"dfnID":"readablestream-state","dfnText":"[[state]]","external":false,"refSections":[{"refs":[{"id":"ref-for-readablestream-state"},{"id":"ref-for-readablestream-state\u2460"}],"title":"4.7.3. Methods and properties"},{"refs":[{"id":"ref-for-readablestream-state\u2461"},{"id":"ref-for-readablestream-state\u2462"},{"id":"ref-for-readablestream-state\u2463"},{"id":"ref-for-readablestream-state\u2464"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-readablestream-state\u2465"},{"id":"ref-for-readablestream-state\u2466"},{"id":"ref-for-readablestream-state\u2467"},{"id":"ref-for-readablestream-state\u2468"},{"id":"ref-for-readablestream-state\u2460\u24ea"},{"id":"ref-for-readablestream-state\u2460\u2460"},{"id":"ref-for-readablestream-state\u2460\u2461"},{"id":"ref-for-readablestream-state\u2460\u2462"}],"title":"4.9.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-readablestream-state\u2460\u2463"},{"id":"ref-for-readablestream-state\u2460\u2464"},{"id":"ref-for-readablestream-state\u2460\u2465"},{"id":"ref-for-readablestream-state\u2460\u2466"},{"id":"ref-for-readablestream-state\u2460\u2467"},{"id":"ref-for-readablestream-state\u2460\u2468"},{"id":"ref-for-readablestream-state\u2461\u24ea"},{"id":"ref-for-readablestream-state\u2461\u2460"}],"title":"4.9.3. Readers"},{"refs":[{"id":"ref-for-readablestream-state\u2461\u2461"},{"id":"ref-for-readablestream-state\u2461\u2462"},{"id":"ref-for-readablestream-state\u2461\u2463"}],"title":"4.9.4. Default controllers"},{"refs":[{"id":"ref-for-readablestream-state\u2461\u2464"},{"id":"ref-for-readablestream-state\u2461\u2465"},{"id":"ref-for-readablestream-state\u2461\u2466"},{"id":"ref-for-readablestream-state\u2461\u2467"},{"id":"ref-for-readablestream-state\u2461\u2468"},{"id":"ref-for-readablestream-state\u2462\u24ea"},{"id":"ref-for-readablestream-state\u2462\u2460"},{"id":"ref-for-readablestream-state\u2462\u2461"},{"id":"ref-for-readablestream-state\u2462\u2462"},{"id":"ref-for-readablestream-state\u2462\u2463"},{"id":"ref-for-readablestream-state\u2462\u2464"},{"id":"ref-for-readablestream-state\u2462\u2465"}],"title":"4.9.5. Byte stream controllers"},{"refs":[{"id":"ref-for-readablestream-state\u2462\u2466"},{"id":"ref-for-readablestream-state\u2462\u2467"}],"title":"6.4.3. Default sinks"},{"refs":[{"id":"ref-for-readablestream-state\u2462\u2468"},{"id":"ref-for-readablestream-state\u2463\u24ea"},{"id":"ref-for-readablestream-state\u2463\u2460"}],"title":"9.1.3. Introspection"}],"url":"#readablestream-state"}, "readablestream-storederror": {"dfnID":"readablestream-storederror","dfnText":"[[storedError]]","external":false,"refSections":[{"refs":[{"id":"ref-for-readablestream-storederror"},{"id":"ref-for-readablestream-storederror\u2460"},{"id":"ref-for-readablestream-storederror\u2461"},{"id":"ref-for-readablestream-storederror\u2462"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-readablestream-storederror\u2463"},{"id":"ref-for-readablestream-storederror\u2464"}],"title":"4.9.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-readablestream-storederror\u2465"},{"id":"ref-for-readablestream-storederror\u2466"},{"id":"ref-for-readablestream-storederror\u2467"}],"title":"4.9.3. Readers"},{"refs":[{"id":"ref-for-readablestream-storederror\u2468"}],"title":"6.4.2. Default controllers"},{"refs":[{"id":"ref-for-readablestream-storederror\u2460\u24ea"},{"id":"ref-for-readablestream-storederror\u2460\u2460"}],"title":"6.4.3. Default sinks"}],"url":"#readablestream-storederror"}, "readablestream-tee": {"dfnID":"readablestream-tee","dfnText":"tee","external":false,"refSections":[{"refs":[{"id":"ref-for-readablestream-tee"}],"title":"4.9.1. Working with readable streams"}],"url":"#readablestream-tee"}, "readablestreambyobreader": {"dfnID":"readablestreambyobreader","dfnText":"ReadableStreamBYOBReader","external":false,"refSections":[{"refs":[{"id":"ref-for-readablestreambyobreader"}],"title":"2.6. Locking"},{"refs":[{"id":"ref-for-readablestreambyobreader\u2460"}],"title":"4.2.1. Interface definition"},{"refs":[{"id":"ref-for-readablestreambyobreader\u2461"}],"title":"4.2.2. Internal slots"},{"refs":[{"id":"ref-for-readablestreambyobreader\u2462"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-readablestreambyobreader\u2463"}],"title":"4.3. The ReadableStreamGenericReader mixin"},{"refs":[{"id":"ref-for-readablestreambyobreader\u2464"},{"id":"ref-for-readablestreambyobreader\u2465"}],"title":"4.5. The ReadableStreamBYOBReader class"},{"refs":[{"id":"ref-for-readablestreambyobreader\u2466"},{"id":"ref-for-readablestreambyobreader\u2467"}],"title":"4.5.1. Interface definition"},{"refs":[{"id":"ref-for-readablestreambyobreader\u2468"}],"title":"4.5.2. Internal slots"},{"refs":[{"id":"ref-for-readablestreambyobreader\u2460\u24ea"},{"id":"ref-for-readablestreambyobreader\u2460\u2460"},{"id":"ref-for-readablestreambyobreader\u2460\u2461"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-readablestreambyobreader\u2460\u2462"},{"id":"ref-for-readablestreambyobreader\u2460\u2463"},{"id":"ref-for-readablestreambyobreader\u2460\u2464"},{"id":"ref-for-readablestreambyobreader\u2460\u2465"}],"title":"4.9.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-readablestreambyobreader\u2460\u2466"}],"title":"4.9.3. Readers"},{"refs":[{"id":"ref-for-readablestreambyobreader\u2460\u2467"}],"title":"9.1.2. Reading"}],"url":"#readablestreambyobreader"}, "readablestreambyobreader-readintorequests": {"dfnID":"readablestreambyobreader-readintorequests","dfnText":"[[readIntoRequests]]","external":false,"refSections":[{"refs":[{"id":"ref-for-readablestreambyobreader-readintorequests"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-readablestreambyobreader-readintorequests\u2460"},{"id":"ref-for-readablestreambyobreader-readintorequests\u2461"},{"id":"ref-for-readablestreambyobreader-readintorequests\u2462"},{"id":"ref-for-readablestreambyobreader-readintorequests\u2463"},{"id":"ref-for-readablestreambyobreader-readintorequests\u2464"},{"id":"ref-for-readablestreambyobreader-readintorequests\u2465"},{"id":"ref-for-readablestreambyobreader-readintorequests\u2466"}],"title":"4.9.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-readablestreambyobreader-readintorequests\u2467"},{"id":"ref-for-readablestreambyobreader-readintorequests\u2468"},{"id":"ref-for-readablestreambyobreader-readintorequests\u2460\u24ea"}],"title":"4.9.3. Readers"}],"url":"#readablestreambyobreader-readintorequests"}, "readablestreambyobrequest": {"dfnID":"readablestreambyobrequest","dfnText":"ReadableStreamBYOBRequest","external":false,"refSections":[{"refs":[{"id":"ref-for-readablestreambyobrequest"}],"title":"4.7.1. Interface definition"},{"refs":[{"id":"ref-for-readablestreambyobrequest\u2460"}],"title":"4.7.2. Internal slots"},{"refs":[{"id":"ref-for-readablestreambyobrequest\u2461"},{"id":"ref-for-readablestreambyobrequest\u2462"}],"title":"4.8. The ReadableStreamBYOBRequest class"},{"refs":[{"id":"ref-for-readablestreambyobrequest\u2463"}],"title":"4.8.1. Interface definition"},{"refs":[{"id":"ref-for-readablestreambyobrequest\u2464"}],"title":"4.8.2. Internal slots"},{"refs":[{"id":"ref-for-readablestreambyobrequest\u2465"}],"title":"4.9.5. Byte stream controllers"}],"url":"#readablestreambyobrequest"}, "readablestreambyobrequest-controller": {"dfnID":"readablestreambyobrequest-controller","dfnText":"[[controller]]","external":false,"refSections":[{"refs":[{"id":"ref-for-readablestreambyobrequest-controller"},{"id":"ref-for-readablestreambyobrequest-controller\u2460"},{"id":"ref-for-readablestreambyobrequest-controller\u2461"},{"id":"ref-for-readablestreambyobrequest-controller\u2462"}],"title":"4.8.3. Methods and properties"},{"refs":[{"id":"ref-for-readablestreambyobrequest-controller\u2463"},{"id":"ref-for-readablestreambyobrequest-controller\u2464"}],"title":"4.9.5. Byte stream controllers"}],"url":"#readablestreambyobrequest-controller"}, "readablestreambyobrequest-view": {"dfnID":"readablestreambyobrequest-view","dfnText":"[[view]]","external":false,"refSections":[{"refs":[{"id":"ref-for-readablestreambyobrequest-view"},{"id":"ref-for-readablestreambyobrequest-view\u2460"},{"id":"ref-for-readablestreambyobrequest-view\u2461"},{"id":"ref-for-readablestreambyobrequest-view\u2462"}],"title":"4.8.3. Methods and properties"},{"refs":[{"id":"ref-for-readablestreambyobrequest-view\u2463"},{"id":"ref-for-readablestreambyobrequest-view\u2464"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-readablestreambyobrequest-view\u2465"},{"id":"ref-for-readablestreambyobrequest-view\u2466"}],"title":"4.9.5. Byte stream controllers"},{"refs":[{"id":"ref-for-readablestreambyobrequest-view\u2467"}],"title":"9.1.1. Creation and manipulation"}],"url":"#readablestreambyobrequest-view"}, "readablestreamdefaultcontroller": {"dfnID":"readablestreamdefaultcontroller","dfnText":"ReadableStreamDefaultController","external":false,"refSections":[{"refs":[{"id":"ref-for-readablestreamdefaultcontroller"}],"title":"4.2.2. Internal slots"},{"refs":[{"id":"ref-for-readablestreamdefaultcontroller\u2460"},{"id":"ref-for-readablestreamdefaultcontroller\u2461"}],"title":"4.2.3. The underlying source API"},{"refs":[{"id":"ref-for-readablestreamdefaultcontroller\u2462"},{"id":"ref-for-readablestreamdefaultcontroller\u2463"},{"id":"ref-for-readablestreamdefaultcontroller\u2464"}],"title":"4.6. The ReadableStreamDefaultController class"},{"refs":[{"id":"ref-for-readablestreamdefaultcontroller\u2465"}],"title":"4.6.1. Interface definition"},{"refs":[{"id":"ref-for-readablestreamdefaultcontroller\u2466"}],"title":"4.6.2. Internal slots"},{"refs":[{"id":"ref-for-readablestreamdefaultcontroller\u2467"}],"title":"4.6.4. Internal methods"},{"refs":[{"id":"ref-for-readablestreamdefaultcontroller\u2468"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-readablestreamdefaultcontroller\u2460\u24ea"}],"title":"4.9.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-readablestreamdefaultcontroller\u2460\u2460"},{"id":"ref-for-readablestreamdefaultcontroller\u2460\u2461"}],"title":"4.9.4. Default controllers"},{"refs":[{"id":"ref-for-readablestreamdefaultcontroller\u2460\u2462"}],"title":"8.2. Transferable streams"},{"refs":[{"id":"ref-for-readablestreamdefaultcontroller\u2460\u2463"},{"id":"ref-for-readablestreamdefaultcontroller\u2460\u2464"}],"title":"9.1.1. Creation and manipulation"}],"url":"#readablestreamdefaultcontroller"}, "readablestreamdefaultcontroller-cancelalgorithm": {"dfnID":"readablestreamdefaultcontroller-cancelalgorithm","dfnText":"[[cancelAlgorithm]]","external":false,"refSections":[{"refs":[{"id":"ref-for-readablestreamdefaultcontroller-cancelalgorithm"}],"title":"4.6.4. Internal methods"},{"refs":[{"id":"ref-for-readablestreamdefaultcontroller-cancelalgorithm\u2460"},{"id":"ref-for-readablestreamdefaultcontroller-cancelalgorithm\u2461"}],"title":"4.9.4. Default controllers"}],"url":"#readablestreamdefaultcontroller-cancelalgorithm"}, "readablestreamdefaultcontroller-closerequested": {"dfnID":"readablestreamdefaultcontroller-closerequested","dfnText":"[[closeRequested]]","external":false,"refSections":[{"refs":[{"id":"ref-for-readablestreamdefaultcontroller-closerequested"}],"title":"4.6.4. Internal methods"},{"refs":[{"id":"ref-for-readablestreamdefaultcontroller-closerequested\u2460"},{"id":"ref-for-readablestreamdefaultcontroller-closerequested\u2461"},{"id":"ref-for-readablestreamdefaultcontroller-closerequested\u2462"},{"id":"ref-for-readablestreamdefaultcontroller-closerequested\u2463"}],"title":"4.9.4. Default controllers"}],"url":"#readablestreamdefaultcontroller-closerequested"}, "readablestreamdefaultcontroller-pullagain": {"dfnID":"readablestreamdefaultcontroller-pullagain","dfnText":"[[pullAgain]]","external":false,"refSections":[{"refs":[{"id":"ref-for-readablestreamdefaultcontroller-pullagain"},{"id":"ref-for-readablestreamdefaultcontroller-pullagain\u2460"},{"id":"ref-for-readablestreamdefaultcontroller-pullagain\u2461"},{"id":"ref-for-readablestreamdefaultcontroller-pullagain\u2462"},{"id":"ref-for-readablestreamdefaultcontroller-pullagain\u2463"},{"id":"ref-for-readablestreamdefaultcontroller-pullagain\u2464"}],"title":"4.9.4. Default controllers"}],"url":"#readablestreamdefaultcontroller-pullagain"}, "readablestreamdefaultcontroller-pullalgorithm": {"dfnID":"readablestreamdefaultcontroller-pullalgorithm","dfnText":"[[pullAlgorithm]]","external":false,"refSections":[{"refs":[{"id":"ref-for-readablestreamdefaultcontroller-pullalgorithm"},{"id":"ref-for-readablestreamdefaultcontroller-pullalgorithm\u2460"},{"id":"ref-for-readablestreamdefaultcontroller-pullalgorithm\u2461"}],"title":"4.9.4. Default controllers"}],"url":"#readablestreamdefaultcontroller-pullalgorithm"}, "readablestreamdefaultcontroller-pulling": {"dfnID":"readablestreamdefaultcontroller-pulling","dfnText":"[[pulling]]","external":false,"refSections":[{"refs":[{"id":"ref-for-readablestreamdefaultcontroller-pulling"},{"id":"ref-for-readablestreamdefaultcontroller-pulling\u2460"},{"id":"ref-for-readablestreamdefaultcontroller-pulling\u2461"},{"id":"ref-for-readablestreamdefaultcontroller-pulling\u2462"},{"id":"ref-for-readablestreamdefaultcontroller-pulling\u2463"}],"title":"4.9.4. Default controllers"}],"url":"#readablestreamdefaultcontroller-pulling"}, "readablestreamdefaultcontroller-queue": {"dfnID":"readablestreamdefaultcontroller-queue","dfnText":"[[queue]]","external":false,"refSections":[{"refs":[{"id":"ref-for-readablestreamdefaultcontroller-queue"}],"title":"4.6.2. Internal slots"},{"refs":[{"id":"ref-for-readablestreamdefaultcontroller-queue\u2460"},{"id":"ref-for-readablestreamdefaultcontroller-queue\u2461"}],"title":"4.6.4. Internal methods"},{"refs":[{"id":"ref-for-readablestreamdefaultcontroller-queue\u2462"}],"title":"4.9.4. Default controllers"}],"url":"#readablestreamdefaultcontroller-queue"}, "readablestreamdefaultcontroller-queuetotalsize": {"dfnID":"readablestreamdefaultcontroller-queuetotalsize","dfnText":"[[queueTotalSize]]","external":false,"refSections":[{"refs":[{"id":"ref-for-readablestreamdefaultcontroller-queuetotalsize"}],"title":"4.9.4. Default controllers"}],"url":"#readablestreamdefaultcontroller-queuetotalsize"}, "readablestreamdefaultcontroller-started": {"dfnID":"readablestreamdefaultcontroller-started","dfnText":"[[started]]","external":false,"refSections":[{"refs":[{"id":"ref-for-readablestreamdefaultcontroller-started"},{"id":"ref-for-readablestreamdefaultcontroller-started\u2460"},{"id":"ref-for-readablestreamdefaultcontroller-started\u2461"}],"title":"4.9.4. Default controllers"}],"url":"#readablestreamdefaultcontroller-started"}, "readablestreamdefaultcontroller-strategyhwm": {"dfnID":"readablestreamdefaultcontroller-strategyhwm","dfnText":"[[strategyHWM]]","external":false,"refSections":[{"refs":[{"id":"ref-for-readablestreamdefaultcontroller-strategyhwm"},{"id":"ref-for-readablestreamdefaultcontroller-strategyhwm\u2460"}],"title":"4.9.4. Default controllers"}],"url":"#readablestreamdefaultcontroller-strategyhwm"}, "readablestreamdefaultcontroller-strategysizealgorithm": {"dfnID":"readablestreamdefaultcontroller-strategysizealgorithm","dfnText":"[[strategySizeAlgorithm]]","external":false,"refSections":[{"refs":[{"id":"ref-for-readablestreamdefaultcontroller-strategysizealgorithm"},{"id":"ref-for-readablestreamdefaultcontroller-strategysizealgorithm\u2460"},{"id":"ref-for-readablestreamdefaultcontroller-strategysizealgorithm\u2461"}],"title":"4.9.4. Default controllers"}],"url":"#readablestreamdefaultcontroller-strategysizealgorithm"}, "readablestreamdefaultcontroller-stream": {"dfnID":"readablestreamdefaultcontroller-stream","dfnText":"[[stream]]","external":false,"refSections":[{"refs":[{"id":"ref-for-readablestreamdefaultcontroller-stream"}],"title":"4.6.4. Internal methods"},{"refs":[{"id":"ref-for-readablestreamdefaultcontroller-stream\u2460"},{"id":"ref-for-readablestreamdefaultcontroller-stream\u2461"},{"id":"ref-for-readablestreamdefaultcontroller-stream\u2462"},{"id":"ref-for-readablestreamdefaultcontroller-stream\u2463"},{"id":"ref-for-readablestreamdefaultcontroller-stream\u2464"},{"id":"ref-for-readablestreamdefaultcontroller-stream\u2465"},{"id":"ref-for-readablestreamdefaultcontroller-stream\u2466"}],"title":"4.9.4. Default controllers"}],"url":"#readablestreamdefaultcontroller-stream"}, "readablestreamdefaultreader": {"dfnID":"readablestreamdefaultreader","dfnText":"ReadableStreamDefaultReader","external":false,"refSections":[{"refs":[{"id":"ref-for-readablestreamdefaultreader"}],"title":"2.6. Locking"},{"refs":[{"id":"ref-for-readablestreamdefaultreader\u2460"}],"title":"4.2.1. Interface definition"},{"refs":[{"id":"ref-for-readablestreamdefaultreader\u2461"}],"title":"4.2.2. Internal slots"},{"refs":[{"id":"ref-for-readablestreamdefaultreader\u2462"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-readablestreamdefaultreader\u2463"}],"title":"4.3. The ReadableStreamGenericReader mixin"},{"refs":[{"id":"ref-for-readablestreamdefaultreader\u2464"},{"id":"ref-for-readablestreamdefaultreader\u2465"}],"title":"4.4. The ReadableStreamDefaultReader class"},{"refs":[{"id":"ref-for-readablestreamdefaultreader\u2466"},{"id":"ref-for-readablestreamdefaultreader\u2467"}],"title":"4.4.1. Interface definition"},{"refs":[{"id":"ref-for-readablestreamdefaultreader\u2468"}],"title":"4.4.2. Internal slots"},{"refs":[{"id":"ref-for-readablestreamdefaultreader\u2460\u24ea"},{"id":"ref-for-readablestreamdefaultreader\u2460\u2460"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-readablestreamdefaultreader\u2460\u2461"},{"id":"ref-for-readablestreamdefaultreader\u2460\u2462"},{"id":"ref-for-readablestreamdefaultreader\u2460\u2463"},{"id":"ref-for-readablestreamdefaultreader\u2460\u2464"}],"title":"4.9.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-readablestreamdefaultreader\u2460\u2465"}],"title":"4.9.3. Readers"},{"refs":[{"id":"ref-for-readablestreamdefaultreader\u2460\u2466"}],"title":"4.9.5. Byte stream controllers"},{"refs":[{"id":"ref-for-readablestreamdefaultreader\u2460\u2467"},{"id":"ref-for-readablestreamdefaultreader\u2460\u2468"},{"id":"ref-for-readablestreamdefaultreader\u2461\u24ea"},{"id":"ref-for-readablestreamdefaultreader\u2461\u2460"},{"id":"ref-for-readablestreamdefaultreader\u2461\u2461"},{"id":"ref-for-readablestreamdefaultreader\u2461\u2462"}],"title":"9.1.2. Reading"}],"url":"#readablestreamdefaultreader"}, "readablestreamdefaultreader-cancel": {"dfnID":"readablestreamdefaultreader-cancel","dfnText":"cancel","external":false,"refSections":[],"url":"#readablestreamdefaultreader-cancel"}, "readablestreamdefaultreader-read-a-chunk": {"dfnID":"readablestreamdefaultreader-read-a-chunk","dfnText":"read\na chunk","external":false,"refSections":[],"url":"#readablestreamdefaultreader-read-a-chunk"}, "readablestreamdefaultreader-read-all-bytes": {"dfnID":"readablestreamdefaultreader-read-all-bytes","dfnText":"read all\n bytes","external":false,"refSections":[],"url":"#readablestreamdefaultreader-read-all-bytes"}, "readablestreamdefaultreader-readrequests": {"dfnID":"readablestreamdefaultreader-readrequests","dfnText":"[[readRequests]]","external":false,"refSections":[{"refs":[{"id":"ref-for-readablestreamdefaultreader-readrequests"}],"title":"4.2.5. Asynchronous iteration"},{"refs":[{"id":"ref-for-readablestreamdefaultreader-readrequests\u2460"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-readablestreamdefaultreader-readrequests\u2461"},{"id":"ref-for-readablestreamdefaultreader-readrequests\u2462"},{"id":"ref-for-readablestreamdefaultreader-readrequests\u2463"},{"id":"ref-for-readablestreamdefaultreader-readrequests\u2464"},{"id":"ref-for-readablestreamdefaultreader-readrequests\u2465"},{"id":"ref-for-readablestreamdefaultreader-readrequests\u2466"},{"id":"ref-for-readablestreamdefaultreader-readrequests\u2467"}],"title":"4.9.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-readablestreamdefaultreader-readrequests\u2468"},{"id":"ref-for-readablestreamdefaultreader-readrequests\u2460\u24ea"},{"id":"ref-for-readablestreamdefaultreader-readrequests\u2460\u2460"}],"title":"4.9.3. Readers"},{"refs":[{"id":"ref-for-readablestreamdefaultreader-readrequests\u2460\u2461"},{"id":"ref-for-readablestreamdefaultreader-readrequests\u2460\u2462"},{"id":"ref-for-readablestreamdefaultreader-readrequests\u2460\u2463"}],"title":"4.9.5. Byte stream controllers"}],"url":"#readablestreamdefaultreader-readrequests"}, "readablestreamdefaultreader-release": {"dfnID":"readablestreamdefaultreader-release","dfnText":"release","external":false,"refSections":[],"url":"#readablestreamdefaultreader-release"}, "readablestreamgenericreader": {"dfnID":"readablestreamgenericreader","dfnText":"ReadableStreamGenericReader","external":false,"refSections":[{"refs":[{"id":"ref-for-readablestreamgenericreader"},{"id":"ref-for-readablestreamgenericreader\u2460"}],"title":"4.3. The ReadableStreamGenericReader mixin"},{"refs":[{"id":"ref-for-readablestreamgenericreader\u2461"}],"title":"4.3.1. Mixin definition"},{"refs":[{"id":"ref-for-readablestreamgenericreader\u2462"}],"title":"4.3.2. Internal slots"},{"refs":[{"id":"ref-for-readablestreamgenericreader\u2463"}],"title":"4.4.1. Interface definition"},{"refs":[{"id":"ref-for-readablestreamgenericreader\u2464"}],"title":"4.4.2. Internal slots"},{"refs":[{"id":"ref-for-readablestreamgenericreader\u2465"}],"title":"4.5.1. Interface definition"},{"refs":[{"id":"ref-for-readablestreamgenericreader\u2466"}],"title":"4.5.2. Internal slots"}],"url":"#readablestreamgenericreader"}, "readablestreamgenericreader-closedpromise": {"dfnID":"readablestreamgenericreader-closedpromise","dfnText":"[[closedPromise]]","external":false,"refSections":[{"refs":[{"id":"ref-for-readablestreamgenericreader-closedpromise"}],"title":"4.3.3. Methods and properties"},{"refs":[{"id":"ref-for-readablestreamgenericreader-closedpromise\u2460"},{"id":"ref-for-readablestreamgenericreader-closedpromise\u2461"},{"id":"ref-for-readablestreamgenericreader-closedpromise\u2462"},{"id":"ref-for-readablestreamgenericreader-closedpromise\u2463"},{"id":"ref-for-readablestreamgenericreader-closedpromise\u2464"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-readablestreamgenericreader-closedpromise\u2465"},{"id":"ref-for-readablestreamgenericreader-closedpromise\u2466"},{"id":"ref-for-readablestreamgenericreader-closedpromise\u2467"}],"title":"4.9.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-readablestreamgenericreader-closedpromise\u2468"},{"id":"ref-for-readablestreamgenericreader-closedpromise\u2460\u24ea"},{"id":"ref-for-readablestreamgenericreader-closedpromise\u2460\u2460"},{"id":"ref-for-readablestreamgenericreader-closedpromise\u2460\u2461"},{"id":"ref-for-readablestreamgenericreader-closedpromise\u2460\u2462"},{"id":"ref-for-readablestreamgenericreader-closedpromise\u2460\u2463"},{"id":"ref-for-readablestreamgenericreader-closedpromise\u2460\u2464"}],"title":"4.9.3. Readers"}],"url":"#readablestreamgenericreader-closedpromise"}, "readablestreamgenericreader-stream": {"dfnID":"readablestreamgenericreader-stream","dfnText":"[[stream]]","external":false,"refSections":[{"refs":[{"id":"ref-for-readablestreamgenericreader-stream"},{"id":"ref-for-readablestreamgenericreader-stream\u2460"}],"title":"4.2.5. Asynchronous iteration"},{"refs":[{"id":"ref-for-readablestreamgenericreader-stream\u2461"}],"title":"4.3.3. Methods and properties"},{"refs":[{"id":"ref-for-readablestreamgenericreader-stream\u2462"},{"id":"ref-for-readablestreamgenericreader-stream\u2463"}],"title":"4.4.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-readablestreamgenericreader-stream\u2464"},{"id":"ref-for-readablestreamgenericreader-stream\u2465"}],"title":"4.5.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-readablestreamgenericreader-stream\u2466"},{"id":"ref-for-readablestreamgenericreader-stream\u2467"},{"id":"ref-for-readablestreamgenericreader-stream\u2468"},{"id":"ref-for-readablestreamgenericreader-stream\u2460\u24ea"},{"id":"ref-for-readablestreamgenericreader-stream\u2460\u2460"},{"id":"ref-for-readablestreamgenericreader-stream\u2460\u2461"}],"title":"4.9.3. Readers"}],"url":"#readablestreamgenericreader-stream"}, "reader": {"dfnID":"reader","dfnText":"readable stream reader","external":false,"refSections":[{"refs":[{"id":"ref-for-reader"}],"title":"1. Introduction"},{"refs":[{"id":"ref-for-reader\u2460"}],"title":"2.1. Readable streams"},{"refs":[{"id":"ref-for-reader\u2461"}],"title":"4.1. Using readable streams"},{"refs":[{"id":"ref-for-reader\u2462"},{"id":"ref-for-reader\u2463"}],"title":"4.7.2. Internal slots"},{"refs":[{"id":"ref-for-reader\u2464"}],"title":"4.9.2. Interfacing with controllers"}],"url":"#reader"}, "release-a-lock": {"dfnID":"release-a-lock","dfnText":"release its lock","external":false,"refSections":[{"refs":[{"id":"ref-for-release-a-lock"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-release-a-lock\u2460"},{"id":"ref-for-release-a-lock\u2461"}],"title":"4.4.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-release-a-lock\u2462"},{"id":"ref-for-release-a-lock\u2463"}],"title":"4.5.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-release-a-lock\u2464"}],"title":"4.7.2. Internal slots"},{"refs":[{"id":"ref-for-release-a-lock\u2465"}],"title":"4.9.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-release-a-lock\u2466"}],"title":"5.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-release-a-lock\u2467"},{"id":"ref-for-release-a-lock\u2468"},{"id":"ref-for-release-a-lock\u2460\u24ea"},{"id":"ref-for-release-a-lock\u2460\u2460"}],"title":"5.3.3. Constructor, methods, and properties"}],"url":"#release-a-lock"}, "reset-queue": {"dfnID":"reset-queue","dfnText":"ResetQueue(container)","external":false,"refSections":[{"refs":[{"id":"ref-for-reset-queue"}],"title":"4.6.4. Internal methods"},{"refs":[{"id":"ref-for-reset-queue\u2460"}],"title":"4.7.4. Internal methods"},{"refs":[{"id":"ref-for-reset-queue\u2461"},{"id":"ref-for-reset-queue\u2462"}],"title":"4.9.4. Default controllers"},{"refs":[{"id":"ref-for-reset-queue\u2463"},{"id":"ref-for-reset-queue\u2464"}],"title":"4.9.5. Byte stream controllers"},{"refs":[{"id":"ref-for-reset-queue\u2465"}],"title":"5.4.4. Internal methods"},{"refs":[{"id":"ref-for-reset-queue\u2466"}],"title":"5.5.4. Default controllers"}],"url":"#reset-queue"}, "rs-byob-request-respond": {"dfnID":"rs-byob-request-respond","dfnText":"respond(bytesWritten)","external":false,"refSections":[{"refs":[{"id":"ref-for-rs-byob-request-respond"}],"title":"4.8.1. Interface definition"},{"refs":[{"id":"ref-for-rs-byob-request-respond\u2460"}],"title":"4.8.3. Methods and properties"}],"url":"#rs-byob-request-respond"}, "rs-byob-request-respond-with-new-view": {"dfnID":"rs-byob-request-respond-with-new-view","dfnText":"respondWithNewView(view)","external":false,"refSections":[{"refs":[{"id":"ref-for-rs-byob-request-respond-with-new-view"}],"title":"4.8.1. Interface definition"},{"refs":[{"id":"ref-for-rs-byob-request-respond-with-new-view\u2460"}],"title":"4.8.3. Methods and properties"}],"url":"#rs-byob-request-respond-with-new-view"}, "rs-byob-request-view": {"dfnID":"rs-byob-request-view","dfnText":"view","external":false,"refSections":[{"refs":[{"id":"ref-for-rs-byob-request-view"}],"title":"4.8.1. Interface definition"},{"refs":[{"id":"ref-for-rs-byob-request-view\u2460"},{"id":"ref-for-rs-byob-request-view\u2461"},{"id":"ref-for-rs-byob-request-view\u2462"},{"id":"ref-for-rs-byob-request-view\u2463"},{"id":"ref-for-rs-byob-request-view\u2464"},{"id":"ref-for-rs-byob-request-view\u2465"},{"id":"ref-for-rs-byob-request-view\u2466"},{"id":"ref-for-rs-byob-request-view\u2467"}],"title":"4.8.3. Methods and properties"}],"url":"#rs-byob-request-view"}, "rs-cancel": {"dfnID":"rs-cancel","dfnText":"cancel(reason)","external":false,"refSections":[{"refs":[{"id":"ref-for-rs-cancel"}],"title":"2.1. Readable streams"},{"refs":[{"id":"ref-for-rs-cancel\u2460"}],"title":"4.2.1. Interface definition"},{"refs":[{"id":"ref-for-rs-cancel\u2461"}],"title":"4.2.3. The underlying source API"},{"refs":[{"id":"ref-for-rs-cancel\u2462"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-rs-cancel\u2463"}],"title":"4.4.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-rs-cancel\u2464"}],"title":"4.5.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-rs-cancel\u2465"}],"title":"4.9.4. Default controllers"},{"refs":[{"id":"ref-for-rs-cancel\u2466"}],"title":"6.2.3. The transformer API"}],"url":"#rs-cancel"}, "rs-constructor": {"dfnID":"rs-constructor","dfnText":"new ReadableStream(underlyingSource, strategy)","external":false,"refSections":[{"refs":[{"id":"ref-for-rs-constructor"}],"title":"2.1. Readable streams"},{"refs":[{"id":"ref-for-rs-constructor\u2460"}],"title":"4.2.1. Interface definition"},{"refs":[{"id":"ref-for-rs-constructor\u2461"},{"id":"ref-for-rs-constructor\u2462"},{"id":"ref-for-rs-constructor\u2463"}],"title":"4.2.3. The underlying source API"},{"refs":[{"id":"ref-for-rs-constructor\u2464"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-rs-constructor\u2465"}],"title":"7.1. The queuing strategy API"}],"url":"#rs-constructor"}, "rs-default-controller-close": {"dfnID":"rs-default-controller-close","dfnText":"close()","external":false,"refSections":[{"refs":[{"id":"ref-for-rs-default-controller-close"}],"title":"4.6.1. Interface definition"},{"refs":[{"id":"ref-for-rs-default-controller-close\u2460"}],"title":"4.6.3. Methods and properties"},{"refs":[{"id":"ref-for-rs-default-controller-close\u2461"}],"title":"4.9.4. Default controllers"}],"url":"#rs-default-controller-close"}, "rs-default-controller-desired-size": {"dfnID":"rs-default-controller-desired-size","dfnText":"desiredSize","external":false,"refSections":[{"refs":[{"id":"ref-for-rs-default-controller-desired-size"}],"title":"2.4. Pipe chains and backpressure"},{"refs":[{"id":"ref-for-rs-default-controller-desired-size\u2460"}],"title":"4.6.1. Interface definition"},{"refs":[{"id":"ref-for-rs-default-controller-desired-size\u2461"}],"title":"4.6.3. Methods and properties"},{"refs":[{"id":"ref-for-rs-default-controller-desired-size\u2462"}],"title":"7.1. The queuing strategy API"}],"url":"#rs-default-controller-desired-size"}, "rs-default-controller-enqueue": {"dfnID":"rs-default-controller-enqueue","dfnText":"enqueue(chunk)","external":false,"refSections":[{"refs":[{"id":"ref-for-rs-default-controller-enqueue"}],"title":"4.6.1. Interface definition"},{"refs":[{"id":"ref-for-rs-default-controller-enqueue\u2460"}],"title":"4.6.3. Methods and properties"}],"url":"#rs-default-controller-enqueue"}, "rs-default-controller-error": {"dfnID":"rs-default-controller-error","dfnText":"error(e)","external":false,"refSections":[{"refs":[{"id":"ref-for-rs-default-controller-error"}],"title":"4.6.1. Interface definition"},{"refs":[{"id":"ref-for-rs-default-controller-error\u2460"}],"title":"4.6.3. Methods and properties"},{"refs":[{"id":"ref-for-rs-default-controller-error\u2461"}],"title":"4.9.4. Default controllers"}],"url":"#rs-default-controller-error"}, "rs-default-controller-has-backpressure": {"dfnID":"rs-default-controller-has-backpressure","dfnText":"ReadableStreamDefaultControllerHasBackpressure(controller)","external":false,"refSections":[{"refs":[{"id":"ref-for-rs-default-controller-has-backpressure"}],"title":"6.4.2. Default controllers"}],"url":"#rs-default-controller-has-backpressure"}, "rs-default-controller-private-cancel": {"dfnID":"rs-default-controller-private-cancel","dfnText":"[[CancelSteps]](reason)","external":false,"refSections":[],"url":"#rs-default-controller-private-cancel"}, "rs-default-controller-private-pull": {"dfnID":"rs-default-controller-private-pull","dfnText":"[[PullSteps]](readRequest)","external":false,"refSections":[],"url":"#rs-default-controller-private-pull"}, "rs-from": {"dfnID":"rs-from","dfnText":"from(asyncIterable)","external":false,"refSections":[{"refs":[{"id":"ref-for-rs-from"}],"title":"4.2.1. Interface definition"},{"refs":[{"id":"ref-for-rs-from\u2460"}],"title":"4.2.4. Constructor, methods, and properties"}],"url":"#rs-from"}, "rs-get-reader": {"dfnID":"rs-get-reader","dfnText":"getReader(options)","external":false,"refSections":[{"refs":[{"id":"ref-for-rs-get-reader"},{"id":"ref-for-rs-get-reader\u2460"}],"title":"2.1. Readable streams"},{"refs":[{"id":"ref-for-rs-get-reader\u2461"}],"title":"2.6. Locking"},{"refs":[{"id":"ref-for-rs-get-reader\u2462"}],"title":"4.2.1. Interface definition"},{"refs":[{"id":"ref-for-rs-get-reader\u2463"}],"title":"4.2.3. The underlying source API"},{"refs":[{"id":"ref-for-rs-get-reader\u2464"},{"id":"ref-for-rs-get-reader\u2465"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-rs-get-reader\u2466"}],"title":"4.4.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-rs-get-reader\u2467"}],"title":"4.5.3. Constructor, methods, and properties"}],"url":"#rs-get-reader"}, "rs-locked": {"dfnID":"rs-locked","dfnText":"locked","external":false,"refSections":[{"refs":[{"id":"ref-for-rs-locked"}],"title":"2.6. Locking"},{"refs":[{"id":"ref-for-rs-locked\u2460"}],"title":"4.2.1. Interface definition"},{"refs":[{"id":"ref-for-rs-locked\u2461"}],"title":"4.2.4. Constructor, methods, and properties"}],"url":"#rs-locked"}, "rs-pipe-through": {"dfnID":"rs-pipe-through","dfnText":"pipeThrough(transform, options)","external":false,"refSections":[{"refs":[{"id":"ref-for-rs-pipe-through"}],"title":"2.4. Pipe chains and backpressure"},{"refs":[{"id":"ref-for-rs-pipe-through\u2460"}],"title":"4.2.1. Interface definition"},{"refs":[{"id":"ref-for-rs-pipe-through\u2461"},{"id":"ref-for-rs-pipe-through\u2462"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-rs-pipe-through\u2463"}],"title":"9.4.1. Duplex streams"},{"refs":[{"id":"ref-for-rs-pipe-through\u2464"}],"title":"9.4.2. Endpoint pairs"}],"url":"#rs-pipe-through"}, "rs-pipe-to": {"dfnID":"rs-pipe-to","dfnText":"pipeTo(destination, options)","external":false,"refSections":[{"refs":[{"id":"ref-for-rs-pipe-to"},{"id":"ref-for-rs-pipe-to\u2460"}],"title":"2.4. Pipe chains and backpressure"},{"refs":[{"id":"ref-for-rs-pipe-to\u2461"}],"title":"4.2.1. Interface definition"},{"refs":[{"id":"ref-for-rs-pipe-to\u2462"}],"title":"4.2.3. The underlying source API"},{"refs":[{"id":"ref-for-rs-pipe-to\u2463"},{"id":"ref-for-rs-pipe-to\u2464"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-rs-pipe-to\u2465"}],"title":"5.2.3. The underlying sink API"},{"refs":[{"id":"ref-for-rs-pipe-to\u2466"}],"title":"5.5.3. Writers"},{"refs":[{"id":"ref-for-rs-pipe-to\u2467"},{"id":"ref-for-rs-pipe-to\u2468"}],"title":"10.11. Using an identity transform stream as a primitive to\ncreate new readable streams"}],"url":"#rs-pipe-to"}, "rs-pipeTo-finalize": {"dfnID":"rs-pipeTo-finalize","dfnText":"Finalize","external":false,"refSections":[{"refs":[{"id":"ref-for-rs-pipeTo-finalize"},{"id":"ref-for-rs-pipeTo-finalize\u2460"},{"id":"ref-for-rs-pipeTo-finalize\u2461"}],"title":"4.9.1. Working with readable streams"}],"url":"#rs-pipeTo-finalize"}, "rs-pipeTo-shutdown": {"dfnID":"rs-pipeTo-shutdown","dfnText":"Shutdown","external":false,"refSections":[{"refs":[{"id":"ref-for-rs-pipeTo-shutdown"},{"id":"ref-for-rs-pipeTo-shutdown\u2460"},{"id":"ref-for-rs-pipeTo-shutdown\u2461"},{"id":"ref-for-rs-pipeTo-shutdown\u2462"}],"title":"4.9.1. Working with readable streams"}],"url":"#rs-pipeTo-shutdown"}, "rs-pipeTo-shutdown-with-action": {"dfnID":"rs-pipeTo-shutdown-with-action","dfnText":"Shutdown with an action","external":false,"refSections":[{"refs":[{"id":"ref-for-rs-pipeTo-shutdown-with-action"},{"id":"ref-for-rs-pipeTo-shutdown-with-action\u2460"},{"id":"ref-for-rs-pipeTo-shutdown-with-action\u2461"},{"id":"ref-for-rs-pipeTo-shutdown-with-action\u2462"},{"id":"ref-for-rs-pipeTo-shutdown-with-action\u2463"}],"title":"4.9.1. Working with readable streams"}],"url":"#rs-pipeTo-shutdown-with-action"}, "rs-tee": {"dfnID":"rs-tee","dfnText":"tee()","external":false,"refSections":[{"refs":[{"id":"ref-for-rs-tee"}],"title":"2.1. Readable streams"},{"refs":[{"id":"ref-for-rs-tee\u2460"}],"title":"4.2.1. Interface definition"},{"refs":[{"id":"ref-for-rs-tee\u2461"}],"title":"4.2.4. Constructor, methods, and properties"}],"url":"#rs-tee"}, "set-up-readable-byte-stream-controller": {"dfnID":"set-up-readable-byte-stream-controller","dfnText":"SetUpReadableByteStreamController(stream,\n controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark,\n autoAllocateChunkSize)","external":false,"refSections":[{"refs":[{"id":"ref-for-set-up-readable-byte-stream-controller"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-set-up-readable-byte-stream-controller\u2460"}],"title":"4.9.5. Byte stream controllers"},{"refs":[{"id":"ref-for-set-up-readable-byte-stream-controller\u2461"}],"title":"9.1.1. Creation and manipulation"}],"url":"#set-up-readable-byte-stream-controller"}, "set-up-readable-byte-stream-controller-from-underlying-source": {"dfnID":"set-up-readable-byte-stream-controller-from-underlying-source","dfnText":"SetUpReadableByteStreamControllerFromUnderlyingSource(stream,\n underlyingSource, underlyingSourceDict, highWaterMark)","external":false,"refSections":[{"refs":[{"id":"ref-for-set-up-readable-byte-stream-controller-from-underlying-source"}],"title":"4.2.4. Constructor, methods, and properties"}],"url":"#set-up-readable-byte-stream-controller-from-underlying-source"}, "set-up-readable-stream-byob-reader": {"dfnID":"set-up-readable-stream-byob-reader","dfnText":"SetUpReadableStreamBYOBReader(reader, stream)","external":false,"refSections":[{"refs":[{"id":"ref-for-set-up-readable-stream-byob-reader"}],"title":"4.5.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-set-up-readable-stream-byob-reader\u2460"}],"title":"4.9.1. Working with readable streams"}],"url":"#set-up-readable-stream-byob-reader"}, "set-up-readable-stream-default-controller": {"dfnID":"set-up-readable-stream-default-controller","dfnText":"SetUpReadableStreamDefaultController(stream,\n controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark,\n sizeAlgorithm)","external":false,"refSections":[{"refs":[{"id":"ref-for-set-up-readable-stream-default-controller"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-set-up-readable-stream-default-controller\u2460"}],"title":"4.9.4. Default controllers"},{"refs":[{"id":"ref-for-set-up-readable-stream-default-controller\u2461"}],"title":"8.2. Transferable streams"},{"refs":[{"id":"ref-for-set-up-readable-stream-default-controller\u2462"}],"title":"9.1.1. Creation and manipulation"}],"url":"#set-up-readable-stream-default-controller"}, "set-up-readable-stream-default-controller-from-underlying-source": {"dfnID":"set-up-readable-stream-default-controller-from-underlying-source","dfnText":"SetUpReadableStreamDefaultControllerFromUnderlyingSource(stream,\n underlyingSource, underlyingSourceDict, highWaterMark, sizeAlgorithm)","external":false,"refSections":[{"refs":[{"id":"ref-for-set-up-readable-stream-default-controller-from-underlying-source"}],"title":"4.2.4. Constructor, methods, and properties"}],"url":"#set-up-readable-stream-default-controller-from-underlying-source"}, "set-up-readable-stream-default-reader": {"dfnID":"set-up-readable-stream-default-reader","dfnText":"SetUpReadableStreamDefaultReader(reader,\n stream)","external":false,"refSections":[{"refs":[{"id":"ref-for-set-up-readable-stream-default-reader"}],"title":"4.4.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-set-up-readable-stream-default-reader\u2460"}],"title":"4.9.1. Working with readable streams"}],"url":"#set-up-readable-stream-default-reader"}, "set-up-transform-stream-default-controller": {"dfnID":"set-up-transform-stream-default-controller","dfnText":"SetUpTransformStreamDefaultController(stream,\n controller, transformAlgorithm, flushAlgorithm, cancelAlgorithm)","external":false,"refSections":[{"refs":[{"id":"ref-for-set-up-transform-stream-default-controller"}],"title":"6.4.2. Default controllers"},{"refs":[{"id":"ref-for-set-up-transform-stream-default-controller\u2460"}],"title":"9.3.1. Creation and manipulation"}],"url":"#set-up-transform-stream-default-controller"}, "set-up-transform-stream-default-controller-from-transformer": {"dfnID":"set-up-transform-stream-default-controller-from-transformer","dfnText":"SetUpTransformStreamDefaultControllerFromTransformer(stream,\n transformer, transformerDict)","external":false,"refSections":[{"refs":[{"id":"ref-for-set-up-transform-stream-default-controller-from-transformer"}],"title":"6.2.4. Constructor and properties"}],"url":"#set-up-transform-stream-default-controller-from-transformer"}, "set-up-writable-stream-default-controller": {"dfnID":"set-up-writable-stream-default-controller","dfnText":"SetUpWritableStreamDefaultController(stream,\n controller, startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm,\n highWaterMark, sizeAlgorithm)","external":false,"refSections":[{"refs":[{"id":"ref-for-set-up-writable-stream-default-controller"}],"title":"5.5.1. Working with writable streams"},{"refs":[{"id":"ref-for-set-up-writable-stream-default-controller\u2460"}],"title":"5.5.4. Default controllers"},{"refs":[{"id":"ref-for-set-up-writable-stream-default-controller\u2461"}],"title":"8.2. Transferable streams"},{"refs":[{"id":"ref-for-set-up-writable-stream-default-controller\u2462"}],"title":"9.2.1. Creation and manipulation"}],"url":"#set-up-writable-stream-default-controller"}, "set-up-writable-stream-default-controller-from-underlying-sink": {"dfnID":"set-up-writable-stream-default-controller-from-underlying-sink","dfnText":"SetUpWritableStreamDefaultControllerFromUnderlyingSink(stream,\n underlyingSink, underlyingSinkDict, highWaterMark, sizeAlgorithm)","external":false,"refSections":[{"refs":[{"id":"ref-for-set-up-writable-stream-default-controller-from-underlying-sink"}],"title":"5.2.4. Constructor, methods, and properties"}],"url":"#set-up-writable-stream-default-controller-from-underlying-sink"}, "set-up-writable-stream-default-writer": {"dfnID":"set-up-writable-stream-default-writer","dfnText":"SetUpWritableStreamDefaultWriter(writer,\n stream)","external":false,"refSections":[{"refs":[{"id":"ref-for-set-up-writable-stream-default-writer"}],"title":"5.3.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-set-up-writable-stream-default-writer\u2460"}],"title":"5.5.1. Working with writable streams"}],"url":"#set-up-writable-stream-default-writer"}, "tee-a-readable-stream": {"dfnID":"tee-a-readable-stream","dfnText":"tee","external":false,"refSections":[{"refs":[{"id":"ref-for-tee-a-readable-stream"}],"title":"2.4. Pipe chains and backpressure"},{"refs":[{"id":"ref-for-tee-a-readable-stream\u2460"}],"title":"4.1. Using readable streams"},{"refs":[{"id":"ref-for-tee-a-readable-stream\u2461"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-tee-a-readable-stream\u2462"}],"title":"4.9.1. Working with readable streams"}],"url":"#tee-a-readable-stream"}, "transfer-array-buffer": {"dfnID":"transfer-array-buffer","dfnText":"TransferArrayBuffer(O)","external":false,"refSections":[{"refs":[{"id":"ref-for-transfer-array-buffer"}],"title":"4.1. Using readable streams"},{"refs":[{"id":"ref-for-transfer-array-buffer"}],"title":"4.7.2. Internal slots"},{"refs":[{"id":"ref-for-transfer-array-buffer"},{"id":"ref-for-transfer-array-buffer"},{"id":"ref-for-transfer-array-buffer"}],"title":"4.8.3. Methods and properties"},{"refs":[{"id":"ref-for-transfer-array-buffer"},{"id":"ref-for-transfer-array-buffer\u2460"},{"id":"ref-for-transfer-array-buffer\u2461"},{"id":"ref-for-transfer-array-buffer\u2462"},{"id":"ref-for-transfer-array-buffer\u2463"},{"id":"ref-for-transfer-array-buffer\u2464"}],"title":"4.9.5. Byte stream controllers"}],"url":"#transfer-array-buffer"}, "transform-stream": {"dfnID":"transform-stream","dfnText":"transform stream","external":false,"refSections":[{"refs":[{"id":"ref-for-transform-stream"}],"title":"1. Introduction"},{"refs":[{"id":"ref-for-transform-stream\u2460"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-transform-stream\u2461"}],"title":"6.2. The TransformStream class"},{"refs":[{"id":"ref-for-transform-stream\u2462"}],"title":"6.4.3. Default sinks"},{"refs":[{"id":"ref-for-transform-stream\u2463"}],"title":"6.4.4. Default sources"},{"refs":[{"id":"ref-for-transform-stream\u2464"}],"title":"9.3.2. Wrapping into a custom class"},{"refs":[{"id":"ref-for-transform-stream\u2465"}],"title":"9.4. Other stream pairs"},{"refs":[{"id":"ref-for-transform-stream\u2466"}],"title":"9.4.2. Endpoint pairs"},{"refs":[{"id":"ref-for-transform-stream\u2467"}],"title":"10.1. A readable stream with an underlying push source (no\nbackpressure support)"}],"url":"#transform-stream"}, "transform-stream-default-controller-clear-algorithms": {"dfnID":"transform-stream-default-controller-clear-algorithms","dfnText":"TransformStreamDefaultControllerClearAlgorithms(controller)","external":false,"refSections":[{"refs":[{"id":"ref-for-transform-stream-default-controller-clear-algorithms"}],"title":"6.4.1. Working with transform streams"},{"refs":[{"id":"ref-for-transform-stream-default-controller-clear-algorithms\u2460"},{"id":"ref-for-transform-stream-default-controller-clear-algorithms\u2461"}],"title":"6.4.3. Default sinks"},{"refs":[{"id":"ref-for-transform-stream-default-controller-clear-algorithms\u2462"}],"title":"6.4.4. Default sources"}],"url":"#transform-stream-default-controller-clear-algorithms"}, "transform-stream-default-controller-enqueue": {"dfnID":"transform-stream-default-controller-enqueue","dfnText":"TransformStreamDefaultControllerEnqueue(controller,\n chunk)","external":false,"refSections":[{"refs":[{"id":"ref-for-transform-stream-default-controller-enqueue"}],"title":"6.3.3. Methods and properties"},{"refs":[{"id":"ref-for-transform-stream-default-controller-enqueue\u2460"}],"title":"6.4.2. Default controllers"},{"refs":[{"id":"ref-for-transform-stream-default-controller-enqueue\u2461"}],"title":"9.3.1. Creation and manipulation"}],"url":"#transform-stream-default-controller-enqueue"}, "transform-stream-default-controller-error": {"dfnID":"transform-stream-default-controller-error","dfnText":"TransformStreamDefaultControllerError(controller,\n e)","external":false,"refSections":[{"refs":[{"id":"ref-for-transform-stream-default-controller-error"}],"title":"6.3.3. Methods and properties"},{"refs":[{"id":"ref-for-transform-stream-default-controller-error\u2460"}],"title":"9.3.1. Creation and manipulation"}],"url":"#transform-stream-default-controller-error"}, "transform-stream-default-controller-perform-transform": {"dfnID":"transform-stream-default-controller-perform-transform","dfnText":"TransformStreamDefaultControllerPerformTransform(controller,\n chunk)","external":false,"refSections":[{"refs":[{"id":"ref-for-transform-stream-default-controller-perform-transform"},{"id":"ref-for-transform-stream-default-controller-perform-transform\u2460"}],"title":"6.4.3. Default sinks"}],"url":"#transform-stream-default-controller-perform-transform"}, "transform-stream-default-controller-terminate": {"dfnID":"transform-stream-default-controller-terminate","dfnText":"TransformStreamDefaultControllerTerminate(controller)","external":false,"refSections":[{"refs":[{"id":"ref-for-transform-stream-default-controller-terminate"}],"title":"6.3.3. Methods and properties"},{"refs":[{"id":"ref-for-transform-stream-default-controller-terminate\u2460"}],"title":"9.3.1. Creation and manipulation"}],"url":"#transform-stream-default-controller-terminate"}, "transform-stream-default-sink-abort-algorithm": {"dfnID":"transform-stream-default-sink-abort-algorithm","dfnText":"TransformStreamDefaultSinkAbortAlgorithm(stream,\n reason)","external":false,"refSections":[{"refs":[{"id":"ref-for-transform-stream-default-sink-abort-algorithm"}],"title":"6.4.1. Working with transform streams"}],"url":"#transform-stream-default-sink-abort-algorithm"}, "transform-stream-default-sink-close-algorithm": {"dfnID":"transform-stream-default-sink-close-algorithm","dfnText":"TransformStreamDefaultSinkCloseAlgorithm(stream)","external":false,"refSections":[{"refs":[{"id":"ref-for-transform-stream-default-sink-close-algorithm"}],"title":"6.4.1. Working with transform streams"}],"url":"#transform-stream-default-sink-close-algorithm"}, "transform-stream-default-sink-write-algorithm": {"dfnID":"transform-stream-default-sink-write-algorithm","dfnText":"TransformStreamDefaultSinkWriteAlgorithm(stream,\n chunk)","external":false,"refSections":[{"refs":[{"id":"ref-for-transform-stream-default-sink-write-algorithm"},{"id":"ref-for-transform-stream-default-sink-write-algorithm\u2460"}],"title":"6.4.1. Working with transform streams"}],"url":"#transform-stream-default-sink-write-algorithm"}, "transform-stream-default-source-cancel": {"dfnID":"transform-stream-default-source-cancel","dfnText":"TransformStreamDefaultSourceCancelAlgorithm(stream,\n reason)","external":false,"refSections":[{"refs":[{"id":"ref-for-transform-stream-default-source-cancel"}],"title":"6.4.1. Working with transform streams"}],"url":"#transform-stream-default-source-cancel"}, "transform-stream-default-source-pull": {"dfnID":"transform-stream-default-source-pull","dfnText":"TransformStreamDefaultSourcePullAlgorithm(stream)","external":false,"refSections":[{"refs":[{"id":"ref-for-transform-stream-default-source-pull"}],"title":"6.4.1. Working with transform streams"}],"url":"#transform-stream-default-source-pull"}, "transform-stream-error": {"dfnID":"transform-stream-error","dfnText":"TransformStreamError(stream, e)","external":false,"refSections":[{"refs":[{"id":"ref-for-transform-stream-error"},{"id":"ref-for-transform-stream-error\u2460"}],"title":"6.4.2. Default controllers"}],"url":"#transform-stream-error"}, "transform-stream-error-writable-and-unblock-write": {"dfnID":"transform-stream-error-writable-and-unblock-write","dfnText":"TransformStreamErrorWritableAndUnblockWrite(stream,\n e)","external":false,"refSections":[{"refs":[{"id":"ref-for-transform-stream-error-writable-and-unblock-write"}],"title":"6.4.1. Working with transform streams"},{"refs":[{"id":"ref-for-transform-stream-error-writable-and-unblock-write\u2460"},{"id":"ref-for-transform-stream-error-writable-and-unblock-write\u2461"}],"title":"6.4.2. Default controllers"}],"url":"#transform-stream-error-writable-and-unblock-write"}, "transform-stream-set-backpressure": {"dfnID":"transform-stream-set-backpressure","dfnText":"TransformStreamSetBackpressure(stream,\n backpressure)","external":false,"refSections":[{"refs":[{"id":"ref-for-transform-stream-set-backpressure"},{"id":"ref-for-transform-stream-set-backpressure\u2460"},{"id":"ref-for-transform-stream-set-backpressure\u2461"},{"id":"ref-for-transform-stream-set-backpressure\u2462"}],"title":"6.4.1. Working with transform streams"},{"refs":[{"id":"ref-for-transform-stream-set-backpressure\u2463"}],"title":"6.4.2. Default controllers"},{"refs":[{"id":"ref-for-transform-stream-set-backpressure\u2464"}],"title":"6.4.4. Default sources"}],"url":"#transform-stream-set-backpressure"}, "transform-stream-unblock-write": {"dfnID":"transform-stream-unblock-write","dfnText":"TransformStreamUnblockWrite(stream)","external":false,"refSections":[{"refs":[{"id":"ref-for-transform-stream-unblock-write"}],"title":"6.4.1. Working with transform streams"},{"refs":[{"id":"ref-for-transform-stream-unblock-write\u2460"},{"id":"ref-for-transform-stream-unblock-write\u2461"}],"title":"6.4.4. Default sources"}],"url":"#transform-stream-unblock-write"}, "transformer": {"dfnID":"transformer","dfnText":"transformer","external":false,"refSections":[{"refs":[{"id":"ref-for-transformer"}],"title":"2.3. Transform streams"},{"refs":[{"id":"ref-for-transformer\u2460"},{"id":"ref-for-transformer\u2461"}],"title":"6.2.3. The transformer API"},{"refs":[{"id":"ref-for-transformer\u2462"}],"title":"6.2.4. Constructor and properties"},{"refs":[{"id":"ref-for-transformer\u2463"}],"title":"6.3. The TransformStreamDefaultController class"},{"refs":[{"id":"ref-for-transformer\u2464"},{"id":"ref-for-transformer\u2465"},{"id":"ref-for-transformer\u2466"}],"title":"6.3.2. Internal slots"},{"refs":[{"id":"ref-for-transformer\u2467"}],"title":"6.3.3. Methods and properties"},{"refs":[{"id":"ref-for-transformer\u2468"}],"title":"6.4.2. Default controllers"},{"refs":[{"id":"ref-for-transformer\u2460\u24ea"}],"title":"10.9. A transform stream that replaces template tags"}],"url":"#transformer"}, "transformstream": {"dfnID":"transformstream","dfnText":"TransformStream","external":false,"refSections":[{"refs":[{"id":"ref-for-transformstream"},{"id":"ref-for-transformstream\u2460"}],"title":"2.3. Transform streams"},{"refs":[{"id":"ref-for-transformstream\u2461"}],"title":"4.9.4. Default controllers"},{"refs":[{"id":"ref-for-transformstream\u2462"},{"id":"ref-for-transformstream\u2463"}],"title":"6.2. The TransformStream class"},{"refs":[{"id":"ref-for-transformstream\u2464"}],"title":"6.2.1. Interface definition"},{"refs":[{"id":"ref-for-transformstream\u2465"}],"title":"6.2.2. Internal slots"},{"refs":[{"id":"ref-for-transformstream\u2466"}],"title":"6.2.3. The transformer API"},{"refs":[{"id":"ref-for-transformstream\u2467"},{"id":"ref-for-transformstream\u2468"}],"title":"6.2.4. Constructor and properties"},{"refs":[{"id":"ref-for-transformstream\u2460\u24ea"},{"id":"ref-for-transformstream\u2460\u2460"},{"id":"ref-for-transformstream\u2460\u2461"}],"title":"6.2.5. Transfer via postMessage()"},{"refs":[{"id":"ref-for-transformstream\u2460\u2462"}],"title":"6.3. The TransformStreamDefaultController class"},{"refs":[{"id":"ref-for-transformstream\u2460\u2463"}],"title":"6.3.2. Internal slots"},{"refs":[{"id":"ref-for-transformstream\u2460\u2464"}],"title":"6.4.1. Working with transform streams"},{"refs":[{"id":"ref-for-transformstream\u2460\u2465"},{"id":"ref-for-transformstream\u2460\u2466"}],"title":"6.4.2. Default controllers"},{"refs":[{"id":"ref-for-transformstream\u2460\u2467"},{"id":"ref-for-transformstream\u2460\u2468"},{"id":"ref-for-transformstream\u2461\u24ea"},{"id":"ref-for-transformstream\u2461\u2460"},{"id":"ref-for-transformstream\u2461\u2461"},{"id":"ref-for-transformstream\u2461\u2462"},{"id":"ref-for-transformstream\u2461\u2463"},{"id":"ref-for-transformstream\u2461\u2464"},{"id":"ref-for-transformstream\u2461\u2465"},{"id":"ref-for-transformstream\u2461\u2466"}],"title":"9.3.1. Creation and manipulation"},{"refs":[{"id":"ref-for-transformstream\u2461\u2467"},{"id":"ref-for-transformstream\u2461\u2468"},{"id":"ref-for-transformstream\u2462\u24ea"},{"id":"ref-for-transformstream\u2462\u2460"},{"id":"ref-for-transformstream\u2462\u2461"}],"title":"9.3.2. Wrapping into a custom class"},{"refs":[{"id":"ref-for-transformstream\u2462\u2462"}],"title":"9.5. Piping"},{"refs":[{"id":"ref-for-transformstream\u2462\u2463"}],"title":"10. Examples of creating streams"},{"refs":[{"id":"ref-for-transformstream\u2462\u2464"}],"title":"10.9. A transform stream that replaces template tags"},{"refs":[{"id":"ref-for-transformstream\u2462\u2465"},{"id":"ref-for-transformstream\u2462\u2466"}],"title":"10.10. A transform stream created from a sync mapper function"}],"url":"#transformstream"}, "transformstream-backpressure": {"dfnID":"transformstream-backpressure","dfnText":"[[backpressure]]","external":false,"refSections":[{"refs":[{"id":"ref-for-transformstream-backpressure"}],"title":"6.2.2. Internal slots"},{"refs":[{"id":"ref-for-transformstream-backpressure\u2460"},{"id":"ref-for-transformstream-backpressure\u2461"}],"title":"6.2.5. Transfer via postMessage()"},{"refs":[{"id":"ref-for-transformstream-backpressure\u2462"},{"id":"ref-for-transformstream-backpressure\u2463"},{"id":"ref-for-transformstream-backpressure\u2464"},{"id":"ref-for-transformstream-backpressure\u2465"},{"id":"ref-for-transformstream-backpressure\u2466"},{"id":"ref-for-transformstream-backpressure\u2467"}],"title":"6.4.1. Working with transform streams"},{"refs":[{"id":"ref-for-transformstream-backpressure\u2468"}],"title":"6.4.2. Default controllers"},{"refs":[{"id":"ref-for-transformstream-backpressure\u2460\u24ea"}],"title":"6.4.3. Default sinks"},{"refs":[{"id":"ref-for-transformstream-backpressure\u2460\u2460"}],"title":"6.4.4. Default sources"}],"url":"#transformstream-backpressure"}, "transformstream-backpressurechangepromise": {"dfnID":"transformstream-backpressurechangepromise","dfnText":"[[backpressureChangePromise]]","external":false,"refSections":[{"refs":[{"id":"ref-for-transformstream-backpressurechangepromise"},{"id":"ref-for-transformstream-backpressurechangepromise\u2460"}],"title":"6.2.5. Transfer via postMessage()"},{"refs":[{"id":"ref-for-transformstream-backpressurechangepromise\u2461"},{"id":"ref-for-transformstream-backpressurechangepromise\u2462"},{"id":"ref-for-transformstream-backpressurechangepromise\u2463"},{"id":"ref-for-transformstream-backpressurechangepromise\u2464"},{"id":"ref-for-transformstream-backpressurechangepromise\u2465"}],"title":"6.4.1. Working with transform streams"},{"refs":[{"id":"ref-for-transformstream-backpressurechangepromise\u2466"}],"title":"6.4.3. Default sinks"},{"refs":[{"id":"ref-for-transformstream-backpressurechangepromise\u2467"},{"id":"ref-for-transformstream-backpressurechangepromise\u2468"}],"title":"6.4.4. Default sources"}],"url":"#transformstream-backpressurechangepromise"}, "transformstream-controller": {"dfnID":"transformstream-controller","dfnText":"[[controller]]","external":false,"refSections":[{"refs":[{"id":"ref-for-transformstream-controller"}],"title":"6.2.4. Constructor and properties"},{"refs":[{"id":"ref-for-transformstream-controller\u2460"},{"id":"ref-for-transformstream-controller\u2461"}],"title":"6.2.5. Transfer via postMessage()"},{"refs":[{"id":"ref-for-transformstream-controller\u2462"},{"id":"ref-for-transformstream-controller\u2463"}],"title":"6.4.1. Working with transform streams"},{"refs":[{"id":"ref-for-transformstream-controller\u2464"},{"id":"ref-for-transformstream-controller\u2465"}],"title":"6.4.2. Default controllers"},{"refs":[{"id":"ref-for-transformstream-controller\u2466"},{"id":"ref-for-transformstream-controller\u2467"},{"id":"ref-for-transformstream-controller\u2468"}],"title":"6.4.3. Default sinks"},{"refs":[{"id":"ref-for-transformstream-controller\u2460\u24ea"}],"title":"6.4.4. Default sources"},{"refs":[{"id":"ref-for-transformstream-controller\u2460\u2460"},{"id":"ref-for-transformstream-controller\u2460\u2461"},{"id":"ref-for-transformstream-controller\u2460\u2462"}],"title":"9.3.1. Creation and manipulation"}],"url":"#transformstream-controller"}, "transformstream-detached": {"dfnID":"transformstream-detached","dfnText":"[[Detached]]","external":false,"refSections":[],"url":"#transformstream-detached"}, "transformstream-enqueue": {"dfnID":"transformstream-enqueue","dfnText":"enqueue","external":false,"refSections":[{"refs":[{"id":"ref-for-transformstream-enqueue"}],"title":"9.3.1. Creation and manipulation"}],"url":"#transformstream-enqueue"}, "transformstream-error": {"dfnID":"transformstream-error","dfnText":"error","external":false,"refSections":[],"url":"#transformstream-error"}, "transformstream-readable": {"dfnID":"transformstream-readable","dfnText":"[[readable]]","external":false,"refSections":[{"refs":[{"id":"ref-for-transformstream-readable"},{"id":"ref-for-transformstream-readable\u2460"}],"title":"6.2.2. Internal slots"},{"refs":[{"id":"ref-for-transformstream-readable\u2461"}],"title":"6.2.4. Constructor and properties"},{"refs":[{"id":"ref-for-transformstream-readable\u2462"},{"id":"ref-for-transformstream-readable\u2463"}],"title":"6.2.5. Transfer via postMessage()"},{"refs":[{"id":"ref-for-transformstream-readable\u2464"}],"title":"6.3.3. Methods and properties"},{"refs":[{"id":"ref-for-transformstream-readable\u2465"},{"id":"ref-for-transformstream-readable\u2466"}],"title":"6.4.1. Working with transform streams"},{"refs":[{"id":"ref-for-transformstream-readable\u2467"},{"id":"ref-for-transformstream-readable\u2468"},{"id":"ref-for-transformstream-readable\u2460\u24ea"}],"title":"6.4.2. Default controllers"},{"refs":[{"id":"ref-for-transformstream-readable\u2460\u2460"},{"id":"ref-for-transformstream-readable\u2460\u2461"}],"title":"6.4.3. Default sinks"},{"refs":[{"id":"ref-for-transformstream-readable\u2460\u2462"}],"title":"9.3.2. Wrapping into a custom class"},{"refs":[{"id":"ref-for-transformstream-readable\u2460\u2463"}],"title":"9.5. Piping"}],"url":"#transformstream-readable"}, "transformstream-set-up": {"dfnID":"transformstream-set-up","dfnText":"set up","external":false,"refSections":[{"refs":[{"id":"ref-for-transformstream-set-up"},{"id":"ref-for-transformstream-set-up\u2460"},{"id":"ref-for-transformstream-set-up\u2461"},{"id":"ref-for-transformstream-set-up\u2462"}],"title":"9.3.1. Creation and manipulation"},{"refs":[{"id":"ref-for-transformstream-set-up\u2463"}],"title":"9.3.2. Wrapping into a custom class"}],"url":"#transformstream-set-up"}, "transformstream-set-up-cancelalgorithm": {"dfnID":"transformstream-set-up-cancelalgorithm","dfnText":"cancelAlgorithm","external":false,"refSections":[],"url":"#transformstream-set-up-cancelalgorithm"}, "transformstream-set-up-flushalgorithm": {"dfnID":"transformstream-set-up-flushalgorithm","dfnText":"flushAlgorithm","external":false,"refSections":[{"refs":[{"id":"ref-for-transformstream-set-up-flushalgorithm"}],"title":"9.3.1. Creation and manipulation"},{"refs":[{"id":"ref-for-transformstream-set-up-flushalgorithm\u2460"}],"title":"9.3.2. Wrapping into a custom class"}],"url":"#transformstream-set-up-flushalgorithm"}, "transformstream-set-up-transformalgorithm": {"dfnID":"transformstream-set-up-transformalgorithm","dfnText":"transformAlgorithm","external":false,"refSections":[{"refs":[{"id":"ref-for-transformstream-set-up-transformalgorithm"},{"id":"ref-for-transformstream-set-up-transformalgorithm\u2460"},{"id":"ref-for-transformstream-set-up-transformalgorithm\u2461"}],"title":"9.3.1. Creation and manipulation"},{"refs":[{"id":"ref-for-transformstream-set-up-transformalgorithm\u2462"}],"title":"9.3.2. Wrapping into a custom class"}],"url":"#transformstream-set-up-transformalgorithm"}, "transformstream-terminate": {"dfnID":"transformstream-terminate","dfnText":"terminate","external":false,"refSections":[],"url":"#transformstream-terminate"}, "transformstream-writable": {"dfnID":"transformstream-writable","dfnText":"[[writable]]","external":false,"refSections":[{"refs":[{"id":"ref-for-transformstream-writable"}],"title":"6.2.2. Internal slots"},{"refs":[{"id":"ref-for-transformstream-writable\u2460"}],"title":"6.2.4. Constructor and properties"},{"refs":[{"id":"ref-for-transformstream-writable\u2461"},{"id":"ref-for-transformstream-writable\u2462"}],"title":"6.2.5. Transfer via postMessage()"},{"refs":[{"id":"ref-for-transformstream-writable\u2463"},{"id":"ref-for-transformstream-writable\u2464"}],"title":"6.4.1. Working with transform streams"},{"refs":[{"id":"ref-for-transformstream-writable\u2465"},{"id":"ref-for-transformstream-writable\u2466"}],"title":"6.4.3. Default sinks"},{"refs":[{"id":"ref-for-transformstream-writable\u2467"}],"title":"6.4.4. Default sources"},{"refs":[{"id":"ref-for-transformstream-writable\u2468"}],"title":"9.3.2. Wrapping into a custom class"},{"refs":[{"id":"ref-for-transformstream-writable\u2460\u24ea"},{"id":"ref-for-transformstream-writable\u2460\u2460"}],"title":"9.5. Piping"}],"url":"#transformstream-writable"}, "transformstreamdefaultcontroller": {"dfnID":"transformstreamdefaultcontroller","dfnText":"TransformStreamDefaultController","external":false,"refSections":[{"refs":[{"id":"ref-for-transformstreamdefaultcontroller"}],"title":"6.2.2. Internal slots"},{"refs":[{"id":"ref-for-transformstreamdefaultcontroller\u2460"},{"id":"ref-for-transformstreamdefaultcontroller\u2461"},{"id":"ref-for-transformstreamdefaultcontroller\u2462"},{"id":"ref-for-transformstreamdefaultcontroller\u2463"}],"title":"6.2.3. The transformer API"},{"refs":[{"id":"ref-for-transformstreamdefaultcontroller\u2464"},{"id":"ref-for-transformstreamdefaultcontroller\u2465"},{"id":"ref-for-transformstreamdefaultcontroller\u2466"}],"title":"6.3. The TransformStreamDefaultController class"},{"refs":[{"id":"ref-for-transformstreamdefaultcontroller\u2467"}],"title":"6.3.1. Interface definition"},{"refs":[{"id":"ref-for-transformstreamdefaultcontroller\u2468"}],"title":"6.3.2. Internal slots"},{"refs":[{"id":"ref-for-transformstreamdefaultcontroller\u2460\u24ea"},{"id":"ref-for-transformstreamdefaultcontroller\u2460\u2460"}],"title":"6.4.2. Default controllers"},{"refs":[{"id":"ref-for-transformstreamdefaultcontroller\u2460\u2461"}],"title":"9.3.1. Creation and manipulation"}],"url":"#transformstreamdefaultcontroller"}, "transformstreamdefaultcontroller-cancelalgorithm": {"dfnID":"transformstreamdefaultcontroller-cancelalgorithm","dfnText":"[[cancelAlgorithm]]","external":false,"refSections":[{"refs":[{"id":"ref-for-transformstreamdefaultcontroller-cancelalgorithm"}],"title":"6.3.2. Internal slots"},{"refs":[{"id":"ref-for-transformstreamdefaultcontroller-cancelalgorithm\u2460"},{"id":"ref-for-transformstreamdefaultcontroller-cancelalgorithm\u2461"}],"title":"6.4.2. Default controllers"},{"refs":[{"id":"ref-for-transformstreamdefaultcontroller-cancelalgorithm\u2462"}],"title":"6.4.3. Default sinks"},{"refs":[{"id":"ref-for-transformstreamdefaultcontroller-cancelalgorithm\u2463"}],"title":"6.4.4. Default sources"}],"url":"#transformstreamdefaultcontroller-cancelalgorithm"}, "transformstreamdefaultcontroller-finishpromise": {"dfnID":"transformstreamdefaultcontroller-finishpromise","dfnText":"[[finishPromise]]","external":false,"refSections":[{"refs":[{"id":"ref-for-transformstreamdefaultcontroller-finishpromise"},{"id":"ref-for-transformstreamdefaultcontroller-finishpromise\u2460"},{"id":"ref-for-transformstreamdefaultcontroller-finishpromise\u2461"},{"id":"ref-for-transformstreamdefaultcontroller-finishpromise\u2462"},{"id":"ref-for-transformstreamdefaultcontroller-finishpromise\u2463"},{"id":"ref-for-transformstreamdefaultcontroller-finishpromise\u2464"},{"id":"ref-for-transformstreamdefaultcontroller-finishpromise\u2465"},{"id":"ref-for-transformstreamdefaultcontroller-finishpromise\u2466"},{"id":"ref-for-transformstreamdefaultcontroller-finishpromise\u2467"},{"id":"ref-for-transformstreamdefaultcontroller-finishpromise\u2468"},{"id":"ref-for-transformstreamdefaultcontroller-finishpromise\u2460\u24ea"},{"id":"ref-for-transformstreamdefaultcontroller-finishpromise\u2460\u2460"},{"id":"ref-for-transformstreamdefaultcontroller-finishpromise\u2460\u2461"},{"id":"ref-for-transformstreamdefaultcontroller-finishpromise\u2460\u2462"}],"title":"6.4.3. Default sinks"},{"refs":[{"id":"ref-for-transformstreamdefaultcontroller-finishpromise\u2460\u2463"},{"id":"ref-for-transformstreamdefaultcontroller-finishpromise\u2460\u2464"},{"id":"ref-for-transformstreamdefaultcontroller-finishpromise\u2460\u2465"},{"id":"ref-for-transformstreamdefaultcontroller-finishpromise\u2460\u2466"},{"id":"ref-for-transformstreamdefaultcontroller-finishpromise\u2460\u2467"},{"id":"ref-for-transformstreamdefaultcontroller-finishpromise\u2460\u2468"},{"id":"ref-for-transformstreamdefaultcontroller-finishpromise\u2461\u24ea"}],"title":"6.4.4. Default sources"}],"url":"#transformstreamdefaultcontroller-finishpromise"}, "transformstreamdefaultcontroller-flushalgorithm": {"dfnID":"transformstreamdefaultcontroller-flushalgorithm","dfnText":"[[flushAlgorithm]]","external":false,"refSections":[{"refs":[{"id":"ref-for-transformstreamdefaultcontroller-flushalgorithm"}],"title":"6.3.2. Internal slots"},{"refs":[{"id":"ref-for-transformstreamdefaultcontroller-flushalgorithm\u2460"},{"id":"ref-for-transformstreamdefaultcontroller-flushalgorithm\u2461"}],"title":"6.4.2. Default controllers"},{"refs":[{"id":"ref-for-transformstreamdefaultcontroller-flushalgorithm\u2462"}],"title":"6.4.3. Default sinks"}],"url":"#transformstreamdefaultcontroller-flushalgorithm"}, "transformstreamdefaultcontroller-stream": {"dfnID":"transformstreamdefaultcontroller-stream","dfnText":"[[stream]]","external":false,"refSections":[{"refs":[{"id":"ref-for-transformstreamdefaultcontroller-stream"}],"title":"6.3.3. Methods and properties"},{"refs":[{"id":"ref-for-transformstreamdefaultcontroller-stream\u2460"},{"id":"ref-for-transformstreamdefaultcontroller-stream\u2461"},{"id":"ref-for-transformstreamdefaultcontroller-stream\u2462"},{"id":"ref-for-transformstreamdefaultcontroller-stream\u2463"},{"id":"ref-for-transformstreamdefaultcontroller-stream\u2464"}],"title":"6.4.2. Default controllers"}],"url":"#transformstreamdefaultcontroller-stream"}, "transformstreamdefaultcontroller-transformalgorithm": {"dfnID":"transformstreamdefaultcontroller-transformalgorithm","dfnText":"[[transformAlgorithm]]","external":false,"refSections":[{"refs":[{"id":"ref-for-transformstreamdefaultcontroller-transformalgorithm"},{"id":"ref-for-transformstreamdefaultcontroller-transformalgorithm\u2460"},{"id":"ref-for-transformstreamdefaultcontroller-transformalgorithm\u2461"}],"title":"6.4.2. Default controllers"}],"url":"#transformstreamdefaultcontroller-transformalgorithm"}, "ts-constructor": {"dfnID":"ts-constructor","dfnText":"new TransformStream(transformer, writableStrategy,\n readableStrategy)","external":false,"refSections":[{"refs":[{"id":"ref-for-ts-constructor"}],"title":"2.3. Transform streams"},{"refs":[{"id":"ref-for-ts-constructor\u2460"}],"title":"6.2.1. Interface definition"},{"refs":[{"id":"ref-for-ts-constructor\u2461"},{"id":"ref-for-ts-constructor\u2462"}],"title":"6.2.3. The transformer API"},{"refs":[{"id":"ref-for-ts-constructor\u2463"}],"title":"6.2.4. Constructor and properties"},{"refs":[{"id":"ref-for-ts-constructor\u2464"}],"title":"7.1. The queuing strategy API"}],"url":"#ts-constructor"}, "ts-default-controller-desired-size": {"dfnID":"ts-default-controller-desired-size","dfnText":"desiredSize","external":false,"refSections":[{"refs":[{"id":"ref-for-ts-default-controller-desired-size"}],"title":"6.3.1. Interface definition"},{"refs":[{"id":"ref-for-ts-default-controller-desired-size\u2460"}],"title":"6.3.3. Methods and properties"}],"url":"#ts-default-controller-desired-size"}, "ts-default-controller-enqueue": {"dfnID":"ts-default-controller-enqueue","dfnText":"enqueue(chunk)","external":false,"refSections":[{"refs":[{"id":"ref-for-ts-default-controller-enqueue"},{"id":"ref-for-ts-default-controller-enqueue\u2460"},{"id":"ref-for-ts-default-controller-enqueue\u2461"}],"title":"6.2.3. The transformer API"},{"refs":[{"id":"ref-for-ts-default-controller-enqueue\u2462"}],"title":"6.3.1. Interface definition"},{"refs":[{"id":"ref-for-ts-default-controller-enqueue\u2463"}],"title":"6.3.3. Methods and properties"}],"url":"#ts-default-controller-enqueue"}, "ts-default-controller-error": {"dfnID":"ts-default-controller-error","dfnText":"error(e)","external":false,"refSections":[{"refs":[{"id":"ref-for-ts-default-controller-error"}],"title":"6.3.1. Interface definition"},{"refs":[{"id":"ref-for-ts-default-controller-error\u2460"}],"title":"6.3.3. Methods and properties"}],"url":"#ts-default-controller-error"}, "ts-default-controller-terminate": {"dfnID":"ts-default-controller-terminate","dfnText":"terminate()","external":false,"refSections":[{"refs":[{"id":"ref-for-ts-default-controller-terminate"},{"id":"ref-for-ts-default-controller-terminate\u2460"}],"title":"6.2.3. The transformer API"},{"refs":[{"id":"ref-for-ts-default-controller-terminate\u2461"}],"title":"6.3.1. Interface definition"},{"refs":[{"id":"ref-for-ts-default-controller-terminate\u2462"}],"title":"6.3.3. Methods and properties"}],"url":"#ts-default-controller-terminate"}, "ts-readable": {"dfnID":"ts-readable","dfnText":"readable","external":false,"refSections":[{"refs":[{"id":"ref-for-ts-readable"}],"title":"6.1. Using transform streams"},{"refs":[{"id":"ref-for-ts-readable\u2460"}],"title":"6.2.1. Interface definition"},{"refs":[{"id":"ref-for-ts-readable\u2461"}],"title":"6.2.4. Constructor and properties"}],"url":"#ts-readable"}, "ts-writable": {"dfnID":"ts-writable","dfnText":"writable","external":false,"refSections":[{"refs":[{"id":"ref-for-ts-writable"}],"title":"6.1. Using transform streams"},{"refs":[{"id":"ref-for-ts-writable\u2460"}],"title":"6.2.1. Interface definition"},{"refs":[{"id":"ref-for-ts-writable\u2461"}],"title":"6.2.4. Constructor and properties"}],"url":"#ts-writable"}, "typedefdef-readablestreamcontroller": {"dfnID":"typedefdef-readablestreamcontroller","dfnText":"ReadableStreamController","external":false,"refSections":[{"refs":[{"id":"ref-for-typedefdef-readablestreamcontroller"},{"id":"ref-for-typedefdef-readablestreamcontroller\u2460"}],"title":"4.2.3. The underlying source API"}],"url":"#typedefdef-readablestreamcontroller"}, "typedefdef-readablestreamreader": {"dfnID":"typedefdef-readablestreamreader","dfnText":"ReadableStreamReader","external":false,"refSections":[{"refs":[{"id":"ref-for-typedefdef-readablestreamreader"}],"title":"4.2.1. Interface definition"}],"url":"#typedefdef-readablestreamreader"}, "ultimate-sink": {"dfnID":"ultimate-sink","dfnText":"ultimate sink","external":false,"refSections":[{"refs":[{"id":"ref-for-ultimate-sink"}],"title":"2.4. Pipe chains and backpressure"}],"url":"#ultimate-sink"}, "underlying-byte-source": {"dfnID":"underlying-byte-source","dfnText":"underlying byte source","external":false,"refSections":[{"refs":[{"id":"ref-for-underlying-byte-source"},{"id":"ref-for-underlying-byte-source\u2460"},{"id":"ref-for-underlying-byte-source\u2461"},{"id":"ref-for-underlying-byte-source\u2462"},{"id":"ref-for-underlying-byte-source\u2463"},{"id":"ref-for-underlying-byte-source\u2464"},{"id":"ref-for-underlying-byte-source\u2465"},{"id":"ref-for-underlying-byte-source\u2466"},{"id":"ref-for-underlying-byte-source\u2467"},{"id":"ref-for-underlying-byte-source\u2468"},{"id":"ref-for-underlying-byte-source\u2460\u24ea"}],"title":"4.7.2. Internal slots"},{"refs":[{"id":"ref-for-underlying-byte-source\u2460\u2460"}],"title":"4.7.3. Methods and properties"},{"refs":[{"id":"ref-for-underlying-byte-source\u2460\u2461"}],"title":"4.8.3. Methods and properties"},{"refs":[{"id":"ref-for-underlying-byte-source\u2460\u2462"}],"title":"4.9.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-underlying-byte-source\u2460\u2463"}],"title":"4.9.5. Byte stream controllers"},{"refs":[{"id":"ref-for-underlying-byte-source\u2460\u2464"}],"title":"9.1.1. Creation and manipulation"},{"refs":[{"id":"ref-for-underlying-byte-source\u2460\u2465"}],"title":"10.5. A readable byte stream with an underlying pull source"}],"url":"#underlying-byte-source"}, "underlying-sink": {"dfnID":"underlying-sink","dfnText":"underlying sink","external":false,"refSections":[{"refs":[{"id":"ref-for-underlying-sink"},{"id":"ref-for-underlying-sink\u2460"}],"title":"2.2. Writable streams"},{"refs":[{"id":"ref-for-underlying-sink\u2461"}],"title":"2.4. Pipe chains and backpressure"},{"refs":[{"id":"ref-for-underlying-sink\u2462"}],"title":"2.5. Internal queues and queuing strategies"},{"refs":[{"id":"ref-for-underlying-sink\u2463"}],"title":"4.2.3. The underlying source API"},{"refs":[{"id":"ref-for-underlying-sink\u2464"},{"id":"ref-for-underlying-sink\u2465"},{"id":"ref-for-underlying-sink\u2466"}],"title":"5.1. Using writable streams"},{"refs":[{"id":"ref-for-underlying-sink\u2467"},{"id":"ref-for-underlying-sink\u2468"},{"id":"ref-for-underlying-sink\u2460\u24ea"}],"title":"5.2.2. Internal slots"},{"refs":[{"id":"ref-for-underlying-sink\u2460\u2460"},{"id":"ref-for-underlying-sink\u2460\u2461"},{"id":"ref-for-underlying-sink\u2460\u2462"},{"id":"ref-for-underlying-sink\u2460\u2463"},{"id":"ref-for-underlying-sink\u2460\u2464"},{"id":"ref-for-underlying-sink\u2460\u2465"}],"title":"5.2.3. The underlying sink API"},{"refs":[{"id":"ref-for-underlying-sink\u2460\u2466"},{"id":"ref-for-underlying-sink\u2460\u2467"},{"id":"ref-for-underlying-sink\u2460\u2468"}],"title":"5.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-underlying-sink\u2461\u24ea"},{"id":"ref-for-underlying-sink\u2461\u2460"},{"id":"ref-for-underlying-sink\u2461\u2461"}],"title":"5.3.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-underlying-sink\u2461\u2462"}],"title":"5.4. The WritableStreamDefaultController class"},{"refs":[{"id":"ref-for-underlying-sink\u2461\u2463"},{"id":"ref-for-underlying-sink\u2461\u2464"},{"id":"ref-for-underlying-sink\u2461\u2465"},{"id":"ref-for-underlying-sink\u2461\u2466"},{"id":"ref-for-underlying-sink\u2461\u2467"}],"title":"5.4.2. Internal slots"},{"refs":[{"id":"ref-for-underlying-sink\u2461\u2468"},{"id":"ref-for-underlying-sink\u2462\u24ea"}],"title":"5.4.3. Methods and properties"},{"refs":[{"id":"ref-for-underlying-sink\u2462\u2460"}],"title":"5.5.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-underlying-sink\u2462\u2461"}],"title":"5.5.4. Default controllers"},{"refs":[{"id":"ref-for-underlying-sink\u2462\u2462"}],"title":"6.4.3. Default sinks"},{"refs":[{"id":"ref-for-underlying-sink\u2462\u2463"}],"title":"7.2. The ByteLengthQueuingStrategy class"},{"refs":[{"id":"ref-for-underlying-sink\u2462\u2464"}],"title":"7.3. The CountQueuingStrategy class"},{"refs":[{"id":"ref-for-underlying-sink\u2462\u2465"},{"id":"ref-for-underlying-sink\u2462\u2466"}],"title":"9.2.1. Creation and manipulation"},{"refs":[{"id":"ref-for-underlying-sink\u2462\u2467"}],"title":"10.7. A writable stream with backpressure and success signals"}],"url":"#underlying-sink"}, "underlying-source": {"dfnID":"underlying-source","dfnText":"underlying source","external":false,"refSections":[{"refs":[{"id":"ref-for-underlying-source"},{"id":"ref-for-underlying-source\u2460"},{"id":"ref-for-underlying-source\u2461"}],"title":"2.1. Readable streams"},{"refs":[{"id":"ref-for-underlying-source\u2462"},{"id":"ref-for-underlying-source\u2463"}],"title":"2.4. Pipe chains and backpressure"},{"refs":[{"id":"ref-for-underlying-source\u2464"}],"title":"2.5. Internal queues and queuing strategies"},{"refs":[{"id":"ref-for-underlying-source\u2465"}],"title":"4.2. The ReadableStream class"},{"refs":[{"id":"ref-for-underlying-source\u2466"}],"title":"4.2.3. The underlying source API"},{"refs":[{"id":"ref-for-underlying-source\u2467"},{"id":"ref-for-underlying-source\u2468"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-underlying-source\u2460\u24ea"}],"title":"4.4.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-underlying-source\u2460\u2460"}],"title":"4.5.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-underlying-source\u2460\u2461"}],"title":"4.6. The ReadableStreamDefaultController class"},{"refs":[{"id":"ref-for-underlying-source\u2460\u2462"},{"id":"ref-for-underlying-source\u2460\u2463"},{"id":"ref-for-underlying-source\u2460\u2464"},{"id":"ref-for-underlying-source\u2460\u2465"},{"id":"ref-for-underlying-source\u2460\u2466"},{"id":"ref-for-underlying-source\u2460\u2467"},{"id":"ref-for-underlying-source\u2460\u2468"}],"title":"4.6.2. Internal slots"},{"refs":[{"id":"ref-for-underlying-source\u2461\u24ea"}],"title":"4.6.3. Methods and properties"},{"refs":[{"id":"ref-for-underlying-source\u2461\u2460"}],"title":"4.7. The ReadableByteStreamController class"},{"refs":[{"id":"ref-for-underlying-source\u2461\u2461"},{"id":"ref-for-underlying-source\u2461\u2462"},{"id":"ref-for-underlying-source\u2461\u2463"}],"title":"4.9.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-underlying-source\u2461\u2464"}],"title":"4.9.4. Default controllers"},{"refs":[{"id":"ref-for-underlying-source\u2461\u2465"},{"id":"ref-for-underlying-source\u2461\u2466"}],"title":"4.9.5. Byte stream controllers"},{"refs":[{"id":"ref-for-underlying-source\u2461\u2467"}],"title":"6.4.4. Default sources"},{"refs":[{"id":"ref-for-underlying-source\u2461\u2468"}],"title":"7.1. The queuing strategy API"},{"refs":[{"id":"ref-for-underlying-source\u2462\u24ea"}],"title":"7.2. The ByteLengthQueuingStrategy class"},{"refs":[{"id":"ref-for-underlying-source\u2462\u2460"}],"title":"7.3. The CountQueuingStrategy class"},{"refs":[{"id":"ref-for-underlying-source\u2462\u2461"}],"title":"10.2. A readable stream with an underlying push source and\nbackpressure support"}],"url":"#underlying-source"}, "validate-and-normalize-high-water-mark": {"dfnID":"validate-and-normalize-high-water-mark","dfnText":"ExtractHighWaterMark(strategy, defaultHWM)","external":false,"refSections":[{"refs":[{"id":"ref-for-validate-and-normalize-high-water-mark"},{"id":"ref-for-validate-and-normalize-high-water-mark\u2460"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-validate-and-normalize-high-water-mark\u2461"}],"title":"5.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-validate-and-normalize-high-water-mark\u2462"},{"id":"ref-for-validate-and-normalize-high-water-mark\u2463"}],"title":"6.2.4. Constructor and properties"}],"url":"#validate-and-normalize-high-water-mark"}, "value-with-size": {"dfnID":"value-with-size","dfnText":"value-with-size","external":false,"refSections":[{"refs":[{"id":"ref-for-value-with-size"},{"id":"ref-for-value-with-size\u2460"}],"title":"8.1. Queue-with-sizes"}],"url":"#value-with-size"}, "value-with-size-size": {"dfnID":"value-with-size-size","dfnText":"size","external":false,"refSections":[{"refs":[{"id":"ref-for-value-with-size-size"},{"id":"ref-for-value-with-size-size\u2460"}],"title":"8.1. Queue-with-sizes"}],"url":"#value-with-size-size"}, "value-with-size-value": {"dfnID":"value-with-size-value","dfnText":"value","external":false,"refSections":[{"refs":[{"id":"ref-for-value-with-size-value"},{"id":"ref-for-value-with-size-value\u2460"},{"id":"ref-for-value-with-size-value\u2461"}],"title":"8.1. Queue-with-sizes"}],"url":"#value-with-size-value"}, "writable-side": {"dfnID":"writable-side","dfnText":"writable side","external":false,"refSections":[{"refs":[{"id":"ref-for-writable-side"}],"title":"2.3. Transform streams"},{"refs":[{"id":"ref-for-writable-side\u2460"}],"title":"6.1. Using transform streams"},{"refs":[{"id":"ref-for-writable-side\u2461"},{"id":"ref-for-writable-side\u2462"},{"id":"ref-for-writable-side\u2463"},{"id":"ref-for-writable-side\u2464"}],"title":"6.2.3. The transformer API"},{"refs":[{"id":"ref-for-writable-side\u2465"},{"id":"ref-for-writable-side\u2466"}],"title":"6.2.4. Constructor and properties"},{"refs":[{"id":"ref-for-writable-side\u2467"}],"title":"6.2.5. Transfer via postMessage()"},{"refs":[{"id":"ref-for-writable-side\u2468"},{"id":"ref-for-writable-side\u2460\u24ea"},{"id":"ref-for-writable-side\u2460\u2460"}],"title":"6.3.3. Methods and properties"},{"refs":[{"id":"ref-for-writable-side\u2460\u2461"}],"title":"6.4.3. Default sinks"},{"refs":[{"id":"ref-for-writable-side\u2460\u2462"}],"title":"8.2. Transferable streams"},{"refs":[{"id":"ref-for-writable-side\u2460\u2463"},{"id":"ref-for-writable-side\u2460\u2464"}],"title":"10.11. Using an identity transform stream as a primitive to\ncreate new readable streams"}],"url":"#writable-side"}, "writable-stream": {"dfnID":"writable-stream","dfnText":"writable stream","external":false,"refSections":[{"refs":[{"id":"ref-for-writable-stream"}],"title":"1. Introduction"},{"refs":[{"id":"ref-for-writable-stream\u2460"}],"title":"2.3. Transform streams"},{"refs":[{"id":"ref-for-writable-stream\u2461"}],"title":"2.6. Locking"},{"refs":[{"id":"ref-for-writable-stream\u2462"},{"id":"ref-for-writable-stream\u2463"}],"title":"4.1. Using readable streams"},{"refs":[{"id":"ref-for-writable-stream\u2464"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-writable-stream\u2465"}],"title":"5.2. The WritableStream class"},{"refs":[{"id":"ref-for-writable-stream\u2466"}],"title":"5.5.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-writable-stream\u2467"},{"id":"ref-for-writable-stream\u2468"},{"id":"ref-for-writable-stream\u2460\u24ea"}],"title":"6.1. Using transform streams"},{"refs":[{"id":"ref-for-writable-stream\u2460\u2460"}],"title":"7.2. The ByteLengthQueuingStrategy class"},{"refs":[{"id":"ref-for-writable-stream\u2460\u2461"}],"title":"7.3. The CountQueuingStrategy class"},{"refs":[{"id":"ref-for-writable-stream\u2460\u2462"}],"title":"9.4. Other stream pairs"},{"refs":[{"id":"ref-for-writable-stream\u2460\u2463"}],"title":"10.1. A readable stream with an underlying push source (no\nbackpressure support)"},{"refs":[{"id":"ref-for-writable-stream\u2460\u2464"}],"title":"10.6. A writable stream with no backpressure or success signals"},{"refs":[{"id":"ref-for-writable-stream\u2460\u2465"}],"title":"10.7. A writable stream with backpressure and success signals"}],"url":"#writable-stream"}, "writable-stream-abort": {"dfnID":"writable-stream-abort","dfnText":"WritableStreamAbort(stream, reason)","external":false,"refSections":[{"refs":[{"id":"ref-for-writable-stream-abort"},{"id":"ref-for-writable-stream-abort\u2460"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-writable-stream-abort\u2461"},{"id":"ref-for-writable-stream-abort\u2462"},{"id":"ref-for-writable-stream-abort\u2463"}],"title":"5.2.2. Internal slots"},{"refs":[{"id":"ref-for-writable-stream-abort\u2464"}],"title":"5.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-writable-stream-abort\u2465"}],"title":"5.5.3. Writers"},{"refs":[{"id":"ref-for-writable-stream-abort\u2466"}],"title":"9.2.2. Writing"}],"url":"#writable-stream-abort"}, "writable-stream-add-write-request": {"dfnID":"writable-stream-add-write-request","dfnText":"WritableStreamAddWriteRequest(stream)","external":false,"refSections":[{"refs":[{"id":"ref-for-writable-stream-add-write-request"}],"title":"5.5.3. Writers"}],"url":"#writable-stream-add-write-request"}, "writable-stream-close": {"dfnID":"writable-stream-close","dfnText":"WritableStreamClose(stream)","external":false,"refSections":[{"refs":[{"id":"ref-for-writable-stream-close"}],"title":"5.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-writable-stream-close\u2460"}],"title":"5.5.3. Writers"},{"refs":[{"id":"ref-for-writable-stream-close\u2461"}],"title":"9.2.2. Writing"}],"url":"#writable-stream-close"}, "writable-stream-close-queued-or-in-flight": {"dfnID":"writable-stream-close-queued-or-in-flight","dfnText":"WritableStreamCloseQueuedOrInFlight(stream)","external":false,"refSections":[{"refs":[{"id":"ref-for-writable-stream-close-queued-or-in-flight"},{"id":"ref-for-writable-stream-close-queued-or-in-flight\u2460"},{"id":"ref-for-writable-stream-close-queued-or-in-flight\u2461"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-writable-stream-close-queued-or-in-flight\u2462"}],"title":"5.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-writable-stream-close-queued-or-in-flight\u2463"}],"title":"5.3.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-writable-stream-close-queued-or-in-flight\u2464"},{"id":"ref-for-writable-stream-close-queued-or-in-flight\u2465"}],"title":"5.5.1. Working with writable streams"},{"refs":[{"id":"ref-for-writable-stream-close-queued-or-in-flight\u2466"}],"title":"5.5.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-writable-stream-close-queued-or-in-flight\u2467"},{"id":"ref-for-writable-stream-close-queued-or-in-flight\u2468"}],"title":"5.5.3. Writers"},{"refs":[{"id":"ref-for-writable-stream-close-queued-or-in-flight\u2460\u24ea"},{"id":"ref-for-writable-stream-close-queued-or-in-flight\u2460\u2460"}],"title":"5.5.4. Default controllers"}],"url":"#writable-stream-close-queued-or-in-flight"}, "writable-stream-deal-with-rejection": {"dfnID":"writable-stream-deal-with-rejection","dfnText":"WritableStreamDealWithRejection(stream, error)","external":false,"refSections":[{"refs":[{"id":"ref-for-writable-stream-deal-with-rejection"},{"id":"ref-for-writable-stream-deal-with-rejection\u2460"}],"title":"5.5.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-writable-stream-deal-with-rejection\u2461"}],"title":"5.5.4. Default controllers"}],"url":"#writable-stream-deal-with-rejection"}, "writable-stream-default-controller-advance-queue-if-needed": {"dfnID":"writable-stream-default-controller-advance-queue-if-needed","dfnText":"WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller)","external":false,"refSections":[{"refs":[{"id":"ref-for-writable-stream-default-controller-advance-queue-if-needed"},{"id":"ref-for-writable-stream-default-controller-advance-queue-if-needed\u2460"},{"id":"ref-for-writable-stream-default-controller-advance-queue-if-needed\u2461"},{"id":"ref-for-writable-stream-default-controller-advance-queue-if-needed\u2462"}],"title":"5.5.4. Default controllers"}],"url":"#writable-stream-default-controller-advance-queue-if-needed"}, "writable-stream-default-controller-clear-algorithms": {"dfnID":"writable-stream-default-controller-clear-algorithms","dfnText":"WritableStreamDefaultControllerClearAlgorithms(controller)","external":false,"refSections":[{"refs":[{"id":"ref-for-writable-stream-default-controller-clear-algorithms"}],"title":"5.4.4. Internal methods"},{"refs":[{"id":"ref-for-writable-stream-default-controller-clear-algorithms\u2460"},{"id":"ref-for-writable-stream-default-controller-clear-algorithms\u2461"},{"id":"ref-for-writable-stream-default-controller-clear-algorithms\u2462"}],"title":"5.5.4. Default controllers"}],"url":"#writable-stream-default-controller-clear-algorithms"}, "writable-stream-default-controller-close": {"dfnID":"writable-stream-default-controller-close","dfnText":"WritableStreamDefaultControllerClose(controller)","external":false,"refSections":[{"refs":[{"id":"ref-for-writable-stream-default-controller-close"}],"title":"5.5.1. Working with writable streams"}],"url":"#writable-stream-default-controller-close"}, "writable-stream-default-controller-error": {"dfnID":"writable-stream-default-controller-error","dfnText":"WritableStreamDefaultControllerError(controller,\n error)","external":false,"refSections":[{"refs":[{"id":"ref-for-writable-stream-default-controller-error"}],"title":"5.4.3. Methods and properties"},{"refs":[{"id":"ref-for-writable-stream-default-controller-error\u2460"}],"title":"5.5.4. Default controllers"}],"url":"#writable-stream-default-controller-error"}, "writable-stream-default-controller-error-if-needed": {"dfnID":"writable-stream-default-controller-error-if-needed","dfnText":"WritableStreamDefaultControllerErrorIfNeeded(controller,\n error)","external":false,"refSections":[{"refs":[{"id":"ref-for-writable-stream-default-controller-error-if-needed"},{"id":"ref-for-writable-stream-default-controller-error-if-needed\u2460"}],"title":"5.5.4. Default controllers"},{"refs":[{"id":"ref-for-writable-stream-default-controller-error-if-needed\u2461"}],"title":"6.4.1. Working with transform streams"},{"refs":[{"id":"ref-for-writable-stream-default-controller-error-if-needed\u2462"},{"id":"ref-for-writable-stream-default-controller-error-if-needed\u2463"}],"title":"6.4.4. Default sources"},{"refs":[{"id":"ref-for-writable-stream-default-controller-error-if-needed\u2464"},{"id":"ref-for-writable-stream-default-controller-error-if-needed\u2465"}],"title":"8.2. Transferable streams"},{"refs":[{"id":"ref-for-writable-stream-default-controller-error-if-needed\u2466"}],"title":"9.2.1. Creation and manipulation"}],"url":"#writable-stream-default-controller-error-if-needed"}, "writable-stream-default-controller-get-backpressure": {"dfnID":"writable-stream-default-controller-get-backpressure","dfnText":"WritableStreamDefaultControllerGetBackpressure(controller)","external":false,"refSections":[{"refs":[{"id":"ref-for-writable-stream-default-controller-get-backpressure"},{"id":"ref-for-writable-stream-default-controller-get-backpressure\u2460"},{"id":"ref-for-writable-stream-default-controller-get-backpressure\u2461"}],"title":"5.5.4. Default controllers"}],"url":"#writable-stream-default-controller-get-backpressure"}, "writable-stream-default-controller-get-chunk-size": {"dfnID":"writable-stream-default-controller-get-chunk-size","dfnText":"WritableStreamDefaultControllerGetChunkSize(controller,\n chunk)","external":false,"refSections":[{"refs":[{"id":"ref-for-writable-stream-default-controller-get-chunk-size"}],"title":"5.5.3. Writers"}],"url":"#writable-stream-default-controller-get-chunk-size"}, "writable-stream-default-controller-get-desired-size": {"dfnID":"writable-stream-default-controller-get-desired-size","dfnText":"WritableStreamDefaultControllerGetDesiredSize(controller)","external":false,"refSections":[{"refs":[{"id":"ref-for-writable-stream-default-controller-get-desired-size"}],"title":"5.5.3. Writers"},{"refs":[{"id":"ref-for-writable-stream-default-controller-get-desired-size\u2460"}],"title":"5.5.4. Default controllers"}],"url":"#writable-stream-default-controller-get-desired-size"}, "writable-stream-default-controller-process-close": {"dfnID":"writable-stream-default-controller-process-close","dfnText":"WritableStreamDefaultControllerProcessClose(controller)","external":false,"refSections":[{"refs":[{"id":"ref-for-writable-stream-default-controller-process-close"}],"title":"5.5.4. Default controllers"}],"url":"#writable-stream-default-controller-process-close"}, "writable-stream-default-controller-process-write": {"dfnID":"writable-stream-default-controller-process-write","dfnText":"WritableStreamDefaultControllerProcessWrite(controller,\n chunk)","external":false,"refSections":[{"refs":[{"id":"ref-for-writable-stream-default-controller-process-write"}],"title":"5.5.4. Default controllers"}],"url":"#writable-stream-default-controller-process-write"}, "writable-stream-default-controller-write": {"dfnID":"writable-stream-default-controller-write","dfnText":"WritableStreamDefaultControllerWrite(controller,\n chunk, chunkSize)","external":false,"refSections":[{"refs":[{"id":"ref-for-writable-stream-default-controller-write"}],"title":"5.5.3. Writers"}],"url":"#writable-stream-default-controller-write"}, "writable-stream-default-writer-abort": {"dfnID":"writable-stream-default-writer-abort","dfnText":"WritableStreamDefaultWriterAbort(writer,\n reason)","external":false,"refSections":[{"refs":[{"id":"ref-for-writable-stream-default-writer-abort"}],"title":"5.3.3. Constructor, methods, and properties"}],"url":"#writable-stream-default-writer-abort"}, "writable-stream-default-writer-close": {"dfnID":"writable-stream-default-writer-close","dfnText":"WritableStreamDefaultWriterClose(writer)","external":false,"refSections":[{"refs":[{"id":"ref-for-writable-stream-default-writer-close"}],"title":"5.3.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-writable-stream-default-writer-close\u2460"}],"title":"5.5.3. Writers"}],"url":"#writable-stream-default-writer-close"}, "writable-stream-default-writer-close-with-error-propagation": {"dfnID":"writable-stream-default-writer-close-with-error-propagation","dfnText":"WritableStreamDefaultWriterCloseWithErrorPropagation(writer)","external":false,"refSections":[{"refs":[{"id":"ref-for-writable-stream-default-writer-close-with-error-propagation"}],"title":"4.9.1. Working with readable streams"}],"url":"#writable-stream-default-writer-close-with-error-propagation"}, "writable-stream-default-writer-ensure-closed-promise-rejected": {"dfnID":"writable-stream-default-writer-ensure-closed-promise-rejected","dfnText":"WritableStreamDefaultWriterEnsureClosedPromiseRejected(writer,\n error)","external":false,"refSections":[{"refs":[{"id":"ref-for-writable-stream-default-writer-ensure-closed-promise-rejected"}],"title":"5.5.3. Writers"}],"url":"#writable-stream-default-writer-ensure-closed-promise-rejected"}, "writable-stream-default-writer-ensure-ready-promise-rejected": {"dfnID":"writable-stream-default-writer-ensure-ready-promise-rejected","dfnText":"WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer,\n error)","external":false,"refSections":[{"refs":[{"id":"ref-for-writable-stream-default-writer-ensure-ready-promise-rejected"}],"title":"5.5.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-writable-stream-default-writer-ensure-ready-promise-rejected\u2460"}],"title":"5.5.3. Writers"}],"url":"#writable-stream-default-writer-ensure-ready-promise-rejected"}, "writable-stream-default-writer-get-desired-size": {"dfnID":"writable-stream-default-writer-get-desired-size","dfnText":"WritableStreamDefaultWriterGetDesiredSize(writer)","external":false,"refSections":[{"refs":[{"id":"ref-for-writable-stream-default-writer-get-desired-size"},{"id":"ref-for-writable-stream-default-writer-get-desired-size\u2460"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-writable-stream-default-writer-get-desired-size\u2461"}],"title":"5.3.3. Constructor, methods, and properties"}],"url":"#writable-stream-default-writer-get-desired-size"}, "writable-stream-default-writer-release": {"dfnID":"writable-stream-default-writer-release","dfnText":"WritableStreamDefaultWriterRelease(writer)","external":false,"refSections":[{"refs":[{"id":"ref-for-writable-stream-default-writer-release"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-writable-stream-default-writer-release\u2460"}],"title":"5.3.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-writable-stream-default-writer-release\u2461"}],"title":"9.2.2. Writing"}],"url":"#writable-stream-default-writer-release"}, "writable-stream-default-writer-write": {"dfnID":"writable-stream-default-writer-write","dfnText":"WritableStreamDefaultWriterWrite(writer, chunk)","external":false,"refSections":[{"refs":[{"id":"ref-for-writable-stream-default-writer-write"}],"title":"5.3.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-writable-stream-default-writer-write\u2460"}],"title":"9.2.2. Writing"}],"url":"#writable-stream-default-writer-write"}, "writable-stream-finish-erroring": {"dfnID":"writable-stream-finish-erroring","dfnText":"WritableStreamFinishErroring(stream)","external":false,"refSections":[{"refs":[{"id":"ref-for-writable-stream-finish-erroring"},{"id":"ref-for-writable-stream-finish-erroring\u2460"}],"title":"5.5.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-writable-stream-finish-erroring\u2461"}],"title":"5.5.4. Default controllers"}],"url":"#writable-stream-finish-erroring"}, "writable-stream-finish-in-flight-close": {"dfnID":"writable-stream-finish-in-flight-close","dfnText":"WritableStreamFinishInFlightClose(stream)","external":false,"refSections":[{"refs":[{"id":"ref-for-writable-stream-finish-in-flight-close"}],"title":"5.5.4. Default controllers"}],"url":"#writable-stream-finish-in-flight-close"}, "writable-stream-finish-in-flight-close-with-error": {"dfnID":"writable-stream-finish-in-flight-close-with-error","dfnText":"WritableStreamFinishInFlightCloseWithError(stream,\n error)","external":false,"refSections":[{"refs":[{"id":"ref-for-writable-stream-finish-in-flight-close-with-error"}],"title":"5.5.4. Default controllers"}],"url":"#writable-stream-finish-in-flight-close-with-error"}, "writable-stream-finish-in-flight-write": {"dfnID":"writable-stream-finish-in-flight-write","dfnText":"WritableStreamFinishInFlightWrite(stream)","external":false,"refSections":[{"refs":[{"id":"ref-for-writable-stream-finish-in-flight-write"}],"title":"5.5.4. Default controllers"}],"url":"#writable-stream-finish-in-flight-write"}, "writable-stream-finish-in-flight-write-with-error": {"dfnID":"writable-stream-finish-in-flight-write-with-error","dfnText":"WritableStreamFinishInFlightWriteWithError(stream,\n error)","external":false,"refSections":[{"refs":[{"id":"ref-for-writable-stream-finish-in-flight-write-with-error"}],"title":"5.5.4. Default controllers"}],"url":"#writable-stream-finish-in-flight-write-with-error"}, "writable-stream-has-operation-marked-in-flight": {"dfnID":"writable-stream-has-operation-marked-in-flight","dfnText":"WritableStreamHasOperationMarkedInFlight(stream)","external":false,"refSections":[{"refs":[{"id":"ref-for-writable-stream-has-operation-marked-in-flight"},{"id":"ref-for-writable-stream-has-operation-marked-in-flight\u2460"}],"title":"5.5.2. Interfacing with controllers"}],"url":"#writable-stream-has-operation-marked-in-flight"}, "writable-stream-mark-close-request-in-flight": {"dfnID":"writable-stream-mark-close-request-in-flight","dfnText":"WritableStreamMarkCloseRequestInFlight(stream)","external":false,"refSections":[{"refs":[{"id":"ref-for-writable-stream-mark-close-request-in-flight"}],"title":"5.5.4. Default controllers"}],"url":"#writable-stream-mark-close-request-in-flight"}, "writable-stream-mark-first-write-request-in-flight": {"dfnID":"writable-stream-mark-first-write-request-in-flight","dfnText":"WritableStreamMarkFirstWriteRequestInFlight(stream)","external":false,"refSections":[{"refs":[{"id":"ref-for-writable-stream-mark-first-write-request-in-flight"}],"title":"5.5.4. Default controllers"}],"url":"#writable-stream-mark-first-write-request-in-flight"}, "writable-stream-reject-close-and-closed-promise-if-needed": {"dfnID":"writable-stream-reject-close-and-closed-promise-if-needed","dfnText":"WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream)","external":false,"refSections":[{"refs":[{"id":"ref-for-writable-stream-reject-close-and-closed-promise-if-needed"},{"id":"ref-for-writable-stream-reject-close-and-closed-promise-if-needed\u2460"},{"id":"ref-for-writable-stream-reject-close-and-closed-promise-if-needed\u2461"},{"id":"ref-for-writable-stream-reject-close-and-closed-promise-if-needed\u2462"}],"title":"5.5.2. Interfacing with controllers"}],"url":"#writable-stream-reject-close-and-closed-promise-if-needed"}, "writable-stream-start-erroring": {"dfnID":"writable-stream-start-erroring","dfnText":"WritableStreamStartErroring(stream, reason)","external":false,"refSections":[{"refs":[{"id":"ref-for-writable-stream-start-erroring"}],"title":"5.5.1. Working with writable streams"},{"refs":[{"id":"ref-for-writable-stream-start-erroring\u2460"}],"title":"5.5.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-writable-stream-start-erroring\u2461"}],"title":"5.5.4. Default controllers"}],"url":"#writable-stream-start-erroring"}, "writable-stream-update-backpressure": {"dfnID":"writable-stream-update-backpressure","dfnText":"WritableStreamUpdateBackpressure(stream,\n backpressure)","external":false,"refSections":[{"refs":[{"id":"ref-for-writable-stream-update-backpressure"},{"id":"ref-for-writable-stream-update-backpressure\u2460"},{"id":"ref-for-writable-stream-update-backpressure\u2461"}],"title":"5.5.4. Default controllers"}],"url":"#writable-stream-update-backpressure"}, "writablestream": {"dfnID":"writablestream","dfnText":"WritableStream","external":false,"refSections":[{"refs":[{"id":"ref-for-writablestream"}],"title":"2.2. Writable streams"},{"refs":[{"id":"ref-for-writablestream\u2460"},{"id":"ref-for-writablestream\u2461"}],"title":"4.2.1. Interface definition"},{"refs":[{"id":"ref-for-writablestream\u2462"},{"id":"ref-for-writablestream\u2463"}],"title":"4.2.3. The underlying source API"},{"refs":[{"id":"ref-for-writablestream\u2464"}],"title":"4.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-writablestream\u2465"}],"title":"4.2.6. Transfer via postMessage()"},{"refs":[{"id":"ref-for-writablestream\u2466"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-writablestream\u2467"},{"id":"ref-for-writablestream\u2468"}],"title":"5.2. The WritableStream class"},{"refs":[{"id":"ref-for-writablestream\u2460\u24ea"}],"title":"5.2.1. Interface definition"},{"refs":[{"id":"ref-for-writablestream\u2460\u2460"}],"title":"5.2.2. Internal slots"},{"refs":[{"id":"ref-for-writablestream\u2460\u2461"}],"title":"5.2.3. The underlying sink API"},{"refs":[{"id":"ref-for-writablestream\u2460\u2462"}],"title":"5.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-writablestream\u2460\u2463"},{"id":"ref-for-writablestream\u2460\u2464"}],"title":"5.2.5. Transfer via postMessage()"},{"refs":[{"id":"ref-for-writablestream\u2460\u2465"}],"title":"5.3. The WritableStreamDefaultWriter class"},{"refs":[{"id":"ref-for-writablestream\u2460\u2466"}],"title":"5.3.1. Interface definition"},{"refs":[{"id":"ref-for-writablestream\u2460\u2467"}],"title":"5.3.2. Internal slots"},{"refs":[{"id":"ref-for-writablestream\u2460\u2468"},{"id":"ref-for-writablestream\u2461\u24ea"}],"title":"5.4. The WritableStreamDefaultController class"},{"refs":[{"id":"ref-for-writablestream\u2461\u2460"}],"title":"5.4.2. Internal slots"},{"refs":[{"id":"ref-for-writablestream\u2461\u2461"},{"id":"ref-for-writablestream\u2461\u2462"}],"title":"5.5.1. Working with writable streams"},{"refs":[{"id":"ref-for-writablestream\u2461\u2463"},{"id":"ref-for-writablestream\u2461\u2464"},{"id":"ref-for-writablestream\u2461\u2465"},{"id":"ref-for-writablestream\u2461\u2466"}],"title":"5.5.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-writablestream\u2461\u2467"},{"id":"ref-for-writablestream\u2461\u2468"}],"title":"5.5.4. Default controllers"},{"refs":[{"id":"ref-for-writablestream\u2462\u24ea"}],"title":"6.2.1. Interface definition"},{"refs":[{"id":"ref-for-writablestream\u2462\u2460"}],"title":"6.2.2. Internal slots"},{"refs":[{"id":"ref-for-writablestream\u2462\u2461"},{"id":"ref-for-writablestream\u2462\u2462"}],"title":"6.2.4. Constructor and properties"},{"refs":[{"id":"ref-for-writablestream\u2462\u2463"}],"title":"6.3. The TransformStreamDefaultController class"},{"refs":[{"id":"ref-for-writablestream\u2462\u2464"},{"id":"ref-for-writablestream\u2462\u2465"},{"id":"ref-for-writablestream\u2462\u2466"},{"id":"ref-for-writablestream\u2462\u2467"},{"id":"ref-for-writablestream\u2462\u2468"},{"id":"ref-for-writablestream\u2463\u24ea"},{"id":"ref-for-writablestream\u2463\u2460"},{"id":"ref-for-writablestream\u2463\u2461"}],"title":"9.2.1. Creation and manipulation"},{"refs":[{"id":"ref-for-writablestream\u2463\u2462"},{"id":"ref-for-writablestream\u2463\u2463"},{"id":"ref-for-writablestream\u2463\u2464"},{"id":"ref-for-writablestream\u2463\u2465"}],"title":"9.2.2. Writing"},{"refs":[{"id":"ref-for-writablestream\u2463\u2466"}],"title":"9.3.2. Wrapping into a custom class"},{"refs":[{"id":"ref-for-writablestream\u2463\u2467"}],"title":"9.5. Piping"},{"refs":[{"id":"ref-for-writablestream\u2463\u2468"}],"title":"10. Examples of creating streams"}],"url":"#writablestream"}, "writablestream-abort": {"dfnID":"writablestream-abort","dfnText":"abort","external":false,"refSections":[],"url":"#writablestream-abort"}, "writablestream-backpressure": {"dfnID":"writablestream-backpressure","dfnText":"[[backpressure]]","external":false,"refSections":[{"refs":[{"id":"ref-for-writablestream-backpressure"},{"id":"ref-for-writablestream-backpressure\u2460"},{"id":"ref-for-writablestream-backpressure\u2461"}],"title":"5.5.1. Working with writable streams"},{"refs":[{"id":"ref-for-writablestream-backpressure\u2462"},{"id":"ref-for-writablestream-backpressure\u2463"}],"title":"5.5.2. Interfacing with controllers"}],"url":"#writablestream-backpressure"}, "writablestream-close": {"dfnID":"writablestream-close","dfnText":"close","external":false,"refSections":[{"refs":[{"id":"ref-for-writablestream-close"}],"title":"9.4.1. Duplex streams"}],"url":"#writablestream-close"}, "writablestream-closerequest": {"dfnID":"writablestream-closerequest","dfnText":"[[closeRequest]]","external":false,"refSections":[{"refs":[{"id":"ref-for-writablestream-closerequest"}],"title":"5.2.2. Internal slots"},{"refs":[{"id":"ref-for-writablestream-closerequest\u2460"},{"id":"ref-for-writablestream-closerequest\u2461"}],"title":"5.5.1. Working with writable streams"},{"refs":[{"id":"ref-for-writablestream-closerequest\u2462"},{"id":"ref-for-writablestream-closerequest\u2463"},{"id":"ref-for-writablestream-closerequest\u2464"},{"id":"ref-for-writablestream-closerequest\u2465"},{"id":"ref-for-writablestream-closerequest\u2466"},{"id":"ref-for-writablestream-closerequest\u2467"},{"id":"ref-for-writablestream-closerequest\u2468"}],"title":"5.5.2. Interfacing with controllers"}],"url":"#writablestream-closerequest"}, "writablestream-controller": {"dfnID":"writablestream-controller","dfnText":"[[controller]]","external":false,"refSections":[{"refs":[{"id":"ref-for-writablestream-controller"},{"id":"ref-for-writablestream-controller\u2460"},{"id":"ref-for-writablestream-controller\u2461"}],"title":"5.5.1. Working with writable streams"},{"refs":[{"id":"ref-for-writablestream-controller\u2462"},{"id":"ref-for-writablestream-controller\u2463"},{"id":"ref-for-writablestream-controller\u2464"}],"title":"5.5.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-writablestream-controller\u2465"},{"id":"ref-for-writablestream-controller\u2466"}],"title":"5.5.3. Writers"},{"refs":[{"id":"ref-for-writablestream-controller\u2467"},{"id":"ref-for-writablestream-controller\u2468"}],"title":"5.5.4. Default controllers"},{"refs":[{"id":"ref-for-writablestream-controller\u2460\u24ea"}],"title":"6.4.1. Working with transform streams"},{"refs":[{"id":"ref-for-writablestream-controller\u2460\u2460"},{"id":"ref-for-writablestream-controller\u2460\u2461"}],"title":"6.4.4. Default sources"},{"refs":[{"id":"ref-for-writablestream-controller\u2460\u2462"},{"id":"ref-for-writablestream-controller\u2460\u2463"}],"title":"9.2.1. Creation and manipulation"}],"url":"#writablestream-controller"}, "writablestream-detached": {"dfnID":"writablestream-detached","dfnText":"[[Detached]]","external":false,"refSections":[],"url":"#writablestream-detached"}, "writablestream-error": {"dfnID":"writablestream-error","dfnText":"error","external":false,"refSections":[],"url":"#writablestream-error"}, "writablestream-get-a-writer": {"dfnID":"writablestream-get-a-writer","dfnText":"get a writer","external":false,"refSections":[],"url":"#writablestream-get-a-writer"}, "writablestream-inflightcloserequest": {"dfnID":"writablestream-inflightcloserequest","dfnText":"[[inFlightCloseRequest]]","external":false,"refSections":[{"refs":[{"id":"ref-for-writablestream-inflightcloserequest"}],"title":"5.2.2. Internal slots"},{"refs":[{"id":"ref-for-writablestream-inflightcloserequest\u2460"}],"title":"5.5.1. Working with writable streams"},{"refs":[{"id":"ref-for-writablestream-inflightcloserequest\u2461"},{"id":"ref-for-writablestream-inflightcloserequest\u2462"},{"id":"ref-for-writablestream-inflightcloserequest\u2463"},{"id":"ref-for-writablestream-inflightcloserequest\u2464"},{"id":"ref-for-writablestream-inflightcloserequest\u2465"},{"id":"ref-for-writablestream-inflightcloserequest\u2466"},{"id":"ref-for-writablestream-inflightcloserequest\u2467"},{"id":"ref-for-writablestream-inflightcloserequest\u2468"},{"id":"ref-for-writablestream-inflightcloserequest\u2460\u24ea"},{"id":"ref-for-writablestream-inflightcloserequest\u2460\u2460"},{"id":"ref-for-writablestream-inflightcloserequest\u2460\u2461"}],"title":"5.5.2. Interfacing with controllers"}],"url":"#writablestream-inflightcloserequest"}, "writablestream-inflightwriterequest": {"dfnID":"writablestream-inflightwriterequest","dfnText":"[[inFlightWriteRequest]]","external":false,"refSections":[{"refs":[{"id":"ref-for-writablestream-inflightwriterequest"}],"title":"5.2.2. Internal slots"},{"refs":[{"id":"ref-for-writablestream-inflightwriterequest\u2460"}],"title":"5.5.1. Working with writable streams"},{"refs":[{"id":"ref-for-writablestream-inflightwriterequest\u2461"},{"id":"ref-for-writablestream-inflightwriterequest\u2462"},{"id":"ref-for-writablestream-inflightwriterequest\u2463"},{"id":"ref-for-writablestream-inflightwriterequest\u2464"},{"id":"ref-for-writablestream-inflightwriterequest\u2465"},{"id":"ref-for-writablestream-inflightwriterequest\u2466"},{"id":"ref-for-writablestream-inflightwriterequest\u2467"},{"id":"ref-for-writablestream-inflightwriterequest\u2468"},{"id":"ref-for-writablestream-inflightwriterequest\u2460\u24ea"}],"title":"5.5.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-writablestream-inflightwriterequest\u2460\u2460"}],"title":"5.5.4. Default controllers"}],"url":"#writablestream-inflightwriterequest"}, "writablestream-pendingabortrequest": {"dfnID":"writablestream-pendingabortrequest","dfnText":"[[pendingAbortRequest]]","external":false,"refSections":[{"refs":[{"id":"ref-for-writablestream-pendingabortrequest"},{"id":"ref-for-writablestream-pendingabortrequest\u2460"},{"id":"ref-for-writablestream-pendingabortrequest\u2461"},{"id":"ref-for-writablestream-pendingabortrequest\u2462"}],"title":"5.5.1. Working with writable streams"},{"refs":[{"id":"ref-for-writablestream-pendingabortrequest\u2463"},{"id":"ref-for-writablestream-pendingabortrequest\u2464"},{"id":"ref-for-writablestream-pendingabortrequest\u2465"},{"id":"ref-for-writablestream-pendingabortrequest\u2466"},{"id":"ref-for-writablestream-pendingabortrequest\u2467"},{"id":"ref-for-writablestream-pendingabortrequest\u2468"},{"id":"ref-for-writablestream-pendingabortrequest\u2460\u24ea"},{"id":"ref-for-writablestream-pendingabortrequest\u2460\u2460"},{"id":"ref-for-writablestream-pendingabortrequest\u2460\u2461"},{"id":"ref-for-writablestream-pendingabortrequest\u2460\u2462"}],"title":"5.5.2. Interfacing with controllers"}],"url":"#writablestream-pendingabortrequest"}, "writablestream-set-up": {"dfnID":"writablestream-set-up","dfnText":"set up","external":false,"refSections":[{"refs":[{"id":"ref-for-writablestream-set-up"},{"id":"ref-for-writablestream-set-up\u2460"},{"id":"ref-for-writablestream-set-up\u2461"},{"id":"ref-for-writablestream-set-up\u2462"}],"title":"9.2.1. Creation and manipulation"}],"url":"#writablestream-set-up"}, "writablestream-set-up-abortalgorithm": {"dfnID":"writablestream-set-up-abortalgorithm","dfnText":"abortAlgorithm","external":false,"refSections":[],"url":"#writablestream-set-up-abortalgorithm"}, "writablestream-set-up-closealgorithm": {"dfnID":"writablestream-set-up-closealgorithm","dfnText":"closeAlgorithm","external":false,"refSections":[],"url":"#writablestream-set-up-closealgorithm"}, "writablestream-set-up-highwatermark": {"dfnID":"writablestream-set-up-highwatermark","dfnText":"highWaterMark","external":false,"refSections":[],"url":"#writablestream-set-up-highwatermark"}, "writablestream-set-up-sizealgorithm": {"dfnID":"writablestream-set-up-sizealgorithm","dfnText":"sizeAlgorithm","external":false,"refSections":[],"url":"#writablestream-set-up-sizealgorithm"}, "writablestream-set-up-writealgorithm": {"dfnID":"writablestream-set-up-writealgorithm","dfnText":"writeAlgorithm","external":false,"refSections":[{"refs":[{"id":"ref-for-writablestream-set-up-writealgorithm"},{"id":"ref-for-writablestream-set-up-writealgorithm\u2460"}],"title":"9.2.1. Creation and manipulation"}],"url":"#writablestream-set-up-writealgorithm"}, "writablestream-signal": {"dfnID":"writablestream-signal","dfnText":"signal","external":false,"refSections":[{"refs":[{"id":"ref-for-writablestream-signal"},{"id":"ref-for-writablestream-signal\u2460"}],"title":"9.2.1. Creation and manipulation"}],"url":"#writablestream-signal"}, "writablestream-state": {"dfnID":"writablestream-state","dfnText":"[[state]]","external":false,"refSections":[{"refs":[{"id":"ref-for-writablestream-state"},{"id":"ref-for-writablestream-state\u2460"},{"id":"ref-for-writablestream-state\u2461"},{"id":"ref-for-writablestream-state\u2462"},{"id":"ref-for-writablestream-state\u2463"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-writablestream-state\u2464"}],"title":"5.4.3. Methods and properties"},{"refs":[{"id":"ref-for-writablestream-state\u2465"},{"id":"ref-for-writablestream-state\u2466"},{"id":"ref-for-writablestream-state\u2467"},{"id":"ref-for-writablestream-state\u2468"},{"id":"ref-for-writablestream-state\u2460\u24ea"}],"title":"5.5.1. Working with writable streams"},{"refs":[{"id":"ref-for-writablestream-state\u2460\u2460"},{"id":"ref-for-writablestream-state\u2460\u2461"},{"id":"ref-for-writablestream-state\u2460\u2462"},{"id":"ref-for-writablestream-state\u2460\u2463"},{"id":"ref-for-writablestream-state\u2460\u2464"},{"id":"ref-for-writablestream-state\u2460\u2465"},{"id":"ref-for-writablestream-state\u2460\u2466"},{"id":"ref-for-writablestream-state\u2460\u2467"},{"id":"ref-for-writablestream-state\u2460\u2468"},{"id":"ref-for-writablestream-state\u2461\u24ea"},{"id":"ref-for-writablestream-state\u2461\u2460"},{"id":"ref-for-writablestream-state\u2461\u2461"},{"id":"ref-for-writablestream-state\u2461\u2462"}],"title":"5.5.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-writablestream-state\u2461\u2463"},{"id":"ref-for-writablestream-state\u2461\u2464"},{"id":"ref-for-writablestream-state\u2461\u2465"}],"title":"5.5.3. Writers"},{"refs":[{"id":"ref-for-writablestream-state\u2461\u2466"},{"id":"ref-for-writablestream-state\u2461\u2467"},{"id":"ref-for-writablestream-state\u2461\u2468"},{"id":"ref-for-writablestream-state\u2462\u24ea"},{"id":"ref-for-writablestream-state\u2462\u2460"},{"id":"ref-for-writablestream-state\u2462\u2461"},{"id":"ref-for-writablestream-state\u2462\u2462"},{"id":"ref-for-writablestream-state\u2462\u2463"},{"id":"ref-for-writablestream-state\u2462\u2464"}],"title":"5.5.4. Default controllers"},{"refs":[{"id":"ref-for-writablestream-state\u2462\u2465"},{"id":"ref-for-writablestream-state\u2462\u2466"}],"title":"6.4.3. Default sinks"},{"refs":[{"id":"ref-for-writablestream-state\u2462\u2467"}],"title":"6.4.4. Default sources"}],"url":"#writablestream-state"}, "writablestream-storederror": {"dfnID":"writablestream-storederror","dfnText":"[[storedError]]","external":false,"refSections":[{"refs":[{"id":"ref-for-writablestream-storederror"},{"id":"ref-for-writablestream-storederror\u2460"},{"id":"ref-for-writablestream-storederror\u2461"}],"title":"4.9.1. Working with readable streams"},{"refs":[{"id":"ref-for-writablestream-storederror\u2462"},{"id":"ref-for-writablestream-storederror\u2463"},{"id":"ref-for-writablestream-storederror\u2464"}],"title":"5.5.1. Working with writable streams"},{"refs":[{"id":"ref-for-writablestream-storederror\u2465"},{"id":"ref-for-writablestream-storederror\u2466"},{"id":"ref-for-writablestream-storederror\u2467"},{"id":"ref-for-writablestream-storederror\u2468"},{"id":"ref-for-writablestream-storederror\u2460\u24ea"},{"id":"ref-for-writablestream-storederror\u2460\u2460"},{"id":"ref-for-writablestream-storederror\u2460\u2461"}],"title":"5.5.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-writablestream-storederror\u2460\u2462"},{"id":"ref-for-writablestream-storederror\u2460\u2463"},{"id":"ref-for-writablestream-storederror\u2460\u2464"}],"title":"5.5.3. Writers"},{"refs":[{"id":"ref-for-writablestream-storederror\u2460\u2465"}],"title":"6.4.3. Default sinks"},{"refs":[{"id":"ref-for-writablestream-storederror\u2460\u2466"}],"title":"6.4.4. Default sources"}],"url":"#writablestream-storederror"}, "writablestream-writer": {"dfnID":"writablestream-writer","dfnText":"[[writer]]","external":false,"refSections":[{"refs":[{"id":"ref-for-writablestream-writer"}],"title":"5.3.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-writablestream-writer\u2460"},{"id":"ref-for-writablestream-writer\u2461"},{"id":"ref-for-writablestream-writer\u2462"},{"id":"ref-for-writablestream-writer\u2463"}],"title":"5.5.1. Working with writable streams"},{"refs":[{"id":"ref-for-writablestream-writer\u2464"},{"id":"ref-for-writablestream-writer\u2465"},{"id":"ref-for-writablestream-writer\u2466"},{"id":"ref-for-writablestream-writer\u2467"}],"title":"5.5.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-writablestream-writer\u2468"},{"id":"ref-for-writablestream-writer\u2460\u24ea"}],"title":"5.5.3. Writers"}],"url":"#writablestream-writer"}, "writablestream-writerequests": {"dfnID":"writablestream-writerequests","dfnText":"[[writeRequests]]","external":false,"refSections":[{"refs":[{"id":"ref-for-writablestream-writerequests"}],"title":"5.2.2. Internal slots"},{"refs":[{"id":"ref-for-writablestream-writerequests\u2460"}],"title":"5.5.1. Working with writable streams"},{"refs":[{"id":"ref-for-writablestream-writerequests\u2461"},{"id":"ref-for-writablestream-writerequests\u2462"},{"id":"ref-for-writablestream-writerequests\u2463"},{"id":"ref-for-writablestream-writerequests\u2464"},{"id":"ref-for-writablestream-writerequests\u2465"},{"id":"ref-for-writablestream-writerequests\u2466"}],"title":"5.5.2. Interfacing with controllers"}],"url":"#writablestream-writerequests"}, "writablestreamdefaultcontroller": {"dfnID":"writablestreamdefaultcontroller","dfnText":"WritableStreamDefaultController","external":false,"refSections":[{"refs":[{"id":"ref-for-writablestreamdefaultcontroller"}],"title":"5.2.2. Internal slots"},{"refs":[{"id":"ref-for-writablestreamdefaultcontroller\u2460"},{"id":"ref-for-writablestreamdefaultcontroller\u2461"},{"id":"ref-for-writablestreamdefaultcontroller\u2462"}],"title":"5.2.3. The underlying sink API"},{"refs":[{"id":"ref-for-writablestreamdefaultcontroller\u2463"},{"id":"ref-for-writablestreamdefaultcontroller\u2464"},{"id":"ref-for-writablestreamdefaultcontroller\u2465"}],"title":"5.4. The WritableStreamDefaultController class"},{"refs":[{"id":"ref-for-writablestreamdefaultcontroller\u2466"}],"title":"5.4.1. Interface definition"},{"refs":[{"id":"ref-for-writablestreamdefaultcontroller\u2467"}],"title":"5.4.2. Internal slots"},{"refs":[{"id":"ref-for-writablestreamdefaultcontroller\u2468"}],"title":"5.4.4. Internal methods"},{"refs":[{"id":"ref-for-writablestreamdefaultcontroller\u2460\u24ea"}],"title":"5.5.1. Working with writable streams"},{"refs":[{"id":"ref-for-writablestreamdefaultcontroller\u2460\u2460"},{"id":"ref-for-writablestreamdefaultcontroller\u2460\u2461"}],"title":"5.5.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-writablestreamdefaultcontroller\u2460\u2462"},{"id":"ref-for-writablestreamdefaultcontroller\u2460\u2463"}],"title":"5.5.4. Default controllers"},{"refs":[{"id":"ref-for-writablestreamdefaultcontroller\u2460\u2464"}],"title":"8.2. Transferable streams"},{"refs":[{"id":"ref-for-writablestreamdefaultcontroller\u2460\u2465"}],"title":"9.2.1. Creation and manipulation"}],"url":"#writablestreamdefaultcontroller"}, "writablestreamdefaultcontroller-abortalgorithm": {"dfnID":"writablestreamdefaultcontroller-abortalgorithm","dfnText":"[[abortAlgorithm]]","external":false,"refSections":[{"refs":[{"id":"ref-for-writablestreamdefaultcontroller-abortalgorithm"}],"title":"5.4.4. Internal methods"},{"refs":[{"id":"ref-for-writablestreamdefaultcontroller-abortalgorithm\u2460"},{"id":"ref-for-writablestreamdefaultcontroller-abortalgorithm\u2461"}],"title":"5.5.4. Default controllers"}],"url":"#writablestreamdefaultcontroller-abortalgorithm"}, "writablestreamdefaultcontroller-abortcontroller": {"dfnID":"writablestreamdefaultcontroller-abortcontroller","dfnText":"[[abortController]]","external":false,"refSections":[{"refs":[{"id":"ref-for-writablestreamdefaultcontroller-abortcontroller"}],"title":"5.4.3. Methods and properties"},{"refs":[{"id":"ref-for-writablestreamdefaultcontroller-abortcontroller\u2460"}],"title":"5.5.1. Working with writable streams"},{"refs":[{"id":"ref-for-writablestreamdefaultcontroller-abortcontroller\u2461"}],"title":"5.5.4. Default controllers"},{"refs":[{"id":"ref-for-writablestreamdefaultcontroller-abortcontroller\u2462"}],"title":"9.2.1. Creation and manipulation"}],"url":"#writablestreamdefaultcontroller-abortcontroller"}, "writablestreamdefaultcontroller-closealgorithm": {"dfnID":"writablestreamdefaultcontroller-closealgorithm","dfnText":"[[closeAlgorithm]]","external":false,"refSections":[{"refs":[{"id":"ref-for-writablestreamdefaultcontroller-closealgorithm"},{"id":"ref-for-writablestreamdefaultcontroller-closealgorithm\u2460"},{"id":"ref-for-writablestreamdefaultcontroller-closealgorithm\u2461"}],"title":"5.5.4. Default controllers"}],"url":"#writablestreamdefaultcontroller-closealgorithm"}, "writablestreamdefaultcontroller-queue": {"dfnID":"writablestreamdefaultcontroller-queue","dfnText":"[[queue]]","external":false,"refSections":[{"refs":[{"id":"ref-for-writablestreamdefaultcontroller-queue"},{"id":"ref-for-writablestreamdefaultcontroller-queue\u2460"}],"title":"5.4.2. Internal slots"},{"refs":[{"id":"ref-for-writablestreamdefaultcontroller-queue\u2461"},{"id":"ref-for-writablestreamdefaultcontroller-queue\u2462"}],"title":"5.5.4. Default controllers"}],"url":"#writablestreamdefaultcontroller-queue"}, "writablestreamdefaultcontroller-queuetotalsize": {"dfnID":"writablestreamdefaultcontroller-queuetotalsize","dfnText":"[[queueTotalSize]]","external":false,"refSections":[{"refs":[{"id":"ref-for-writablestreamdefaultcontroller-queuetotalsize"}],"title":"5.5.4. Default controllers"}],"url":"#writablestreamdefaultcontroller-queuetotalsize"}, "writablestreamdefaultcontroller-started": {"dfnID":"writablestreamdefaultcontroller-started","dfnText":"[[started]]","external":false,"refSections":[{"refs":[{"id":"ref-for-writablestreamdefaultcontroller-started"}],"title":"5.5.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-writablestreamdefaultcontroller-started\u2460"},{"id":"ref-for-writablestreamdefaultcontroller-started\u2461"},{"id":"ref-for-writablestreamdefaultcontroller-started\u2462"},{"id":"ref-for-writablestreamdefaultcontroller-started\u2463"}],"title":"5.5.4. Default controllers"}],"url":"#writablestreamdefaultcontroller-started"}, "writablestreamdefaultcontroller-strategyhwm": {"dfnID":"writablestreamdefaultcontroller-strategyhwm","dfnText":"[[strategyHWM]]","external":false,"refSections":[{"refs":[{"id":"ref-for-writablestreamdefaultcontroller-strategyhwm"},{"id":"ref-for-writablestreamdefaultcontroller-strategyhwm\u2460"}],"title":"5.5.4. Default controllers"}],"url":"#writablestreamdefaultcontroller-strategyhwm"}, "writablestreamdefaultcontroller-strategysizealgorithm": {"dfnID":"writablestreamdefaultcontroller-strategysizealgorithm","dfnText":"[[strategySizeAlgorithm]]","external":false,"refSections":[{"refs":[{"id":"ref-for-writablestreamdefaultcontroller-strategysizealgorithm"},{"id":"ref-for-writablestreamdefaultcontroller-strategysizealgorithm\u2460"},{"id":"ref-for-writablestreamdefaultcontroller-strategysizealgorithm\u2461"},{"id":"ref-for-writablestreamdefaultcontroller-strategysizealgorithm\u2462"}],"title":"5.5.4. Default controllers"}],"url":"#writablestreamdefaultcontroller-strategysizealgorithm"}, "writablestreamdefaultcontroller-stream": {"dfnID":"writablestreamdefaultcontroller-stream","dfnText":"[[stream]]","external":false,"refSections":[{"refs":[{"id":"ref-for-writablestreamdefaultcontroller-stream"}],"title":"5.4.3. Methods and properties"},{"refs":[{"id":"ref-for-writablestreamdefaultcontroller-stream\u2460"},{"id":"ref-for-writablestreamdefaultcontroller-stream\u2461"},{"id":"ref-for-writablestreamdefaultcontroller-stream\u2462"},{"id":"ref-for-writablestreamdefaultcontroller-stream\u2463"},{"id":"ref-for-writablestreamdefaultcontroller-stream\u2464"},{"id":"ref-for-writablestreamdefaultcontroller-stream\u2465"},{"id":"ref-for-writablestreamdefaultcontroller-stream\u2466"},{"id":"ref-for-writablestreamdefaultcontroller-stream\u2467"}],"title":"5.5.4. Default controllers"}],"url":"#writablestreamdefaultcontroller-stream"}, "writablestreamdefaultcontroller-writealgorithm": {"dfnID":"writablestreamdefaultcontroller-writealgorithm","dfnText":"[[writeAlgorithm]]","external":false,"refSections":[{"refs":[{"id":"ref-for-writablestreamdefaultcontroller-writealgorithm"},{"id":"ref-for-writablestreamdefaultcontroller-writealgorithm\u2460"},{"id":"ref-for-writablestreamdefaultcontroller-writealgorithm\u2461"}],"title":"5.5.4. Default controllers"}],"url":"#writablestreamdefaultcontroller-writealgorithm"}, "writablestreamdefaultwriter": {"dfnID":"writablestreamdefaultwriter","dfnText":"WritableStreamDefaultWriter","external":false,"refSections":[{"refs":[{"id":"ref-for-writablestreamdefaultwriter"}],"title":"2.6. Locking"},{"refs":[{"id":"ref-for-writablestreamdefaultwriter\u2460"}],"title":"5.1. Using writable streams"},{"refs":[{"id":"ref-for-writablestreamdefaultwriter\u2461"}],"title":"5.2.1. Interface definition"},{"refs":[{"id":"ref-for-writablestreamdefaultwriter\u2462"}],"title":"5.2.2. Internal slots"},{"refs":[{"id":"ref-for-writablestreamdefaultwriter\u2463"}],"title":"5.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-writablestreamdefaultwriter\u2464"},{"id":"ref-for-writablestreamdefaultwriter\u2465"}],"title":"5.3. The WritableStreamDefaultWriter class"},{"refs":[{"id":"ref-for-writablestreamdefaultwriter\u2466"}],"title":"5.3.1. Interface definition"},{"refs":[{"id":"ref-for-writablestreamdefaultwriter\u2467"}],"title":"5.3.2. Internal slots"},{"refs":[{"id":"ref-for-writablestreamdefaultwriter\u2468"}],"title":"5.5.1. Working with writable streams"},{"refs":[{"id":"ref-for-writablestreamdefaultwriter\u2460\u24ea"}],"title":"5.5.3. Writers"},{"refs":[{"id":"ref-for-writablestreamdefaultwriter\u2460\u2460"},{"id":"ref-for-writablestreamdefaultwriter\u2460\u2461"},{"id":"ref-for-writablestreamdefaultwriter\u2460\u2462"}],"title":"9.2.2. Writing"}],"url":"#writablestreamdefaultwriter"}, "writablestreamdefaultwriter-closedpromise": {"dfnID":"writablestreamdefaultwriter-closedpromise","dfnText":"[[closedPromise]]","external":false,"refSections":[{"refs":[{"id":"ref-for-writablestreamdefaultwriter-closedpromise"}],"title":"5.3.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-writablestreamdefaultwriter-closedpromise\u2460"},{"id":"ref-for-writablestreamdefaultwriter-closedpromise\u2461"},{"id":"ref-for-writablestreamdefaultwriter-closedpromise\u2462"},{"id":"ref-for-writablestreamdefaultwriter-closedpromise\u2463"},{"id":"ref-for-writablestreamdefaultwriter-closedpromise\u2464"}],"title":"5.5.1. Working with writable streams"},{"refs":[{"id":"ref-for-writablestreamdefaultwriter-closedpromise\u2465"},{"id":"ref-for-writablestreamdefaultwriter-closedpromise\u2466"},{"id":"ref-for-writablestreamdefaultwriter-closedpromise\u2467"}],"title":"5.5.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-writablestreamdefaultwriter-closedpromise\u2468"},{"id":"ref-for-writablestreamdefaultwriter-closedpromise\u2460\u24ea"},{"id":"ref-for-writablestreamdefaultwriter-closedpromise\u2460\u2460"},{"id":"ref-for-writablestreamdefaultwriter-closedpromise\u2460\u2461"}],"title":"5.5.3. Writers"}],"url":"#writablestreamdefaultwriter-closedpromise"}, "writablestreamdefaultwriter-readypromise": {"dfnID":"writablestreamdefaultwriter-readypromise","dfnText":"[[readyPromise]]","external":false,"refSections":[{"refs":[{"id":"ref-for-writablestreamdefaultwriter-readypromise"}],"title":"5.3.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-writablestreamdefaultwriter-readypromise\u2460"},{"id":"ref-for-writablestreamdefaultwriter-readypromise\u2461"},{"id":"ref-for-writablestreamdefaultwriter-readypromise\u2462"},{"id":"ref-for-writablestreamdefaultwriter-readypromise\u2463"},{"id":"ref-for-writablestreamdefaultwriter-readypromise\u2464"},{"id":"ref-for-writablestreamdefaultwriter-readypromise\u2465"},{"id":"ref-for-writablestreamdefaultwriter-readypromise\u2466"},{"id":"ref-for-writablestreamdefaultwriter-readypromise\u2467"}],"title":"5.5.1. Working with writable streams"},{"refs":[{"id":"ref-for-writablestreamdefaultwriter-readypromise\u2468"},{"id":"ref-for-writablestreamdefaultwriter-readypromise\u2460\u24ea"}],"title":"5.5.2. Interfacing with controllers"},{"refs":[{"id":"ref-for-writablestreamdefaultwriter-readypromise\u2460\u2460"},{"id":"ref-for-writablestreamdefaultwriter-readypromise\u2460\u2461"},{"id":"ref-for-writablestreamdefaultwriter-readypromise\u2460\u2462"},{"id":"ref-for-writablestreamdefaultwriter-readypromise\u2460\u2463"}],"title":"5.5.3. Writers"}],"url":"#writablestreamdefaultwriter-readypromise"}, "writablestreamdefaultwriter-release": {"dfnID":"writablestreamdefaultwriter-release","dfnText":"release","external":false,"refSections":[],"url":"#writablestreamdefaultwriter-release"}, "writablestreamdefaultwriter-stream": {"dfnID":"writablestreamdefaultwriter-stream","dfnText":"[[stream]]","external":false,"refSections":[{"refs":[{"id":"ref-for-writablestreamdefaultwriter-stream"},{"id":"ref-for-writablestreamdefaultwriter-stream\u2460"},{"id":"ref-for-writablestreamdefaultwriter-stream\u2461"},{"id":"ref-for-writablestreamdefaultwriter-stream\u2462"},{"id":"ref-for-writablestreamdefaultwriter-stream\u2463"}],"title":"5.3.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-writablestreamdefaultwriter-stream\u2464"}],"title":"5.5.1. Working with writable streams"},{"refs":[{"id":"ref-for-writablestreamdefaultwriter-stream\u2465"},{"id":"ref-for-writablestreamdefaultwriter-stream\u2466"},{"id":"ref-for-writablestreamdefaultwriter-stream\u2467"},{"id":"ref-for-writablestreamdefaultwriter-stream\u2468"},{"id":"ref-for-writablestreamdefaultwriter-stream\u2460\u24ea"},{"id":"ref-for-writablestreamdefaultwriter-stream\u2460\u2460"},{"id":"ref-for-writablestreamdefaultwriter-stream\u2460\u2461"},{"id":"ref-for-writablestreamdefaultwriter-stream\u2460\u2462"}],"title":"5.5.3. Writers"}],"url":"#writablestreamdefaultwriter-stream"}, "writablestreamdefaultwriter-write-a-chunk": {"dfnID":"writablestreamdefaultwriter-write-a-chunk","dfnText":"write a chunk","external":false,"refSections":[],"url":"#writablestreamdefaultwriter-write-a-chunk"}, "writer": {"dfnID":"writer","dfnText":"writable stream writer","external":false,"refSections":[{"refs":[{"id":"ref-for-writer"}],"title":"1. Introduction"},{"refs":[{"id":"ref-for-writer\u2460"},{"id":"ref-for-writer\u2461"}],"title":"5.1. Using writable streams"},{"refs":[{"id":"ref-for-writer\u2462"}],"title":"5.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-writer\u2463"}],"title":"5.3. The WritableStreamDefaultWriter class"},{"refs":[{"id":"ref-for-writer\u2464"}],"title":"6.1. Using transform streams"},{"refs":[{"id":"ref-for-writer\u2465"}],"title":"10.6. A writable stream with no backpressure or success signals"}],"url":"#writer"}, "ws-abort": {"dfnID":"ws-abort","dfnText":"abort(reason)","external":false,"refSections":[{"refs":[{"id":"ref-for-ws-abort"}],"title":"2.2. Writable streams"},{"refs":[{"id":"ref-for-ws-abort\u2460"}],"title":"5.2.1. Interface definition"},{"refs":[{"id":"ref-for-ws-abort\u2461"}],"title":"5.2.3. The underlying sink API"},{"refs":[{"id":"ref-for-ws-abort\u2462"}],"title":"5.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-ws-abort\u2463"}],"title":"5.3.3. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-ws-abort\u2464"}],"title":"6.2.3. The transformer API"},{"refs":[{"id":"ref-for-ws-abort\u2465"}],"title":"10.11. Using an identity transform stream as a primitive to\ncreate new readable streams"}],"url":"#ws-abort"}, "ws-close": {"dfnID":"ws-close","dfnText":"close()","external":false,"refSections":[{"refs":[{"id":"ref-for-ws-close"}],"title":"5.2.1. Interface definition"},{"refs":[{"id":"ref-for-ws-close\u2460"}],"title":"5.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-ws-close\u2461"}],"title":"5.3.3. Constructor, methods, and properties"}],"url":"#ws-close"}, "ws-constructor": {"dfnID":"ws-constructor","dfnText":"new WritableStream(underlyingSink, strategy)","external":false,"refSections":[{"refs":[{"id":"ref-for-ws-constructor"}],"title":"2.2. Writable streams"},{"refs":[{"id":"ref-for-ws-constructor\u2460"}],"title":"5.2.1. Interface definition"},{"refs":[{"id":"ref-for-ws-constructor\u2461"},{"id":"ref-for-ws-constructor\u2462"}],"title":"5.2.3. The underlying sink API"},{"refs":[{"id":"ref-for-ws-constructor\u2463"}],"title":"5.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-ws-constructor\u2464"}],"title":"7.1. The queuing strategy API"}],"url":"#ws-constructor"}, "ws-default-controller-error": {"dfnID":"ws-default-controller-error","dfnText":"error(e)","external":false,"refSections":[{"refs":[{"id":"ref-for-ws-default-controller-error"}],"title":"5.4.1. Interface definition"},{"refs":[{"id":"ref-for-ws-default-controller-error\u2460"}],"title":"5.4.3. Methods and properties"}],"url":"#ws-default-controller-error"}, "ws-default-controller-private-abort": {"dfnID":"ws-default-controller-private-abort","dfnText":"[[AbortSteps]](reason)","external":false,"refSections":[],"url":"#ws-default-controller-private-abort"}, "ws-default-controller-private-error": {"dfnID":"ws-default-controller-private-error","dfnText":"[[ErrorSteps]]()","external":false,"refSections":[],"url":"#ws-default-controller-private-error"}, "ws-default-controller-signal": {"dfnID":"ws-default-controller-signal","dfnText":"signal","external":false,"refSections":[{"refs":[{"id":"ref-for-ws-default-controller-signal"}],"title":"5.4.1. Interface definition"},{"refs":[{"id":"ref-for-ws-default-controller-signal\u2460"}],"title":"5.4.3. Methods and properties"}],"url":"#ws-default-controller-signal"}, "ws-get-writer": {"dfnID":"ws-get-writer","dfnText":"getWriter()","external":false,"refSections":[{"refs":[{"id":"ref-for-ws-get-writer"}],"title":"5.2.1. Interface definition"},{"refs":[{"id":"ref-for-ws-get-writer\u2460"}],"title":"5.2.4. Constructor, methods, and properties"},{"refs":[{"id":"ref-for-ws-get-writer\u2461"}],"title":"5.3.3. Constructor, methods, and properties"}],"url":"#ws-get-writer"}, "ws-locked": {"dfnID":"ws-locked","dfnText":"locked","external":false,"refSections":[{"refs":[{"id":"ref-for-ws-locked"}],"title":"2.6. Locking"},{"refs":[{"id":"ref-for-ws-locked\u2460"}],"title":"5.2.1. Interface definition"},{"refs":[{"id":"ref-for-ws-locked\u2461"}],"title":"5.2.4. Constructor, methods, and properties"}],"url":"#ws-locked"}, }; document.addEventListener("DOMContentLoaded", ()=>{ genAllDfnPanels(); document.body.addEventListener("click", (e) => { // If not handled already, just hide all dfn panels. hideAllDfnPanels(); }); }); window.addEventListener("resize", () => { // Pin any visible dfn panel queryAll(".dfn-panel.on, .dfn-panel.activated").forEach(el=>positionDfnPanel(el)); }); function genAllDfnPanels() { for(const panelData of Object.values(dfnPanelData)) { const dfnID = panelData.dfnID; const dfn = document.getElementById(dfnID); if(!dfn) { console.log(`Can't find dfn#${dfnID}.`, panelData); continue; } dfn.panelData = panelData; insertDfnPopupAction(dfn); } } function genDfnPanel(dfn, { dfnID, url, dfnText, refSections, external }) { const dfnPanel = mk.aside({ class: "dfn-panel on", id: `infopanel-for-${dfnID}`, "data-for": dfnID, "aria-labelled-by":`infopaneltitle-for-${dfnID}`, }, mk.span({id:`infopaneltitle-for-${dfnID}`, style:"display:none"}, `Info about the '${dfnText}' ${external?"external":""} reference.`), mk.a({href:url, class:"dfn-link"}, url), refSections.length == 0 ? [] : mk.b({}, "Referenced in:"), mk.ul({}, ...refSections.map(section=> mk.li({}, ...section.refs.map((ref, refI)=> [ mk.a({ href: `#${ref.id}` }, (refI == 0) ? section.title : `(${refI + 1})` ), " ", ] ), ), ), ), genLinkingSyntaxes(dfn), ); dfnPanel.addEventListener('click', (event) => { if (event.target.nodeName == 'A') { scrollToTargetAndHighlight(event); pinDfnPanel(dfnPanel); } event.stopPropagation(); refocusOnTarget(event); }); dfnPanel.addEventListener('keydown', (event) => { if(event.keyCode == 27) { // Escape key hideDfnPanel({dfnPanel}); event.stopPropagation(); event.preventDefault(); } }); dfnPanel.dfn = dfn; dfn.dfnPanel = dfnPanel; return dfnPanel; } function hideAllDfnPanels() { // Delete the currently-active dfn panel. queryAll(".dfn-panel").forEach(dfnPanel=>hideDfnPanel({dfnPanel})); } function showDfnPanel(dfn) { hideAllDfnPanels(); // Only display one at a time. dfn.setAttribute("aria-expanded", "true"); const dfnPanel = genDfnPanel(dfn, dfn.panelData); // Give the dfn a unique tabindex, and then // give all the tabbable panel bits successive indexes. let tabIndex = 100; dfn.tabIndex = tabIndex++; const tabbable = dfnPanel.querySelectorAll(":is(a, button)"); for (const el of tabbable) { el.tabIndex = tabIndex++; } append(document.body, dfnPanel); positionDfnPanel(dfnPanel); } function positionDfnPanel(dfnPanel) { const dfn = dfnPanel.dfn; const dfnPos = getBounds(dfn); dfnPanel.style.top = dfnPos.bottom + "px"; dfnPanel.style.left = dfnPos.left + "px"; const panelPos = dfnPanel.getBoundingClientRect(); const panelMargin = 8; const maxRight = document.body.parentNode.clientWidth - panelMargin; if (panelPos.right > maxRight) { const overflowAmount = panelPos.right - maxRight; const newLeft = Math.max(panelMargin, dfnPos.left - overflowAmount); dfnPanel.style.left = newLeft + "px"; } } function pinDfnPanel(dfnPanel) { // Switch it to "activated" state, which pins it. dfnPanel.classList.add("activated"); dfnPanel.style.position = "fixed"; dfnPanel.style.left = null; dfnPanel.style.top = null; } function hideDfnPanel({dfn, dfnPanel}) { if(!dfnPanel) dfnPanel = dfn.dfnPanel; if(!dfn) dfn = dfnPanel.dfn; dfn.dfnPanel = undefined; dfnPanel.dfn = undefined; dfn.setAttribute("aria-expanded", "false"); dfn.tabIndex = undefined; dfnPanel.remove() } function toggleDfnPanel(dfn) { if(dfn.dfnPanel) { hideDfnPanel(dfn); } else { showDfnPanel(dfn); } } function insertDfnPopupAction(dfn) { dfn.setAttribute('role', 'button'); dfn.setAttribute('aria-expanded', 'false') dfn.tabIndex = 0; dfn.classList.add('has-dfn-panel'); dfn.addEventListener('click', (event) => { toggleDfnPanel(dfn); event.stopPropagation(); }); dfn.addEventListener('keypress', (event) => { const kc = event.keyCode; // 32->Space, 13->Enter if(kc == 32 || kc == 13) { toggleDfnPanel(dfn); event.stopPropagation(); event.preventDefault(); } }); } function refocusOnTarget(event) { const target = event.target; setTimeout(() => { // Refocus on the event.target element. // This is needed after browser scrolls to the destination. target.focus(); }); } // TODO: shared util // Returns the root-level absolute position {left and top} of element. function getBounds(el, relativeTo=document.body) { const relativeRect = relativeTo.getBoundingClientRect(); const elRect = el.getBoundingClientRect(); const top = elRect.top - relativeRect.top; const left = elRect.left - relativeRect.left; return { top, left, bottom: top + elRect.height, right: left + elRect.width, } } function scrollToTargetAndHighlight(event) { let hash = event.target.hash; if (hash) { hash = decodeURIComponent(hash.substring(1)); const dest = document.getElementById(hash); if (dest) { dest.classList.add('highlighted'); setTimeout(() => dest.classList.remove('highlighted'), 1000); } } } // Functions, divided by link type, that wrap an autolink's // contents with the appropriate outer syntax. // Alternately, a string naming another type they format // the same as. function needsFor(type) { switch(type) { case "descriptor": case "value": case "element-attr": case "attr-value": case "element-state": case "method": case "constructor": case "argument": case "attribute": case "const": case "dict-member": case "event": case "enum-value": case "stringifier": case "serializer": case "iterator": case "maplike": case "setlike": case "state": case "mode": case "context": case "facet": return true; default: return false; } } function refusesFor(type) { switch(type) { case "property": case "element": case "interface": case "namespace": case "callback": case "dictionary": case "enum": case "exception": case "typedef": case "http-header": case "permission": return true; default: return false; } } function linkFormatterFromType(type) { switch(type) { case 'scheme': case 'permission': case 'dfn': return (text) => `[=${text}=]`; case 'abstract-op': return (text) => `[\$${text}\$]`; case 'function': case 'at-rule': case 'selector': case 'value': return (text) => `''${text}''`; case 'http-header': return (text) => `[:${text}:]`; case 'interface': case 'constructor': case 'method': case 'argument': case 'attribute': case 'callback': case 'dictionary': case 'dict-member': case 'enum': case 'enum-value': case 'exception': case 'const': case 'typedef': case 'stringifier': case 'serializer': case 'iterator': case 'maplike': case 'setlike': case 'extended-attribute': case 'event': case 'idl': return (text) => `{{${text}}}`; case 'element-state': case 'element-attr': case 'attr-value': case 'element': return (element) => `<{${element}}>`; case 'grammar': return (text) => `${text} (within a <pre class=prod>)`; case 'type': return (text)=> `<<${text}>>`; case 'descriptor': case 'property': return (text) => `'${text}'`; default: return; }; }; function genLinkingSyntaxes(dfn) { if(dfn.tagName != "DFN") return; const type = dfn.getAttribute('data-dfn-type'); if(!type) { console.log(`<dfn> doesn't have a data-dfn-type:`, dfn); return []; } // Return a function that wraps link text based on the type const linkFormatter = linkFormatterFromType(type); if(!linkFormatter) { console.log(`<dfn> has an unknown data-dfn-type:`, dfn); return []; } let ltAlts; if(dfn.hasAttribute('data-lt')) { ltAlts = dfn.getAttribute('data-lt') .split("|") .map(x=>x.trim()); } else { ltAlts = [dfn.textContent.trim()]; } if(type == "type") { // lt of "<foo>", but "foo" is the interior; // <<foo/bar>> is how you write it with a for, // not <foo/<bar>> or whatever. for(var i = 0; i < ltAlts.length; i++) { const lt = ltAlts[i]; const match = /<(.*)>/.exec(lt); if(match) { ltAlts[i] = match[1]; } } } let forAlts; if(dfn.hasAttribute('data-dfn-for')) { forAlts = dfn.getAttribute('data-dfn-for') .split(",") .map(x=>x.trim()); } else { forAlts = ['']; } let linkingSyntaxes = []; if(!needsFor(type)) { for(const lt of ltAlts) { linkingSyntaxes.push(linkFormatter(lt)); } } if(!refusesFor(type)) { for(const f of forAlts) { linkingSyntaxes.push(linkFormatter(`${f}/${ltAlts[0]}`)) } } return [ mk.b({}, 'Possible linking syntaxes:'), mk.ul({}, ...linkingSyntaxes.map(link => { const copyLink = async () => await navigator.clipboard.writeText(link); return mk.li({}, mk.div({ class: 'link-item' }, mk.button({ class: 'copy-icon', title: 'Copy', type: 'button', _onclick: copyLink, tabindex: 0, }, mk.span({ class: 'icon' }) ), mk.span({}, link) ) ); }) ) ]; } } </script> <script>/* Boilerplate: script-position-annos */ "use strict"; { function repositionAnnoPanels(){ const panels = [...document.querySelectorAll("[data-anno-for]")]; hydratePanels(panels); let vSoFar = 0; for(const panel of panels.sort(cmpTops)) { if(panel.top < vSoFar) { panel.top = vSoFar; panel.style.top = vSoFar + "px"; } vSoFar = panel.top + panel.height + 15; } } function hydratePanels(panels) { const main = document.querySelector("main"); let mainRect; if(main) mainRect = main.getBoundingClientRect(); // First display them all, if they're not already visible. for(const panel of panels) { panel.classList.remove("unpositioned"); } // Measure them all for(const panel of panels) { const dfn = document.getElementById(panel.getAttribute("data-anno-for")); if(!dfn) { console.log("Can't find the annotation panel target:", panel); continue; } panel.dfn = dfn; panel.top = window.scrollY + dfn.getBoundingClientRect().top; let panelRect = panel.getBoundingClientRect(); panel.height = panelRect.height; if(main) { panel.overlappingMain = panelRect.left < mainRect.right; } else { panel.overlappingMain = false; } } // And finally position them for(const panel of panels) { const dfn = panel.dfn; if(!dfn) continue; panel.style.top = panel.top + "px"; panel.classList.toggle("overlapping-main", panel.overlappingMain); } } function cmpTops(a,b) { return a.top - b.top; } window.addEventListener("load", repositionAnnoPanels); window.addEventListener("resize", repositionAnnoPanels); } </script> <script>/* Boilerplate: script-ref-hints */ "use strict"; { let refsData = { "#abort-a-writable-stream": {"displayText":"abort a writable stream","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"abort a writable stream","type":"dfn","url":"#abort-a-writable-stream"}, "#abstract-opdef-cancopydatablockbytes": {"displayText":"CanCopyDataBlockBytes","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"CanCopyDataBlockBytes","type":"abstract-op","url":"#abstract-opdef-cancopydatablockbytes"}, "#abstract-opdef-cloneasuint8array": {"displayText":"CloneAsUint8Array","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"CloneAsUint8Array","type":"abstract-op","url":"#abstract-opdef-cloneasuint8array"}, "#abstract-opdef-createreadablebytestream": {"displayText":"CreateReadableByteStream","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"CreateReadableByteStream","type":"abstract-op","url":"#abstract-opdef-createreadablebytestream"}, "#abstract-opdef-crossrealmtransformsenderror": {"displayText":"CrossRealmTransformSendError","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"CrossRealmTransformSendError","type":"abstract-op","url":"#abstract-opdef-crossrealmtransformsenderror"}, "#abstract-opdef-packandpostmessage": {"displayText":"PackAndPostMessage","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"PackAndPostMessage","type":"abstract-op","url":"#abstract-opdef-packandpostmessage"}, "#abstract-opdef-packandpostmessagehandlingerror": {"displayText":"PackAndPostMessageHandlingError","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"PackAndPostMessageHandlingError","type":"abstract-op","url":"#abstract-opdef-packandpostmessagehandlingerror"}, "#abstract-opdef-readablebytestreamcontrollerenqueueclonedchunktoqueue": {"displayText":"ReadableByteStreamControllerEnqueueClonedChunkToQueue","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableByteStreamControllerEnqueueClonedChunkToQueue","type":"abstract-op","url":"#abstract-opdef-readablebytestreamcontrollerenqueueclonedchunktoqueue"}, "#abstract-opdef-readablebytestreamcontrollerenqueuedetachedpullintotoqueue": {"displayText":"ReadableByteStreamControllerEnqueueDetachedPullIntoToQueue","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableByteStreamControllerEnqueueDetachedPullIntoToQueue","type":"abstract-op","url":"#abstract-opdef-readablebytestreamcontrollerenqueuedetachedpullintotoqueue"}, "#abstract-opdef-readablebytestreamcontrollerfillreadrequestfromqueue": {"displayText":"ReadableByteStreamControllerFillReadRequestFromQueue","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableByteStreamControllerFillReadRequestFromQueue","type":"abstract-op","url":"#abstract-opdef-readablebytestreamcontrollerfillreadrequestfromqueue"}, "#abstract-opdef-readablebytestreamcontrollergetbyobrequest": {"displayText":"ReadableByteStreamControllerGetBYOBRequest","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableByteStreamControllerGetBYOBRequest","type":"abstract-op","url":"#abstract-opdef-readablebytestreamcontrollergetbyobrequest"}, "#abstract-opdef-readablebytestreamcontrollerprocessreadrequestsusingqueue": {"displayText":"ReadableByteStreamControllerProcessReadRequestsUsingQueue","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableByteStreamControllerProcessReadRequestsUsingQueue","type":"abstract-op","url":"#abstract-opdef-readablebytestreamcontrollerprocessreadrequestsusingqueue"}, "#abstract-opdef-readablebytestreamtee": {"displayText":"ReadableByteStreamTee","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableByteStreamTee","type":"abstract-op","url":"#abstract-opdef-readablebytestreamtee"}, "#abstract-opdef-readablestreambyobreadererrorreadintorequests": {"displayText":"ReadableStreamBYOBReaderErrorReadIntoRequests","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStreamBYOBReaderErrorReadIntoRequests","type":"abstract-op","url":"#abstract-opdef-readablestreambyobreadererrorreadintorequests"}, "#abstract-opdef-readablestreambyobreaderrelease": {"displayText":"ReadableStreamBYOBReaderRelease","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStreamBYOBReaderRelease","type":"abstract-op","url":"#abstract-opdef-readablestreambyobreaderrelease"}, "#abstract-opdef-readablestreamcontroller-cancelsteps": {"displayText":"[[CancelSteps]]","export":true,"for_":["ReadableStreamController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[CancelSteps]]","type":"abstract-op","url":"#abstract-opdef-readablestreamcontroller-cancelsteps"}, "#abstract-opdef-readablestreamcontroller-pullsteps": {"displayText":"[[PullSteps]]","export":true,"for_":["ReadableStreamController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[PullSteps]]","type":"abstract-op","url":"#abstract-opdef-readablestreamcontroller-pullsteps"}, "#abstract-opdef-readablestreamcontroller-releasesteps": {"displayText":"[[ReleaseSteps]]","export":true,"for_":["ReadableStreamController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[ReleaseSteps]]","type":"abstract-op","url":"#abstract-opdef-readablestreamcontroller-releasesteps"}, "#abstract-opdef-readablestreamdefaultreadererrorreadrequests": {"displayText":"ReadableStreamDefaultReaderErrorReadRequests","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStreamDefaultReaderErrorReadRequests","type":"abstract-op","url":"#abstract-opdef-readablestreamdefaultreadererrorreadrequests"}, "#abstract-opdef-readablestreamdefaultreaderrelease": {"displayText":"ReadableStreamDefaultReaderRelease","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStreamDefaultReaderRelease","type":"abstract-op","url":"#abstract-opdef-readablestreamdefaultreaderrelease"}, "#abstract-opdef-readablestreamdefaulttee": {"displayText":"ReadableStreamDefaultTee","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStreamDefaultTee","type":"abstract-op","url":"#abstract-opdef-readablestreamdefaulttee"}, "#abstract-opdef-setupcrossrealmtransformreadable": {"displayText":"SetUpCrossRealmTransformReadable","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"SetUpCrossRealmTransformReadable","type":"abstract-op","url":"#abstract-opdef-setupcrossrealmtransformreadable"}, "#abstract-opdef-setupcrossrealmtransformwritable": {"displayText":"SetUpCrossRealmTransformWritable","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"SetUpCrossRealmTransformWritable","type":"abstract-op","url":"#abstract-opdef-setupcrossrealmtransformwritable"}, "#abstract-opdef-structuredclone": {"displayText":"StructuredClone","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"StructuredClone","type":"abstract-op","url":"#abstract-opdef-structuredclone"}, "#abstract-opdef-writablestreamcontroller-abortsteps": {"displayText":"[[AbortSteps]]","export":true,"for_":["WritableStreamController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[AbortSteps]]","type":"abstract-op","url":"#abstract-opdef-writablestreamcontroller-abortsteps"}, "#abstract-opdef-writablestreamcontroller-errorsteps": {"displayText":"[[ErrorSteps]]","export":true,"for_":["WritableStreamController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[ErrorSteps]]","type":"abstract-op","url":"#abstract-opdef-writablestreamcontroller-errorsteps"}, "#acquire-readable-stream-byob-reader": {"displayText":"AcquireReadableStreamBYOBReader","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"AcquireReadableStreamBYOBReader","type":"abstract-op","url":"#acquire-readable-stream-byob-reader"}, "#acquire-readable-stream-reader": {"displayText":"AcquireReadableStreamDefaultReader","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"AcquireReadableStreamDefaultReader","type":"abstract-op","url":"#acquire-readable-stream-reader"}, "#acquire-writable-stream-default-writer": {"displayText":"AcquireWritableStreamDefaultWriter","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"AcquireWritableStreamDefaultWriter","type":"abstract-op","url":"#acquire-writable-stream-default-writer"}, "#active": {"displayText":"active reader","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"active reader","type":"dfn","url":"#active"}, "#backpressure": {"displayText":"backpressure","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"backpressure","type":"dfn","url":"#backpressure"}, "#blqs-constructor": {"displayText":"ByteLengthQueuingStrategy(init)","export":true,"for_":["ByteLengthQueuingStrategy"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ByteLengthQueuingStrategy(init)","type":"constructor","url":"#blqs-constructor"}, "#blqs-high-water-mark": {"displayText":"highWaterMark","export":true,"for_":["ByteLengthQueuingStrategy"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"highWaterMark","type":"attribute","url":"#blqs-high-water-mark"}, "#blqs-size": {"displayText":"size","export":true,"for_":["ByteLengthQueuingStrategy"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"size","type":"attribute","url":"#blqs-size"}, "#branches-of-a-readable-stream-tee": {"displayText":"branches of a readable stream tee","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"branches of a readable stream tee","type":"dfn","url":"#branches-of-a-readable-stream-tee"}, "#byob-reader": {"displayText":"byob reader","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"byob reader","type":"dfn","url":"#byob-reader"}, "#byob-reader-constructor": {"displayText":"ReadableStreamBYOBReader(stream)","export":true,"for_":["ReadableStreamBYOBReader"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStreamBYOBReader(stream)","type":"constructor","url":"#byob-reader-constructor"}, "#byob-reader-read": {"displayText":"read(view)","export":true,"for_":["ReadableStreamBYOBReader"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"read(view)","type":"method","url":"#byob-reader-read"}, "#byob-reader-release-lock": {"displayText":"releaseLock()","export":true,"for_":["ReadableStreamBYOBReader"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"releaseLock()","type":"method","url":"#byob-reader-release-lock"}, "#byte-length-queuing-strategy-size-function": {"displayText":"byte length queuing strategy size function","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"byte length queuing strategy size function","type":"dfn","url":"#byte-length-queuing-strategy-size-function"}, "#bytelengthqueuingstrategy": {"displayText":"ByteLengthQueuingStrategy","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ByteLengthQueuingStrategy","type":"interface","url":"#bytelengthqueuingstrategy"}, "#bytelengthqueuingstrategy-highwatermark": {"displayText":"[[highwatermark]]","export":true,"for_":["ByteLengthQueuingStrategy"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[highwatermark]]","type":"dfn","url":"#bytelengthqueuingstrategy-highwatermark"}, "#callbackdef-queuingstrategysize": {"displayText":"QueuingStrategySize","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"QueuingStrategySize","type":"callback","url":"#callbackdef-queuingstrategysize"}, "#callbackdef-transformercancelcallback": {"displayText":"TransformerCancelCallback","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"TransformerCancelCallback","type":"callback","url":"#callbackdef-transformercancelcallback"}, "#callbackdef-transformerflushcallback": {"displayText":"TransformerFlushCallback","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"TransformerFlushCallback","type":"callback","url":"#callbackdef-transformerflushcallback"}, "#callbackdef-transformerstartcallback": {"displayText":"TransformerStartCallback","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"TransformerStartCallback","type":"callback","url":"#callbackdef-transformerstartcallback"}, "#callbackdef-transformertransformcallback": {"displayText":"TransformerTransformCallback","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"TransformerTransformCallback","type":"callback","url":"#callbackdef-transformertransformcallback"}, "#callbackdef-underlyingsinkabortcallback": {"displayText":"UnderlyingSinkAbortCallback","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"UnderlyingSinkAbortCallback","type":"callback","url":"#callbackdef-underlyingsinkabortcallback"}, "#callbackdef-underlyingsinkclosecallback": {"displayText":"UnderlyingSinkCloseCallback","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"UnderlyingSinkCloseCallback","type":"callback","url":"#callbackdef-underlyingsinkclosecallback"}, "#callbackdef-underlyingsinkstartcallback": {"displayText":"UnderlyingSinkStartCallback","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"UnderlyingSinkStartCallback","type":"callback","url":"#callbackdef-underlyingsinkstartcallback"}, "#callbackdef-underlyingsinkwritecallback": {"displayText":"UnderlyingSinkWriteCallback","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"UnderlyingSinkWriteCallback","type":"callback","url":"#callbackdef-underlyingsinkwritecallback"}, "#callbackdef-underlyingsourcecancelcallback": {"displayText":"UnderlyingSourceCancelCallback","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"UnderlyingSourceCancelCallback","type":"callback","url":"#callbackdef-underlyingsourcecancelcallback"}, "#callbackdef-underlyingsourcepullcallback": {"displayText":"UnderlyingSourcePullCallback","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"UnderlyingSourcePullCallback","type":"callback","url":"#callbackdef-underlyingsourcepullcallback"}, "#callbackdef-underlyingsourcestartcallback": {"displayText":"UnderlyingSourceStartCallback","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"UnderlyingSourceStartCallback","type":"callback","url":"#callbackdef-underlyingsourcestartcallback"}, "#can-transfer-array-buffer": {"displayText":"CanTransferArrayBuffer","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"CanTransferArrayBuffer","type":"abstract-op","url":"#can-transfer-array-buffer"}, "#cancel-a-readable-stream": {"displayText":"cancel a readable stream","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"cancel a readable stream","type":"dfn","url":"#cancel-a-readable-stream"}, "#chunk": {"displayText":"chunk","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"chunk","type":"dfn","url":"#chunk"}, "#close-sentinel": {"displayText":"close sentinel","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"close sentinel","type":"dfn","url":"#close-sentinel"}, "#consumer": {"displayText":"consumer","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"consumer","type":"dfn","url":"#consumer"}, "#count-queuing-strategy-size-function": {"displayText":"count queuing strategy size function","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"count queuing strategy size function","type":"dfn","url":"#count-queuing-strategy-size-function"}, "#countqueuingstrategy": {"displayText":"CountQueuingStrategy","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"CountQueuingStrategy","type":"interface","url":"#countqueuingstrategy"}, "#countqueuingstrategy-highwatermark": {"displayText":"[[highwatermark]]","export":true,"for_":["CountQueuingStrategy"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[highwatermark]]","type":"dfn","url":"#countqueuingstrategy-highwatermark"}, "#cqs-constructor": {"displayText":"CountQueuingStrategy(init)","export":true,"for_":["CountQueuingStrategy"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"CountQueuingStrategy(init)","type":"constructor","url":"#cqs-constructor"}, "#cqs-high-water-mark": {"displayText":"highWaterMark","export":true,"for_":["CountQueuingStrategy"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"highWaterMark","type":"attribute","url":"#cqs-high-water-mark"}, "#cqs-size": {"displayText":"size","export":true,"for_":["CountQueuingStrategy"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"size","type":"attribute","url":"#cqs-size"}, "#create-an-identity-transformstream": {"displayText":"creating an identity transformstream","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"creating an identity transformstream","type":"dfn","url":"#create-an-identity-transformstream"}, "#create-readable-stream": {"displayText":"CreateReadableStream","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"CreateReadableStream","type":"abstract-op","url":"#create-readable-stream"}, "#create-writable-stream": {"displayText":"CreateWritableStream","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"CreateWritableStream","type":"abstract-op","url":"#create-writable-stream"}, "#default-reader": {"displayText":"default reader","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"default reader","type":"dfn","url":"#default-reader"}, "#default-reader-constructor": {"displayText":"ReadableStreamDefaultReader(stream)","export":true,"for_":["ReadableStreamDefaultReader"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStreamDefaultReader(stream)","type":"constructor","url":"#default-reader-constructor"}, "#default-reader-read": {"displayText":"read()","export":true,"for_":["ReadableStreamDefaultReader"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"read()","type":"method","url":"#default-reader-read"}, "#default-reader-release-lock": {"displayText":"releaseLock()","export":true,"for_":["ReadableStreamDefaultReader"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"releaseLock()","type":"method","url":"#default-reader-release-lock"}, "#default-writer-abort": {"displayText":"abort()","export":true,"for_":["WritableStreamDefaultWriter"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"abort()","type":"method","url":"#default-writer-abort"}, "#default-writer-close": {"displayText":"close()","export":true,"for_":["WritableStreamDefaultWriter"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"close()","type":"method","url":"#default-writer-close"}, "#default-writer-closed": {"displayText":"closed","export":true,"for_":["WritableStreamDefaultWriter"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"closed","type":"attribute","url":"#default-writer-closed"}, "#default-writer-constructor": {"displayText":"WritableStreamDefaultWriter(stream)","export":true,"for_":["WritableStreamDefaultWriter"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"WritableStreamDefaultWriter(stream)","type":"constructor","url":"#default-writer-constructor"}, "#default-writer-desired-size": {"displayText":"desiredSize","export":true,"for_":["WritableStreamDefaultWriter"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"desiredSize","type":"attribute","url":"#default-writer-desired-size"}, "#default-writer-ready": {"displayText":"ready","export":true,"for_":["WritableStreamDefaultWriter"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ready","type":"attribute","url":"#default-writer-ready"}, "#default-writer-release-lock": {"displayText":"releaseLock()","export":true,"for_":["WritableStreamDefaultWriter"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"releaseLock()","type":"method","url":"#default-writer-release-lock"}, "#default-writer-write": {"displayText":"write()","export":true,"for_":["WritableStreamDefaultWriter"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"write()","type":"method","url":"#default-writer-write"}, "#dequeue-value": {"displayText":"DequeueValue","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"DequeueValue","type":"abstract-op","url":"#dequeue-value"}, "#desired-size-to-fill-a-streams-internal-queue": {"displayText":"desired size to fill a stream's internal queue","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"desired size to fill a stream's internal queue","type":"dfn","url":"#desired-size-to-fill-a-streams-internal-queue"}, "#dictdef-queuingstrategy": {"displayText":"QueuingStrategy","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"QueuingStrategy","type":"dictionary","url":"#dictdef-queuingstrategy"}, "#dictdef-queuingstrategyinit": {"displayText":"QueuingStrategyInit","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"QueuingStrategyInit","type":"dictionary","url":"#dictdef-queuingstrategyinit"}, "#dictdef-readablestreambyobreaderreadoptions": {"displayText":"ReadableStreamBYOBReaderReadOptions","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStreamBYOBReaderReadOptions","type":"dictionary","url":"#dictdef-readablestreambyobreaderreadoptions"}, "#dictdef-readablestreamgetreaderoptions": {"displayText":"ReadableStreamGetReaderOptions","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStreamGetReaderOptions","type":"dictionary","url":"#dictdef-readablestreamgetreaderoptions"}, "#dictdef-readablestreamiteratoroptions": {"displayText":"ReadableStreamIteratorOptions","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStreamIteratorOptions","type":"dictionary","url":"#dictdef-readablestreamiteratoroptions"}, "#dictdef-readablestreamreadresult": {"displayText":"ReadableStreamReadResult","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStreamReadResult","type":"dictionary","url":"#dictdef-readablestreamreadresult"}, "#dictdef-readablewritablepair": {"displayText":"ReadableWritablePair","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableWritablePair","type":"dictionary","url":"#dictdef-readablewritablepair"}, "#dictdef-streampipeoptions": {"displayText":"StreamPipeOptions","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"StreamPipeOptions","type":"dictionary","url":"#dictdef-streampipeoptions"}, "#dictdef-transformer": {"displayText":"Transformer","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"Transformer","type":"dictionary","url":"#dictdef-transformer"}, "#dictdef-underlyingsink": {"displayText":"UnderlyingSink","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"UnderlyingSink","type":"dictionary","url":"#dictdef-underlyingsink"}, "#dictdef-underlyingsource": {"displayText":"UnderlyingSource","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"UnderlyingSource","type":"dictionary","url":"#dictdef-underlyingsource"}, "#dom-generictransformstream-readable": {"displayText":"readable","export":true,"for_":["GenericTransformStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"readable","type":"attribute","url":"#dom-generictransformstream-readable"}, "#dom-generictransformstream-writable": {"displayText":"writable","export":true,"for_":["GenericTransformStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"writable","type":"attribute","url":"#dom-generictransformstream-writable"}, "#dom-queuingstrategy-highwatermark": {"displayText":"highWaterMark","export":true,"for_":["QueuingStrategy"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"highWaterMark","type":"dict-member","url":"#dom-queuingstrategy-highwatermark"}, "#dom-queuingstrategy-size": {"displayText":"size","export":true,"for_":["QueuingStrategy"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"size","type":"dict-member","url":"#dom-queuingstrategy-size"}, "#dom-queuingstrategyinit-highwatermark": {"displayText":"highWaterMark","export":true,"for_":["QueuingStrategyInit"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"highWaterMark","type":"dict-member","url":"#dom-queuingstrategyinit-highwatermark"}, "#dom-readablestreambyobreaderreadoptions-min": {"displayText":"min","export":true,"for_":["ReadableStreamBYOBReaderReadOptions"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"min","type":"dict-member","url":"#dom-readablestreambyobreaderreadoptions-min"}, "#dom-readablestreamgetreaderoptions-mode": {"displayText":"mode","export":true,"for_":["ReadableStreamGetReaderOptions"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"mode","type":"dict-member","url":"#dom-readablestreamgetreaderoptions-mode"}, "#dom-readablestreamiteratoroptions-preventcancel": {"displayText":"preventCancel","export":true,"for_":["ReadableStreamIteratorOptions"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"preventCancel","type":"dict-member","url":"#dom-readablestreamiteratoroptions-preventcancel"}, "#dom-readablestreamreadermode-byob": {"displayText":"\"byob\"","export":true,"for_":["ReadableStreamReaderMode"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"\"byob\"","type":"enum-value","url":"#dom-readablestreamreadermode-byob"}, "#dom-readablestreamreadresult-done": {"displayText":"done","export":true,"for_":["ReadableStreamReadResult"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"done","type":"dict-member","url":"#dom-readablestreamreadresult-done"}, "#dom-readablestreamreadresult-value": {"displayText":"value","export":true,"for_":["ReadableStreamReadResult"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"value","type":"dict-member","url":"#dom-readablestreamreadresult-value"}, "#dom-readablestreamtype-bytes": {"displayText":"\"bytes\"","export":true,"for_":["ReadableStreamType"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"\"bytes\"","type":"enum-value","url":"#dom-readablestreamtype-bytes"}, "#dom-readablewritablepair-readable": {"displayText":"readable","export":true,"for_":["ReadableWritablePair"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"readable","type":"dict-member","url":"#dom-readablewritablepair-readable"}, "#dom-readablewritablepair-writable": {"displayText":"writable","export":true,"for_":["ReadableWritablePair"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"writable","type":"dict-member","url":"#dom-readablewritablepair-writable"}, "#dom-streampipeoptions-preventabort": {"displayText":"preventAbort","export":true,"for_":["StreamPipeOptions"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"preventAbort","type":"dict-member","url":"#dom-streampipeoptions-preventabort"}, "#dom-streampipeoptions-preventcancel": {"displayText":"preventCancel","export":true,"for_":["StreamPipeOptions"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"preventCancel","type":"dict-member","url":"#dom-streampipeoptions-preventcancel"}, "#dom-streampipeoptions-preventclose": {"displayText":"preventClose","export":true,"for_":["StreamPipeOptions"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"preventClose","type":"dict-member","url":"#dom-streampipeoptions-preventclose"}, "#dom-streampipeoptions-signal": {"displayText":"signal","export":true,"for_":["StreamPipeOptions"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"signal","type":"dict-member","url":"#dom-streampipeoptions-signal"}, "#dom-transformer-cancel": {"displayText":"cancel","export":true,"for_":["Transformer"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"cancel","type":"dict-member","url":"#dom-transformer-cancel"}, "#dom-transformer-flush": {"displayText":"flush","export":true,"for_":["Transformer"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"flush","type":"dict-member","url":"#dom-transformer-flush"}, "#dom-transformer-readabletype": {"displayText":"readableType","export":true,"for_":["Transformer"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"readableType","type":"dict-member","url":"#dom-transformer-readabletype"}, "#dom-transformer-start": {"displayText":"start","export":true,"for_":["Transformer"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"start","type":"dict-member","url":"#dom-transformer-start"}, "#dom-transformer-transform": {"displayText":"transform","export":true,"for_":["Transformer"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"transform","type":"dict-member","url":"#dom-transformer-transform"}, "#dom-transformer-writabletype": {"displayText":"writableType","export":true,"for_":["Transformer"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"writableType","type":"dict-member","url":"#dom-transformer-writabletype"}, "#dom-underlyingsink-abort": {"displayText":"abort","export":true,"for_":["UnderlyingSink"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"abort","type":"dict-member","url":"#dom-underlyingsink-abort"}, "#dom-underlyingsink-close": {"displayText":"close","export":true,"for_":["UnderlyingSink"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"close","type":"dict-member","url":"#dom-underlyingsink-close"}, "#dom-underlyingsink-start": {"displayText":"start","export":true,"for_":["UnderlyingSink"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"start","type":"dict-member","url":"#dom-underlyingsink-start"}, "#dom-underlyingsink-type": {"displayText":"type","export":true,"for_":["UnderlyingSink"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"type","type":"dict-member","url":"#dom-underlyingsink-type"}, "#dom-underlyingsink-write": {"displayText":"write","export":true,"for_":["UnderlyingSink"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"write","type":"dict-member","url":"#dom-underlyingsink-write"}, "#dom-underlyingsource-autoallocatechunksize": {"displayText":"autoAllocateChunkSize","export":true,"for_":["UnderlyingSource"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"autoAllocateChunkSize","type":"dict-member","url":"#dom-underlyingsource-autoallocatechunksize"}, "#dom-underlyingsource-cancel": {"displayText":"cancel","export":true,"for_":["UnderlyingSource"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"cancel","type":"dict-member","url":"#dom-underlyingsource-cancel"}, "#dom-underlyingsource-pull": {"displayText":"pull","export":true,"for_":["UnderlyingSource"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"pull","type":"dict-member","url":"#dom-underlyingsource-pull"}, "#dom-underlyingsource-start": {"displayText":"start","export":true,"for_":["UnderlyingSource"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"start","type":"dict-member","url":"#dom-underlyingsource-start"}, "#dom-underlyingsource-type": {"displayText":"type","export":true,"for_":["UnderlyingSource"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"type","type":"dict-member","url":"#dom-underlyingsource-type"}, "#enqueue-value-with-size": {"displayText":"EnqueueValueWithSize","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"EnqueueValueWithSize","type":"abstract-op","url":"#enqueue-value-with-size"}, "#enumdef-readablestreamreadermode": {"displayText":"ReadableStreamReaderMode","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStreamReaderMode","type":"enum","url":"#enumdef-readablestreamreadermode"}, "#enumdef-readablestreamtype": {"displayText":"ReadableStreamType","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStreamType","type":"enum","url":"#enumdef-readablestreamtype"}, "#generic-reader-cancel": {"displayText":"cancel()","export":true,"for_":["ReadableStreamGenericReader"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"cancel()","type":"method","url":"#generic-reader-cancel"}, "#generic-reader-closed": {"displayText":"closed","export":true,"for_":["ReadableStreamGenericReader"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"closed","type":"attribute","url":"#generic-reader-closed"}, "#generictransformstream": {"displayText":"GenericTransformStream","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"GenericTransformStream","type":"interface","url":"#generictransformstream"}, "#generictransformstream-transform": {"displayText":"transform","export":true,"for_":["GenericTransformStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"transform","type":"dfn","url":"#generictransformstream-transform"}, "#high-water-mark": {"displayText":"high water mark","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"high water mark","type":"dfn","url":"#high-water-mark"}, "#identity-transform-stream": {"displayText":"identity transform stream","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"identity transform stream","type":"dfn","url":"#identity-transform-stream"}, "#initialize-readable-stream": {"displayText":"InitializeReadableStream","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"InitializeReadableStream","type":"abstract-op","url":"#initialize-readable-stream"}, "#initialize-transform-stream": {"displayText":"InitializeTransformStream","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"InitializeTransformStream","type":"abstract-op","url":"#initialize-transform-stream"}, "#initialize-writable-stream": {"displayText":"InitializeWritableStream","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"InitializeWritableStream","type":"abstract-op","url":"#initialize-writable-stream"}, "#internal-queues": {"displayText":"internal queues","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"internal queues","type":"dfn","url":"#internal-queues"}, "#is-non-negative-number": {"displayText":"IsNonNegativeNumber","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"IsNonNegativeNumber","type":"abstract-op","url":"#is-non-negative-number"}, "#is-readable-stream-disturbed": {"displayText":"disturbed","export":true,"for_":["ReadableStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"disturbed","type":"dfn","url":"#is-readable-stream-disturbed"}, "#is-readable-stream-locked": {"displayText":"IsReadableStreamLocked","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"IsReadableStreamLocked","type":"abstract-op","url":"#is-readable-stream-locked"}, "#is-writable-stream-locked": {"displayText":"IsWritableStreamLocked","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"IsWritableStreamLocked","type":"abstract-op","url":"#is-writable-stream-locked"}, "#lock": {"displayText":"locked to a reader","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"locked to a reader","type":"dfn","url":"#lock"}, "#make-size-algorithm-from-size-function": {"displayText":"ExtractSizeAlgorithm","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ExtractSizeAlgorithm","type":"abstract-op","url":"#make-size-algorithm-from-size-function"}, "#original-source": {"displayText":"original source","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"original source","type":"dfn","url":"#original-source"}, "#peek-queue-value": {"displayText":"PeekQueueValue","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"PeekQueueValue","type":"abstract-op","url":"#peek-queue-value"}, "#pending-abort-request": {"displayText":"pending abort request","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"pending abort request","type":"dfn","url":"#pending-abort-request"}, "#pending-abort-request-promise": {"displayText":"promise","export":true,"for_":["pending abort request"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"promise","type":"dfn","url":"#pending-abort-request-promise"}, "#pending-abort-request-reason": {"displayText":"reason","export":true,"for_":["pending abort request"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"reason","type":"dfn","url":"#pending-abort-request-reason"}, "#pending-abort-request-was-already-erroring": {"displayText":"was already erroring","export":true,"for_":["pending abort request"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"was already erroring","type":"dfn","url":"#pending-abort-request-was-already-erroring"}, "#pipe-chain": {"displayText":"pipe chain","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"pipe chain","type":"dfn","url":"#pipe-chain"}, "#piping": {"displayText":"piping","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"piping","type":"dfn","url":"#piping"}, "#producer": {"displayText":"producer","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"producer","type":"dfn","url":"#producer"}, "#pull-into-descriptor": {"displayText":"pull-into descriptor","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"pull-into descriptor","type":"dfn","url":"#pull-into-descriptor"}, "#pull-into-descriptor-buffer": {"displayText":"buffer","export":true,"for_":["pull-into descriptor"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"buffer","type":"dfn","url":"#pull-into-descriptor-buffer"}, "#pull-into-descriptor-buffer-byte-length": {"displayText":"buffer byte length","export":true,"for_":["pull-into descriptor"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"buffer byte length","type":"dfn","url":"#pull-into-descriptor-buffer-byte-length"}, "#pull-into-descriptor-byte-length": {"displayText":"byte length","export":true,"for_":["pull-into descriptor"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"byte length","type":"dfn","url":"#pull-into-descriptor-byte-length"}, "#pull-into-descriptor-byte-offset": {"displayText":"byte offset","export":true,"for_":["pull-into descriptor"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"byte offset","type":"dfn","url":"#pull-into-descriptor-byte-offset"}, "#pull-into-descriptor-bytes-filled": {"displayText":"bytes filled","export":true,"for_":["pull-into descriptor"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"bytes filled","type":"dfn","url":"#pull-into-descriptor-bytes-filled"}, "#pull-into-descriptor-element-size": {"displayText":"element size","export":true,"for_":["pull-into descriptor"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"element size","type":"dfn","url":"#pull-into-descriptor-element-size"}, "#pull-into-descriptor-minimum-fill": {"displayText":"minimum fill","export":true,"for_":["pull-into descriptor"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"minimum fill","type":"dfn","url":"#pull-into-descriptor-minimum-fill"}, "#pull-into-descriptor-reader-type": {"displayText":"reader type","export":true,"for_":["pull-into descriptor"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"reader type","type":"dfn","url":"#pull-into-descriptor-reader-type"}, "#pull-into-descriptor-view-constructor": {"displayText":"view constructor","export":true,"for_":["pull-into descriptor"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"view constructor","type":"dfn","url":"#pull-into-descriptor-view-constructor"}, "#pull-source": {"displayText":"pull source","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"pull source","type":"dfn","url":"#pull-source"}, "#push-source": {"displayText":"push source","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"push source","type":"dfn","url":"#push-source"}, "#queuing-strategy": {"displayText":"queuing strategy","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"queuing strategy","type":"dfn","url":"#queuing-strategy"}, "#rbs-controller-byob-request": {"displayText":"byobRequest","export":true,"for_":["ReadableByteStreamController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"byobRequest","type":"attribute","url":"#rbs-controller-byob-request"}, "#rbs-controller-close": {"displayText":"close()","export":true,"for_":["ReadableByteStreamController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"close()","type":"method","url":"#rbs-controller-close"}, "#rbs-controller-desired-size": {"displayText":"desiredSize","export":true,"for_":["ReadableByteStreamController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"desiredSize","type":"attribute","url":"#rbs-controller-desired-size"}, "#rbs-controller-enqueue": {"displayText":"enqueue(chunk)","export":true,"for_":["ReadableByteStreamController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"enqueue(chunk)","type":"method","url":"#rbs-controller-enqueue"}, "#rbs-controller-error": {"displayText":"error(e)","export":true,"for_":["ReadableByteStreamController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"error(e)","type":"method","url":"#rbs-controller-error"}, "#read-into-request": {"displayText":"read-into request","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"read-into request","type":"dfn","url":"#read-into-request"}, "#read-into-request-chunk-steps": {"displayText":"chunk steps","export":true,"for_":["read-into request"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"chunk steps","type":"dfn","url":"#read-into-request-chunk-steps"}, "#read-into-request-close-steps": {"displayText":"close steps","export":true,"for_":["read-into request"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"close steps","type":"dfn","url":"#read-into-request-close-steps"}, "#read-into-request-error-steps": {"displayText":"error steps","export":true,"for_":["read-into request"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"error steps","type":"dfn","url":"#read-into-request-error-steps"}, "#read-loop": {"displayText":"read-loop","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"read-loop","type":"dfn","url":"#read-loop"}, "#read-request": {"displayText":"read request","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"read request","type":"dfn","url":"#read-request"}, "#read-request-chunk-steps": {"displayText":"chunk steps","export":true,"for_":["read request"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"chunk steps","type":"dfn","url":"#read-request-chunk-steps"}, "#read-request-close-steps": {"displayText":"close steps","export":true,"for_":["read request"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"close steps","type":"dfn","url":"#read-request-close-steps"}, "#read-request-error-steps": {"displayText":"error steps","export":true,"for_":["read request"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"error steps","type":"dfn","url":"#read-request-error-steps"}, "#readable-byte-stream": {"displayText":"readable byte stream","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"readable byte stream","type":"dfn","url":"#readable-byte-stream"}, "#readable-byte-stream-controller-call-pull-if-needed": {"displayText":"ReadableByteStreamControllerCallPullIfNeeded","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableByteStreamControllerCallPullIfNeeded","type":"abstract-op","url":"#readable-byte-stream-controller-call-pull-if-needed"}, "#readable-byte-stream-controller-clear-algorithms": {"displayText":"ReadableByteStreamControllerClearAlgorithms","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableByteStreamControllerClearAlgorithms","type":"abstract-op","url":"#readable-byte-stream-controller-clear-algorithms"}, "#readable-byte-stream-controller-clear-pending-pull-intos": {"displayText":"ReadableByteStreamControllerClearPendingPullIntos","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableByteStreamControllerClearPendingPullIntos","type":"abstract-op","url":"#readable-byte-stream-controller-clear-pending-pull-intos"}, "#readable-byte-stream-controller-close": {"displayText":"ReadableByteStreamControllerClose","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableByteStreamControllerClose","type":"abstract-op","url":"#readable-byte-stream-controller-close"}, "#readable-byte-stream-controller-commit-pull-into-descriptor": {"displayText":"ReadableByteStreamControllerCommitPullIntoDescriptor","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableByteStreamControllerCommitPullIntoDescriptor","type":"abstract-op","url":"#readable-byte-stream-controller-commit-pull-into-descriptor"}, "#readable-byte-stream-controller-convert-pull-into-descriptor": {"displayText":"ReadableByteStreamControllerConvertPullIntoDescriptor","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableByteStreamControllerConvertPullIntoDescriptor","type":"abstract-op","url":"#readable-byte-stream-controller-convert-pull-into-descriptor"}, "#readable-byte-stream-controller-enqueue": {"displayText":"ReadableByteStreamControllerEnqueue","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableByteStreamControllerEnqueue","type":"abstract-op","url":"#readable-byte-stream-controller-enqueue"}, "#readable-byte-stream-controller-enqueue-chunk-to-queue": {"displayText":"ReadableByteStreamControllerEnqueueChunkToQueue","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableByteStreamControllerEnqueueChunkToQueue","type":"abstract-op","url":"#readable-byte-stream-controller-enqueue-chunk-to-queue"}, "#readable-byte-stream-controller-error": {"displayText":"ReadableByteStreamControllerError","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableByteStreamControllerError","type":"abstract-op","url":"#readable-byte-stream-controller-error"}, "#readable-byte-stream-controller-fill-head-pull-into-descriptor": {"displayText":"ReadableByteStreamControllerFillHeadPullIntoDescriptor","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableByteStreamControllerFillHeadPullIntoDescriptor","type":"abstract-op","url":"#readable-byte-stream-controller-fill-head-pull-into-descriptor"}, "#readable-byte-stream-controller-fill-pull-into-descriptor-from-queue": {"displayText":"ReadableByteStreamControllerFillPullIntoDescriptorFromQueue","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableByteStreamControllerFillPullIntoDescriptorFromQueue","type":"abstract-op","url":"#readable-byte-stream-controller-fill-pull-into-descriptor-from-queue"}, "#readable-byte-stream-controller-get-desired-size": {"displayText":"ReadableByteStreamControllerGetDesiredSize","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableByteStreamControllerGetDesiredSize","type":"abstract-op","url":"#readable-byte-stream-controller-get-desired-size"}, "#readable-byte-stream-controller-handle-queue-drain": {"displayText":"ReadableByteStreamControllerHandleQueueDrain","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableByteStreamControllerHandleQueueDrain","type":"abstract-op","url":"#readable-byte-stream-controller-handle-queue-drain"}, "#readable-byte-stream-controller-invalidate-byob-request": {"displayText":"ReadableByteStreamControllerInvalidateBYOBRequest","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableByteStreamControllerInvalidateBYOBRequest","type":"abstract-op","url":"#readable-byte-stream-controller-invalidate-byob-request"}, "#readable-byte-stream-controller-process-pull-into-descriptors-using-queue": {"displayText":"ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue","type":"abstract-op","url":"#readable-byte-stream-controller-process-pull-into-descriptors-using-queue"}, "#readable-byte-stream-controller-pull-into": {"displayText":"ReadableByteStreamControllerPullInto","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableByteStreamControllerPullInto","type":"abstract-op","url":"#readable-byte-stream-controller-pull-into"}, "#readable-byte-stream-controller-respond": {"displayText":"ReadableByteStreamControllerRespond","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableByteStreamControllerRespond","type":"abstract-op","url":"#readable-byte-stream-controller-respond"}, "#readable-byte-stream-controller-respond-in-closed-state": {"displayText":"ReadableByteStreamControllerRespondInClosedState","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableByteStreamControllerRespondInClosedState","type":"abstract-op","url":"#readable-byte-stream-controller-respond-in-closed-state"}, "#readable-byte-stream-controller-respond-in-readable-state": {"displayText":"ReadableByteStreamControllerRespondInReadableState","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableByteStreamControllerRespondInReadableState","type":"abstract-op","url":"#readable-byte-stream-controller-respond-in-readable-state"}, "#readable-byte-stream-controller-respond-internal": {"displayText":"ReadableByteStreamControllerRespondInternal","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableByteStreamControllerRespondInternal","type":"abstract-op","url":"#readable-byte-stream-controller-respond-internal"}, "#readable-byte-stream-controller-respond-with-new-view": {"displayText":"ReadableByteStreamControllerRespondWithNewView","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableByteStreamControllerRespondWithNewView","type":"abstract-op","url":"#readable-byte-stream-controller-respond-with-new-view"}, "#readable-byte-stream-controller-shift-pending-pull-into": {"displayText":"ReadableByteStreamControllerShiftPendingPullInto","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableByteStreamControllerShiftPendingPullInto","type":"abstract-op","url":"#readable-byte-stream-controller-shift-pending-pull-into"}, "#readable-byte-stream-controller-should-call-pull": {"displayText":"ReadableByteStreamControllerShouldCallPull","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableByteStreamControllerShouldCallPull","type":"abstract-op","url":"#readable-byte-stream-controller-should-call-pull"}, "#readable-byte-stream-queue-entry": {"displayText":"readable byte stream queue entry","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"readable byte stream queue entry","type":"dfn","url":"#readable-byte-stream-queue-entry"}, "#readable-byte-stream-queue-entry-buffer": {"displayText":"buffer","export":true,"for_":["readable byte stream queue entry"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"buffer","type":"dfn","url":"#readable-byte-stream-queue-entry-buffer"}, "#readable-byte-stream-queue-entry-byte-length": {"displayText":"byte length","export":true,"for_":["readable byte stream queue entry"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"byte length","type":"dfn","url":"#readable-byte-stream-queue-entry-byte-length"}, "#readable-byte-stream-queue-entry-byte-offset": {"displayText":"byte offset","export":true,"for_":["readable byte stream queue entry"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"byte offset","type":"dfn","url":"#readable-byte-stream-queue-entry-byte-offset"}, "#readable-side": {"displayText":"readable side","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"readable side","type":"dfn","url":"#readable-side"}, "#readable-stream": {"displayText":"readable stream","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"readable stream","type":"dfn","url":"#readable-stream"}, "#readable-stream-add-read-into-request": {"displayText":"ReadableStreamAddReadIntoRequest","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStreamAddReadIntoRequest","type":"abstract-op","url":"#readable-stream-add-read-into-request"}, "#readable-stream-add-read-request": {"displayText":"ReadableStreamAddReadRequest","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStreamAddReadRequest","type":"abstract-op","url":"#readable-stream-add-read-request"}, "#readable-stream-byob-reader-read": {"displayText":"ReadableStreamBYOBReaderRead","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStreamBYOBReaderRead","type":"abstract-op","url":"#readable-stream-byob-reader-read"}, "#readable-stream-cancel": {"displayText":"ReadableStreamCancel","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStreamCancel","type":"abstract-op","url":"#readable-stream-cancel"}, "#readable-stream-close": {"displayText":"ReadableStreamClose","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStreamClose","type":"abstract-op","url":"#readable-stream-close"}, "#readable-stream-default-controller-call-pull-if-needed": {"displayText":"ReadableStreamDefaultControllerCallPullIfNeeded","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStreamDefaultControllerCallPullIfNeeded","type":"abstract-op","url":"#readable-stream-default-controller-call-pull-if-needed"}, "#readable-stream-default-controller-can-close-or-enqueue": {"displayText":"ReadableStreamDefaultControllerCanCloseOrEnqueue","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStreamDefaultControllerCanCloseOrEnqueue","type":"abstract-op","url":"#readable-stream-default-controller-can-close-or-enqueue"}, "#readable-stream-default-controller-clear-algorithms": {"displayText":"ReadableStreamDefaultControllerClearAlgorithms","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStreamDefaultControllerClearAlgorithms","type":"abstract-op","url":"#readable-stream-default-controller-clear-algorithms"}, "#readable-stream-default-controller-close": {"displayText":"ReadableStreamDefaultControllerClose","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStreamDefaultControllerClose","type":"abstract-op","url":"#readable-stream-default-controller-close"}, "#readable-stream-default-controller-enqueue": {"displayText":"ReadableStreamDefaultControllerEnqueue","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStreamDefaultControllerEnqueue","type":"abstract-op","url":"#readable-stream-default-controller-enqueue"}, "#readable-stream-default-controller-error": {"displayText":"ReadableStreamDefaultControllerError","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStreamDefaultControllerError","type":"abstract-op","url":"#readable-stream-default-controller-error"}, "#readable-stream-default-controller-get-desired-size": {"displayText":"ReadableStreamDefaultControllerGetDesiredSize","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStreamDefaultControllerGetDesiredSize","type":"abstract-op","url":"#readable-stream-default-controller-get-desired-size"}, "#readable-stream-default-controller-should-call-pull": {"displayText":"ReadableStreamDefaultControllerShouldCallPull","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStreamDefaultControllerShouldCallPull","type":"abstract-op","url":"#readable-stream-default-controller-should-call-pull"}, "#readable-stream-default-reader-read": {"displayText":"ReadableStreamDefaultReaderRead","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStreamDefaultReaderRead","type":"abstract-op","url":"#readable-stream-default-reader-read"}, "#readable-stream-error": {"displayText":"ReadableStreamError","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStreamError","type":"abstract-op","url":"#readable-stream-error"}, "#readable-stream-from-iterable": {"displayText":"ReadableStreamFromIterable","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStreamFromIterable","type":"abstract-op","url":"#readable-stream-from-iterable"}, "#readable-stream-fulfill-read-into-request": {"displayText":"ReadableStreamFulfillReadIntoRequest","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStreamFulfillReadIntoRequest","type":"abstract-op","url":"#readable-stream-fulfill-read-into-request"}, "#readable-stream-fulfill-read-request": {"displayText":"ReadableStreamFulfillReadRequest","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStreamFulfillReadRequest","type":"abstract-op","url":"#readable-stream-fulfill-read-request"}, "#readable-stream-get-num-read-into-requests": {"displayText":"ReadableStreamGetNumReadIntoRequests","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStreamGetNumReadIntoRequests","type":"abstract-op","url":"#readable-stream-get-num-read-into-requests"}, "#readable-stream-get-num-read-requests": {"displayText":"ReadableStreamGetNumReadRequests","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStreamGetNumReadRequests","type":"abstract-op","url":"#readable-stream-get-num-read-requests"}, "#readable-stream-has-byob-reader": {"displayText":"ReadableStreamHasBYOBReader","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStreamHasBYOBReader","type":"abstract-op","url":"#readable-stream-has-byob-reader"}, "#readable-stream-has-default-reader": {"displayText":"ReadableStreamHasDefaultReader","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStreamHasDefaultReader","type":"abstract-op","url":"#readable-stream-has-default-reader"}, "#readable-stream-pipe-to": {"displayText":"ReadableStreamPipeTo","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStreamPipeTo","type":"abstract-op","url":"#readable-stream-pipe-to"}, "#readable-stream-reader-generic-cancel": {"displayText":"ReadableStreamReaderGenericCancel","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStreamReaderGenericCancel","type":"abstract-op","url":"#readable-stream-reader-generic-cancel"}, "#readable-stream-reader-generic-initialize": {"displayText":"ReadableStreamReaderGenericInitialize","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStreamReaderGenericInitialize","type":"abstract-op","url":"#readable-stream-reader-generic-initialize"}, "#readable-stream-reader-generic-release": {"displayText":"ReadableStreamReaderGenericRelease","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStreamReaderGenericRelease","type":"abstract-op","url":"#readable-stream-reader-generic-release"}, "#readable-stream-tee": {"displayText":"ReadableStreamTee","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStreamTee","type":"abstract-op","url":"#readable-stream-tee"}, "#readablebytestreamcontroller": {"displayText":"ReadableByteStreamController","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableByteStreamController","type":"interface","url":"#readablebytestreamcontroller"}, "#readablebytestreamcontroller-autoallocatechunksize": {"displayText":"[[autoallocatechunksize]]","export":true,"for_":["ReadableByteStreamController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[autoallocatechunksize]]","type":"dfn","url":"#readablebytestreamcontroller-autoallocatechunksize"}, "#readablebytestreamcontroller-byobrequest": {"displayText":"[[byobrequest]]","export":true,"for_":["ReadableByteStreamController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[byobrequest]]","type":"dfn","url":"#readablebytestreamcontroller-byobrequest"}, "#readablebytestreamcontroller-cancelalgorithm": {"displayText":"[[cancelalgorithm]]","export":true,"for_":["ReadableByteStreamController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[cancelalgorithm]]","type":"dfn","url":"#readablebytestreamcontroller-cancelalgorithm"}, "#readablebytestreamcontroller-closerequested": {"displayText":"[[closerequested]]","export":true,"for_":["ReadableByteStreamController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[closerequested]]","type":"dfn","url":"#readablebytestreamcontroller-closerequested"}, "#readablebytestreamcontroller-pendingpullintos": {"displayText":"[[pendingpullintos]]","export":true,"for_":["ReadableByteStreamController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[pendingpullintos]]","type":"dfn","url":"#readablebytestreamcontroller-pendingpullintos"}, "#readablebytestreamcontroller-pullagain": {"displayText":"[[pullagain]]","export":true,"for_":["ReadableByteStreamController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[pullagain]]","type":"dfn","url":"#readablebytestreamcontroller-pullagain"}, "#readablebytestreamcontroller-pullalgorithm": {"displayText":"[[pullalgorithm]]","export":true,"for_":["ReadableByteStreamController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[pullalgorithm]]","type":"dfn","url":"#readablebytestreamcontroller-pullalgorithm"}, "#readablebytestreamcontroller-pulling": {"displayText":"[[pulling]]","export":true,"for_":["ReadableByteStreamController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[pulling]]","type":"dfn","url":"#readablebytestreamcontroller-pulling"}, "#readablebytestreamcontroller-queue": {"displayText":"[[queue]]","export":true,"for_":["ReadableByteStreamController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[queue]]","type":"dfn","url":"#readablebytestreamcontroller-queue"}, "#readablebytestreamcontroller-queuetotalsize": {"displayText":"[[queuetotalsize]]","export":true,"for_":["ReadableByteStreamController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[queuetotalsize]]","type":"dfn","url":"#readablebytestreamcontroller-queuetotalsize"}, "#readablebytestreamcontroller-started": {"displayText":"[[started]]","export":true,"for_":["ReadableByteStreamController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[started]]","type":"dfn","url":"#readablebytestreamcontroller-started"}, "#readablebytestreamcontroller-strategyhwm": {"displayText":"[[strategyhwm]]","export":true,"for_":["ReadableByteStreamController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[strategyhwm]]","type":"dfn","url":"#readablebytestreamcontroller-strategyhwm"}, "#readablebytestreamcontroller-stream": {"displayText":"[[stream]]","export":true,"for_":["ReadableByteStreamController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[stream]]","type":"dfn","url":"#readablebytestreamcontroller-stream"}, "#readablestream": {"displayText":"ReadableStream","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStream","type":"interface","url":"#readablestream"}, "#readablestream-async-iterator-prevent-cancel": {"displayText":"prevent cancel","export":true,"for_":["ReadableStream async iterator"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"prevent cancel","type":"dfn","url":"#readablestream-async-iterator-prevent-cancel"}, "#readablestream-async-iterator-reader": {"displayText":"reader","export":true,"for_":["ReadableStream async iterator"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"reader","type":"dfn","url":"#readablestream-async-iterator-reader"}, "#readablestream-close": {"displayText":"close","export":true,"for_":["ReadableStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"close","type":"dfn","url":"#readablestream-close"}, "#readablestream-controller": {"displayText":"[[controller]]","export":true,"for_":["ReadableStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[controller]]","type":"dfn","url":"#readablestream-controller"}, "#readablestream-current-byob-request-view": {"displayText":"current byob request view","export":true,"for_":["ReadableStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"current byob request view","type":"dfn","url":"#readablestream-current-byob-request-view"}, "#readablestream-desired-size-to-fill-up-to-the-high-water-mark": {"displayText":"desired size to fill up to the high water mark","export":true,"for_":["ReadableStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"desired size to fill up to the high water mark","type":"dfn","url":"#readablestream-desired-size-to-fill-up-to-the-high-water-mark"}, "#readablestream-disturbed": {"displayText":"[[disturbed]]","export":true,"for_":["ReadableStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[disturbed]]","type":"dfn","url":"#readablestream-disturbed"}, "#readablestream-enqueue": {"displayText":"enqueue","export":true,"for_":["ReadableStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"enqueue","type":"dfn","url":"#readablestream-enqueue"}, "#readablestream-get-a-reader": {"displayText":"get a reader","export":true,"for_":["ReadableStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"get a reader","type":"dfn","url":"#readablestream-get-a-reader"}, "#readablestream-locked": {"displayText":"locked","export":true,"for_":["ReadableStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"locked","type":"dfn","url":"#readablestream-locked"}, "#readablestream-pipe": {"displayText":"pipe","export":true,"for_":["ReadableStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"pipe","type":"dfn","url":"#readablestream-pipe"}, "#readablestream-pipe-through": {"displayText":"piped through","export":true,"for_":["ReadableStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"piped through","type":"dfn","url":"#readablestream-pipe-through"}, "#readablestream-pull-from-bytes": {"displayText":"pull from bytes","export":true,"for_":["ReadableStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"pull from bytes","type":"dfn","url":"#readablestream-pull-from-bytes"}, "#readablestream-readable": {"displayText":"readable","export":true,"for_":["ReadableStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"readable","type":"dfn","url":"#readablestream-readable"}, "#readablestream-reader": {"displayText":"[[reader]]","export":true,"for_":["ReadableStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[reader]]","type":"dfn","url":"#readablestream-reader"}, "#readablestream-set-up": {"displayText":"set up","export":true,"for_":["ReadableStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"set up","type":"dfn","url":"#readablestream-set-up"}, "#readablestream-set-up-cancelalgorithm": {"displayText":"cancelalgorithm","export":true,"for_":["ReadableStream/set up"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"cancelalgorithm","type":"dfn","url":"#readablestream-set-up-cancelalgorithm"}, "#readablestream-set-up-with-byte-reading-support": {"displayText":"set up with byte reading support","export":true,"for_":["ReadableStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"set up with byte reading support","type":"dfn","url":"#readablestream-set-up-with-byte-reading-support"}, "#readablestream-state": {"displayText":"[[state]]","export":true,"for_":["ReadableStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[state]]","type":"dfn","url":"#readablestream-state"}, "#readablestream-storederror": {"displayText":"[[storederror]]","export":true,"for_":["ReadableStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[storederror]]","type":"dfn","url":"#readablestream-storederror"}, "#readablestream-tee": {"displayText":"tee","export":true,"for_":["ReadableStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"tee","type":"dfn","url":"#readablestream-tee"}, "#readablestreambyobreader": {"displayText":"ReadableStreamBYOBReader","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStreamBYOBReader","type":"interface","url":"#readablestreambyobreader"}, "#readablestreambyobreader-readintorequests": {"displayText":"[[readintorequests]]","export":true,"for_":["ReadableStreamBYOBReader"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[readintorequests]]","type":"dfn","url":"#readablestreambyobreader-readintorequests"}, "#readablestreambyobrequest": {"displayText":"ReadableStreamBYOBRequest","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStreamBYOBRequest","type":"interface","url":"#readablestreambyobrequest"}, "#readablestreambyobrequest-controller": {"displayText":"[[controller]]","export":true,"for_":["ReadableStreamBYOBRequest"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[controller]]","type":"dfn","url":"#readablestreambyobrequest-controller"}, "#readablestreambyobrequest-view": {"displayText":"[[view]]","export":true,"for_":["ReadableStreamBYOBRequest"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[view]]","type":"dfn","url":"#readablestreambyobrequest-view"}, "#readablestreamdefaultcontroller": {"displayText":"ReadableStreamDefaultController","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStreamDefaultController","type":"interface","url":"#readablestreamdefaultcontroller"}, "#readablestreamdefaultcontroller-cancelalgorithm": {"displayText":"[[cancelalgorithm]]","export":true,"for_":["ReadableStreamDefaultController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[cancelalgorithm]]","type":"dfn","url":"#readablestreamdefaultcontroller-cancelalgorithm"}, "#readablestreamdefaultcontroller-closerequested": {"displayText":"[[closerequested]]","export":true,"for_":["ReadableStreamDefaultController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[closerequested]]","type":"dfn","url":"#readablestreamdefaultcontroller-closerequested"}, "#readablestreamdefaultcontroller-pullagain": {"displayText":"[[pullagain]]","export":true,"for_":["ReadableStreamDefaultController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[pullagain]]","type":"dfn","url":"#readablestreamdefaultcontroller-pullagain"}, "#readablestreamdefaultcontroller-pullalgorithm": {"displayText":"[[pullalgorithm]]","export":true,"for_":["ReadableStreamDefaultController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[pullalgorithm]]","type":"dfn","url":"#readablestreamdefaultcontroller-pullalgorithm"}, "#readablestreamdefaultcontroller-pulling": {"displayText":"[[pulling]]","export":true,"for_":["ReadableStreamDefaultController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[pulling]]","type":"dfn","url":"#readablestreamdefaultcontroller-pulling"}, "#readablestreamdefaultcontroller-queue": {"displayText":"[[queue]]","export":true,"for_":["ReadableStreamDefaultController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[queue]]","type":"dfn","url":"#readablestreamdefaultcontroller-queue"}, "#readablestreamdefaultcontroller-queuetotalsize": {"displayText":"[[queuetotalsize]]","export":true,"for_":["ReadableStreamDefaultController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[queuetotalsize]]","type":"dfn","url":"#readablestreamdefaultcontroller-queuetotalsize"}, "#readablestreamdefaultcontroller-started": {"displayText":"[[started]]","export":true,"for_":["ReadableStreamDefaultController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[started]]","type":"dfn","url":"#readablestreamdefaultcontroller-started"}, "#readablestreamdefaultcontroller-strategyhwm": {"displayText":"[[strategyhwm]]","export":true,"for_":["ReadableStreamDefaultController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[strategyhwm]]","type":"dfn","url":"#readablestreamdefaultcontroller-strategyhwm"}, "#readablestreamdefaultcontroller-strategysizealgorithm": {"displayText":"[[strategysizealgorithm]]","export":true,"for_":["ReadableStreamDefaultController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[strategysizealgorithm]]","type":"dfn","url":"#readablestreamdefaultcontroller-strategysizealgorithm"}, "#readablestreamdefaultcontroller-stream": {"displayText":"[[stream]]","export":true,"for_":["ReadableStreamDefaultController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[stream]]","type":"dfn","url":"#readablestreamdefaultcontroller-stream"}, "#readablestreamdefaultreader": {"displayText":"ReadableStreamDefaultReader","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStreamDefaultReader","type":"interface","url":"#readablestreamdefaultreader"}, "#readablestreamdefaultreader-readrequests": {"displayText":"[[readrequests]]","export":true,"for_":["ReadableStreamDefaultReader"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[readrequests]]","type":"dfn","url":"#readablestreamdefaultreader-readrequests"}, "#readablestreamgenericreader": {"displayText":"ReadableStreamGenericReader","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStreamGenericReader","type":"interface","url":"#readablestreamgenericreader"}, "#readablestreamgenericreader-closedpromise": {"displayText":"[[closedpromise]]","export":true,"for_":["ReadableStreamGenericReader"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[closedpromise]]","type":"dfn","url":"#readablestreamgenericreader-closedpromise"}, "#readablestreamgenericreader-stream": {"displayText":"[[stream]]","export":true,"for_":["ReadableStreamGenericReader"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[stream]]","type":"dfn","url":"#readablestreamgenericreader-stream"}, "#reader": {"displayText":"reader","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"reader","type":"dfn","url":"#reader"}, "#release-a-lock": {"displayText":"release a read lock","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"release a read lock","type":"dfn","url":"#release-a-lock"}, "#reset-queue": {"displayText":"ResetQueue","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ResetQueue","type":"abstract-op","url":"#reset-queue"}, "#rs-byob-request-respond": {"displayText":"respond(bytesWritten)","export":true,"for_":["ReadableStreamBYOBRequest"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"respond(bytesWritten)","type":"method","url":"#rs-byob-request-respond"}, "#rs-byob-request-respond-with-new-view": {"displayText":"respondWithNewView(view)","export":true,"for_":["ReadableStreamBYOBRequest"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"respondWithNewView(view)","type":"method","url":"#rs-byob-request-respond-with-new-view"}, "#rs-byob-request-view": {"displayText":"view","export":true,"for_":["ReadableStreamBYOBRequest"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"view","type":"attribute","url":"#rs-byob-request-view"}, "#rs-cancel": {"displayText":"cancel()","export":true,"for_":["ReadableStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"cancel()","type":"method","url":"#rs-cancel"}, "#rs-constructor": {"displayText":"ReadableStream()","export":true,"for_":["ReadableStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStream()","type":"constructor","url":"#rs-constructor"}, "#rs-default-controller-close": {"displayText":"close()","export":true,"for_":["ReadableStreamDefaultController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"close()","type":"method","url":"#rs-default-controller-close"}, "#rs-default-controller-desired-size": {"displayText":"desiredSize","export":true,"for_":["ReadableStreamDefaultController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"desiredSize","type":"attribute","url":"#rs-default-controller-desired-size"}, "#rs-default-controller-enqueue": {"displayText":"enqueue(chunk)","export":true,"for_":["ReadableStreamDefaultController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"enqueue(chunk)","type":"method","url":"#rs-default-controller-enqueue"}, "#rs-default-controller-error": {"displayText":"error(e)","export":true,"for_":["ReadableStreamDefaultController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"error(e)","type":"method","url":"#rs-default-controller-error"}, "#rs-default-controller-has-backpressure": {"displayText":"ReadableStreamDefaultControllerHasBackpressure","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStreamDefaultControllerHasBackpressure","type":"abstract-op","url":"#rs-default-controller-has-backpressure"}, "#rs-from": {"displayText":"from(asyncIterable)","export":true,"for_":["ReadableStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"from(asyncIterable)","type":"method","url":"#rs-from"}, "#rs-get-reader": {"displayText":"getReader()","export":true,"for_":["ReadableStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"getReader()","type":"method","url":"#rs-get-reader"}, "#rs-locked": {"displayText":"locked","export":true,"for_":["ReadableStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"locked","type":"attribute","url":"#rs-locked"}, "#rs-pipe-through": {"displayText":"pipeThrough(transform)","export":true,"for_":["ReadableStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"pipeThrough(transform)","type":"method","url":"#rs-pipe-through"}, "#rs-pipe-to": {"displayText":"pipeTo(destination)","export":true,"for_":["ReadableStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"pipeTo(destination)","type":"method","url":"#rs-pipe-to"}, "#rs-pipeTo-finalize": {"displayText":"finalize","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"finalize","type":"dfn","url":"#rs-pipeTo-finalize"}, "#rs-pipeTo-shutdown": {"displayText":"shutdown","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"shutdown","type":"dfn","url":"#rs-pipeTo-shutdown"}, "#rs-pipeTo-shutdown-with-action": {"displayText":"shutdown with an action","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"shutdown with an action","type":"dfn","url":"#rs-pipeTo-shutdown-with-action"}, "#rs-tee": {"displayText":"tee()","export":true,"for_":["ReadableStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"tee()","type":"method","url":"#rs-tee"}, "#set-up-readable-byte-stream-controller": {"displayText":"SetUpReadableByteStreamController","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"SetUpReadableByteStreamController","type":"abstract-op","url":"#set-up-readable-byte-stream-controller"}, "#set-up-readable-byte-stream-controller-from-underlying-source": {"displayText":"SetUpReadableByteStreamControllerFromUnderlyingSource","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"SetUpReadableByteStreamControllerFromUnderlyingSource","type":"abstract-op","url":"#set-up-readable-byte-stream-controller-from-underlying-source"}, "#set-up-readable-stream-byob-reader": {"displayText":"SetUpReadableStreamBYOBReader","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"SetUpReadableStreamBYOBReader","type":"abstract-op","url":"#set-up-readable-stream-byob-reader"}, "#set-up-readable-stream-default-controller": {"displayText":"SetUpReadableStreamDefaultController","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"SetUpReadableStreamDefaultController","type":"abstract-op","url":"#set-up-readable-stream-default-controller"}, "#set-up-readable-stream-default-controller-from-underlying-source": {"displayText":"SetUpReadableStreamDefaultControllerFromUnderlyingSource","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"SetUpReadableStreamDefaultControllerFromUnderlyingSource","type":"abstract-op","url":"#set-up-readable-stream-default-controller-from-underlying-source"}, "#set-up-readable-stream-default-reader": {"displayText":"SetUpReadableStreamDefaultReader","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"SetUpReadableStreamDefaultReader","type":"abstract-op","url":"#set-up-readable-stream-default-reader"}, "#set-up-transform-stream-default-controller": {"displayText":"SetUpTransformStreamDefaultController","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"SetUpTransformStreamDefaultController","type":"abstract-op","url":"#set-up-transform-stream-default-controller"}, "#set-up-transform-stream-default-controller-from-transformer": {"displayText":"SetUpTransformStreamDefaultControllerFromTransformer","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"SetUpTransformStreamDefaultControllerFromTransformer","type":"abstract-op","url":"#set-up-transform-stream-default-controller-from-transformer"}, "#set-up-writable-stream-default-controller": {"displayText":"SetUpWritableStreamDefaultController","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"SetUpWritableStreamDefaultController","type":"abstract-op","url":"#set-up-writable-stream-default-controller"}, "#set-up-writable-stream-default-controller-from-underlying-sink": {"displayText":"SetUpWritableStreamDefaultControllerFromUnderlyingSink","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"SetUpWritableStreamDefaultControllerFromUnderlyingSink","type":"abstract-op","url":"#set-up-writable-stream-default-controller-from-underlying-sink"}, "#set-up-writable-stream-default-writer": {"displayText":"SetUpWritableStreamDefaultWriter","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"SetUpWritableStreamDefaultWriter","type":"abstract-op","url":"#set-up-writable-stream-default-writer"}, "#tee-a-readable-stream": {"displayText":"tee a readable stream","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"tee a readable stream","type":"dfn","url":"#tee-a-readable-stream"}, "#transfer-array-buffer": {"displayText":"TransferArrayBuffer","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"TransferArrayBuffer","type":"abstract-op","url":"#transfer-array-buffer"}, "#transform-stream": {"displayText":"transform stream","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"transform stream","type":"dfn","url":"#transform-stream"}, "#transform-stream-default-controller-clear-algorithms": {"displayText":"TransformStreamDefaultControllerClearAlgorithms","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"TransformStreamDefaultControllerClearAlgorithms","type":"abstract-op","url":"#transform-stream-default-controller-clear-algorithms"}, "#transform-stream-default-controller-enqueue": {"displayText":"TransformStreamDefaultControllerEnqueue","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"TransformStreamDefaultControllerEnqueue","type":"abstract-op","url":"#transform-stream-default-controller-enqueue"}, "#transform-stream-default-controller-error": {"displayText":"TransformStreamDefaultControllerError","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"TransformStreamDefaultControllerError","type":"abstract-op","url":"#transform-stream-default-controller-error"}, "#transform-stream-default-controller-perform-transform": {"displayText":"TransformStreamDefaultControllerPerformTransform","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"TransformStreamDefaultControllerPerformTransform","type":"abstract-op","url":"#transform-stream-default-controller-perform-transform"}, "#transform-stream-default-controller-terminate": {"displayText":"TransformStreamDefaultControllerTerminate","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"TransformStreamDefaultControllerTerminate","type":"abstract-op","url":"#transform-stream-default-controller-terminate"}, "#transform-stream-default-sink-abort-algorithm": {"displayText":"TransformStreamDefaultSinkAbortAlgorithm","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"TransformStreamDefaultSinkAbortAlgorithm","type":"abstract-op","url":"#transform-stream-default-sink-abort-algorithm"}, "#transform-stream-default-sink-close-algorithm": {"displayText":"TransformStreamDefaultSinkCloseAlgorithm","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"TransformStreamDefaultSinkCloseAlgorithm","type":"abstract-op","url":"#transform-stream-default-sink-close-algorithm"}, "#transform-stream-default-sink-write-algorithm": {"displayText":"TransformStreamDefaultSinkWriteAlgorithm","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"TransformStreamDefaultSinkWriteAlgorithm","type":"abstract-op","url":"#transform-stream-default-sink-write-algorithm"}, "#transform-stream-default-source-cancel": {"displayText":"TransformStreamDefaultSourceCancelAlgorithm","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"TransformStreamDefaultSourceCancelAlgorithm","type":"abstract-op","url":"#transform-stream-default-source-cancel"}, "#transform-stream-default-source-pull": {"displayText":"TransformStreamDefaultSourcePullAlgorithm","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"TransformStreamDefaultSourcePullAlgorithm","type":"abstract-op","url":"#transform-stream-default-source-pull"}, "#transform-stream-error": {"displayText":"TransformStreamError","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"TransformStreamError","type":"abstract-op","url":"#transform-stream-error"}, "#transform-stream-error-writable-and-unblock-write": {"displayText":"TransformStreamErrorWritableAndUnblockWrite","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"TransformStreamErrorWritableAndUnblockWrite","type":"abstract-op","url":"#transform-stream-error-writable-and-unblock-write"}, "#transform-stream-set-backpressure": {"displayText":"TransformStreamSetBackpressure","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"TransformStreamSetBackpressure","type":"abstract-op","url":"#transform-stream-set-backpressure"}, "#transform-stream-unblock-write": {"displayText":"TransformStreamUnblockWrite","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"TransformStreamUnblockWrite","type":"abstract-op","url":"#transform-stream-unblock-write"}, "#transformer": {"displayText":"transformer","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"transformer","type":"dfn","url":"#transformer"}, "#transformstream": {"displayText":"TransformStream","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"TransformStream","type":"interface","url":"#transformstream"}, "#transformstream-backpressure": {"displayText":"[[backpressure]]","export":true,"for_":["TransformStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[backpressure]]","type":"dfn","url":"#transformstream-backpressure"}, "#transformstream-backpressurechangepromise": {"displayText":"[[backpressurechangepromise]]","export":true,"for_":["TransformStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[backpressurechangepromise]]","type":"dfn","url":"#transformstream-backpressurechangepromise"}, "#transformstream-controller": {"displayText":"[[controller]]","export":true,"for_":["TransformStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[controller]]","type":"dfn","url":"#transformstream-controller"}, "#transformstream-enqueue": {"displayText":"enqueue","export":true,"for_":["TransformStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"enqueue","type":"dfn","url":"#transformstream-enqueue"}, "#transformstream-readable": {"displayText":"[[readable]]","export":true,"for_":["TransformStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[readable]]","type":"dfn","url":"#transformstream-readable"}, "#transformstream-set-up": {"displayText":"set up","export":true,"for_":["TransformStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"set up","type":"dfn","url":"#transformstream-set-up"}, "#transformstream-set-up-flushalgorithm": {"displayText":"flushalgorithm","export":true,"for_":["TransformStream/set up"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"flushalgorithm","type":"dfn","url":"#transformstream-set-up-flushalgorithm"}, "#transformstream-set-up-transformalgorithm": {"displayText":"transformalgorithm","export":true,"for_":["TransformStream/set up"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"transformalgorithm","type":"dfn","url":"#transformstream-set-up-transformalgorithm"}, "#transformstream-writable": {"displayText":"[[writable]]","export":true,"for_":["TransformStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[writable]]","type":"dfn","url":"#transformstream-writable"}, "#transformstreamdefaultcontroller": {"displayText":"TransformStreamDefaultController","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"TransformStreamDefaultController","type":"interface","url":"#transformstreamdefaultcontroller"}, "#transformstreamdefaultcontroller-cancelalgorithm": {"displayText":"[[cancelalgorithm]]","export":true,"for_":["TransformStreamDefaultController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[cancelalgorithm]]","type":"dfn","url":"#transformstreamdefaultcontroller-cancelalgorithm"}, "#transformstreamdefaultcontroller-finishpromise": {"displayText":"[[finishpromise]]","export":true,"for_":["TransformStreamDefaultController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[finishpromise]]","type":"dfn","url":"#transformstreamdefaultcontroller-finishpromise"}, "#transformstreamdefaultcontroller-flushalgorithm": {"displayText":"[[flushalgorithm]]","export":true,"for_":["TransformStreamDefaultController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[flushalgorithm]]","type":"dfn","url":"#transformstreamdefaultcontroller-flushalgorithm"}, "#transformstreamdefaultcontroller-stream": {"displayText":"[[stream]]","export":true,"for_":["TransformStreamDefaultController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[stream]]","type":"dfn","url":"#transformstreamdefaultcontroller-stream"}, "#transformstreamdefaultcontroller-transformalgorithm": {"displayText":"[[transformalgorithm]]","export":true,"for_":["TransformStreamDefaultController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[transformalgorithm]]","type":"dfn","url":"#transformstreamdefaultcontroller-transformalgorithm"}, "#ts-constructor": {"displayText":"TransformStream()","export":true,"for_":["TransformStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"TransformStream()","type":"constructor","url":"#ts-constructor"}, "#ts-default-controller-desired-size": {"displayText":"desiredSize","export":true,"for_":["TransformStreamDefaultController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"desiredSize","type":"attribute","url":"#ts-default-controller-desired-size"}, "#ts-default-controller-enqueue": {"displayText":"enqueue()","export":true,"for_":["TransformStreamDefaultController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"enqueue()","type":"method","url":"#ts-default-controller-enqueue"}, "#ts-default-controller-error": {"displayText":"error()","export":true,"for_":["TransformStreamDefaultController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"error()","type":"method","url":"#ts-default-controller-error"}, "#ts-default-controller-terminate": {"displayText":"terminate()","export":true,"for_":["TransformStreamDefaultController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"terminate()","type":"method","url":"#ts-default-controller-terminate"}, "#ts-readable": {"displayText":"readable","export":true,"for_":["TransformStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"readable","type":"attribute","url":"#ts-readable"}, "#ts-writable": {"displayText":"writable","export":true,"for_":["TransformStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"writable","type":"attribute","url":"#ts-writable"}, "#typedefdef-readablestreamcontroller": {"displayText":"ReadableStreamController","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStreamController","type":"typedef","url":"#typedefdef-readablestreamcontroller"}, "#typedefdef-readablestreamreader": {"displayText":"ReadableStreamReader","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ReadableStreamReader","type":"typedef","url":"#typedefdef-readablestreamreader"}, "#ultimate-sink": {"displayText":"ultimate sink","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ultimate sink","type":"dfn","url":"#ultimate-sink"}, "#underlying-byte-source": {"displayText":"underlying byte source","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"underlying byte source","type":"dfn","url":"#underlying-byte-source"}, "#underlying-sink": {"displayText":"underlying sink","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"underlying sink","type":"dfn","url":"#underlying-sink"}, "#underlying-source": {"displayText":"underlying source","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"underlying source","type":"dfn","url":"#underlying-source"}, "#validate-and-normalize-high-water-mark": {"displayText":"ExtractHighWaterMark","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"ExtractHighWaterMark","type":"abstract-op","url":"#validate-and-normalize-high-water-mark"}, "#value-with-size": {"displayText":"value-with-size","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"value-with-size","type":"dfn","url":"#value-with-size"}, "#value-with-size-size": {"displayText":"size","export":true,"for_":["value-with-size"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"size","type":"dfn","url":"#value-with-size-size"}, "#value-with-size-value": {"displayText":"value","export":true,"for_":["value-with-size"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"value","type":"dfn","url":"#value-with-size-value"}, "#writable-side": {"displayText":"writable side","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"writable side","type":"dfn","url":"#writable-side"}, "#writable-stream": {"displayText":"writable stream","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"writable stream","type":"dfn","url":"#writable-stream"}, "#writable-stream-abort": {"displayText":"WritableStreamAbort","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"WritableStreamAbort","type":"abstract-op","url":"#writable-stream-abort"}, "#writable-stream-add-write-request": {"displayText":"WritableStreamAddWriteRequest","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"WritableStreamAddWriteRequest","type":"abstract-op","url":"#writable-stream-add-write-request"}, "#writable-stream-close": {"displayText":"WritableStreamClose","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"WritableStreamClose","type":"abstract-op","url":"#writable-stream-close"}, "#writable-stream-close-queued-or-in-flight": {"displayText":"WritableStreamCloseQueuedOrInFlight","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"WritableStreamCloseQueuedOrInFlight","type":"abstract-op","url":"#writable-stream-close-queued-or-in-flight"}, "#writable-stream-deal-with-rejection": {"displayText":"WritableStreamDealWithRejection","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"WritableStreamDealWithRejection","type":"abstract-op","url":"#writable-stream-deal-with-rejection"}, "#writable-stream-default-controller-advance-queue-if-needed": {"displayText":"WritableStreamDefaultControllerAdvanceQueueIfNeeded","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"WritableStreamDefaultControllerAdvanceQueueIfNeeded","type":"abstract-op","url":"#writable-stream-default-controller-advance-queue-if-needed"}, "#writable-stream-default-controller-clear-algorithms": {"displayText":"WritableStreamDefaultControllerClearAlgorithms","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"WritableStreamDefaultControllerClearAlgorithms","type":"abstract-op","url":"#writable-stream-default-controller-clear-algorithms"}, "#writable-stream-default-controller-close": {"displayText":"WritableStreamDefaultControllerClose","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"WritableStreamDefaultControllerClose","type":"abstract-op","url":"#writable-stream-default-controller-close"}, "#writable-stream-default-controller-error": {"displayText":"WritableStreamDefaultControllerError","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"WritableStreamDefaultControllerError","type":"abstract-op","url":"#writable-stream-default-controller-error"}, "#writable-stream-default-controller-error-if-needed": {"displayText":"WritableStreamDefaultControllerErrorIfNeeded","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"WritableStreamDefaultControllerErrorIfNeeded","type":"abstract-op","url":"#writable-stream-default-controller-error-if-needed"}, "#writable-stream-default-controller-get-backpressure": {"displayText":"WritableStreamDefaultControllerGetBackpressure","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"WritableStreamDefaultControllerGetBackpressure","type":"abstract-op","url":"#writable-stream-default-controller-get-backpressure"}, "#writable-stream-default-controller-get-chunk-size": {"displayText":"WritableStreamDefaultControllerGetChunkSize","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"WritableStreamDefaultControllerGetChunkSize","type":"abstract-op","url":"#writable-stream-default-controller-get-chunk-size"}, "#writable-stream-default-controller-get-desired-size": {"displayText":"WritableStreamDefaultControllerGetDesiredSize","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"WritableStreamDefaultControllerGetDesiredSize","type":"abstract-op","url":"#writable-stream-default-controller-get-desired-size"}, "#writable-stream-default-controller-process-close": {"displayText":"WritableStreamDefaultControllerProcessClose","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"WritableStreamDefaultControllerProcessClose","type":"abstract-op","url":"#writable-stream-default-controller-process-close"}, "#writable-stream-default-controller-process-write": {"displayText":"WritableStreamDefaultControllerProcessWrite","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"WritableStreamDefaultControllerProcessWrite","type":"abstract-op","url":"#writable-stream-default-controller-process-write"}, "#writable-stream-default-controller-write": {"displayText":"WritableStreamDefaultControllerWrite","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"WritableStreamDefaultControllerWrite","type":"abstract-op","url":"#writable-stream-default-controller-write"}, "#writable-stream-default-writer-abort": {"displayText":"WritableStreamDefaultWriterAbort","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"WritableStreamDefaultWriterAbort","type":"abstract-op","url":"#writable-stream-default-writer-abort"}, "#writable-stream-default-writer-close": {"displayText":"WritableStreamDefaultWriterClose","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"WritableStreamDefaultWriterClose","type":"abstract-op","url":"#writable-stream-default-writer-close"}, "#writable-stream-default-writer-close-with-error-propagation": {"displayText":"WritableStreamDefaultWriterCloseWithErrorPropagation","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"WritableStreamDefaultWriterCloseWithErrorPropagation","type":"abstract-op","url":"#writable-stream-default-writer-close-with-error-propagation"}, "#writable-stream-default-writer-ensure-closed-promise-rejected": {"displayText":"WritableStreamDefaultWriterEnsureClosedPromiseRejected","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"WritableStreamDefaultWriterEnsureClosedPromiseRejected","type":"abstract-op","url":"#writable-stream-default-writer-ensure-closed-promise-rejected"}, "#writable-stream-default-writer-ensure-ready-promise-rejected": {"displayText":"WritableStreamDefaultWriterEnsureReadyPromiseRejected","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"WritableStreamDefaultWriterEnsureReadyPromiseRejected","type":"abstract-op","url":"#writable-stream-default-writer-ensure-ready-promise-rejected"}, "#writable-stream-default-writer-get-desired-size": {"displayText":"WritableStreamDefaultWriterGetDesiredSize","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"WritableStreamDefaultWriterGetDesiredSize","type":"abstract-op","url":"#writable-stream-default-writer-get-desired-size"}, "#writable-stream-default-writer-release": {"displayText":"WritableStreamDefaultWriterRelease","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"WritableStreamDefaultWriterRelease","type":"abstract-op","url":"#writable-stream-default-writer-release"}, "#writable-stream-default-writer-write": {"displayText":"WritableStreamDefaultWriterWrite","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"WritableStreamDefaultWriterWrite","type":"abstract-op","url":"#writable-stream-default-writer-write"}, "#writable-stream-finish-erroring": {"displayText":"WritableStreamFinishErroring","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"WritableStreamFinishErroring","type":"abstract-op","url":"#writable-stream-finish-erroring"}, "#writable-stream-finish-in-flight-close": {"displayText":"WritableStreamFinishInFlightClose","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"WritableStreamFinishInFlightClose","type":"abstract-op","url":"#writable-stream-finish-in-flight-close"}, "#writable-stream-finish-in-flight-close-with-error": {"displayText":"WritableStreamFinishInFlightCloseWithError","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"WritableStreamFinishInFlightCloseWithError","type":"abstract-op","url":"#writable-stream-finish-in-flight-close-with-error"}, "#writable-stream-finish-in-flight-write": {"displayText":"WritableStreamFinishInFlightWrite","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"WritableStreamFinishInFlightWrite","type":"abstract-op","url":"#writable-stream-finish-in-flight-write"}, "#writable-stream-finish-in-flight-write-with-error": {"displayText":"WritableStreamFinishInFlightWriteWithError","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"WritableStreamFinishInFlightWriteWithError","type":"abstract-op","url":"#writable-stream-finish-in-flight-write-with-error"}, "#writable-stream-has-operation-marked-in-flight": {"displayText":"WritableStreamHasOperationMarkedInFlight","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"WritableStreamHasOperationMarkedInFlight","type":"abstract-op","url":"#writable-stream-has-operation-marked-in-flight"}, "#writable-stream-mark-close-request-in-flight": {"displayText":"WritableStreamMarkCloseRequestInFlight","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"WritableStreamMarkCloseRequestInFlight","type":"abstract-op","url":"#writable-stream-mark-close-request-in-flight"}, "#writable-stream-mark-first-write-request-in-flight": {"displayText":"WritableStreamMarkFirstWriteRequestInFlight","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"WritableStreamMarkFirstWriteRequestInFlight","type":"abstract-op","url":"#writable-stream-mark-first-write-request-in-flight"}, "#writable-stream-reject-close-and-closed-promise-if-needed": {"displayText":"WritableStreamRejectCloseAndClosedPromiseIfNeeded","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"WritableStreamRejectCloseAndClosedPromiseIfNeeded","type":"abstract-op","url":"#writable-stream-reject-close-and-closed-promise-if-needed"}, "#writable-stream-start-erroring": {"displayText":"WritableStreamStartErroring","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"WritableStreamStartErroring","type":"abstract-op","url":"#writable-stream-start-erroring"}, "#writable-stream-update-backpressure": {"displayText":"WritableStreamUpdateBackpressure","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"WritableStreamUpdateBackpressure","type":"abstract-op","url":"#writable-stream-update-backpressure"}, "#writablestream": {"displayText":"WritableStream","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"WritableStream","type":"interface","url":"#writablestream"}, "#writablestream-backpressure": {"displayText":"[[backpressure]]","export":true,"for_":["WritableStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[backpressure]]","type":"dfn","url":"#writablestream-backpressure"}, "#writablestream-close": {"displayText":"close","export":true,"for_":["WritableStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"close","type":"dfn","url":"#writablestream-close"}, "#writablestream-closerequest": {"displayText":"[[closerequest]]","export":true,"for_":["WritableStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[closerequest]]","type":"dfn","url":"#writablestream-closerequest"}, "#writablestream-controller": {"displayText":"[[controller]]","export":true,"for_":["WritableStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[controller]]","type":"dfn","url":"#writablestream-controller"}, "#writablestream-inflightcloserequest": {"displayText":"[[inflightcloserequest]]","export":true,"for_":["WritableStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[inflightcloserequest]]","type":"dfn","url":"#writablestream-inflightcloserequest"}, "#writablestream-inflightwriterequest": {"displayText":"[[inflightwriterequest]]","export":true,"for_":["WritableStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[inflightwriterequest]]","type":"dfn","url":"#writablestream-inflightwriterequest"}, "#writablestream-pendingabortrequest": {"displayText":"[[pendingabortrequest]]","export":true,"for_":["WritableStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[pendingabortrequest]]","type":"dfn","url":"#writablestream-pendingabortrequest"}, "#writablestream-set-up": {"displayText":"set up","export":true,"for_":["WritableStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"set up","type":"dfn","url":"#writablestream-set-up"}, "#writablestream-set-up-writealgorithm": {"displayText":"writealgorithm","export":true,"for_":["WritableStream/set up"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"writealgorithm","type":"dfn","url":"#writablestream-set-up-writealgorithm"}, "#writablestream-signal": {"displayText":"signal","export":true,"for_":["WritableStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"signal","type":"dfn","url":"#writablestream-signal"}, "#writablestream-state": {"displayText":"[[state]]","export":true,"for_":["WritableStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[state]]","type":"dfn","url":"#writablestream-state"}, "#writablestream-storederror": {"displayText":"[[storederror]]","export":true,"for_":["WritableStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[storederror]]","type":"dfn","url":"#writablestream-storederror"}, "#writablestream-writer": {"displayText":"[[writer]]","export":true,"for_":["WritableStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[writer]]","type":"dfn","url":"#writablestream-writer"}, "#writablestream-writerequests": {"displayText":"[[writerequests]]","export":true,"for_":["WritableStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[writerequests]]","type":"dfn","url":"#writablestream-writerequests"}, "#writablestreamdefaultcontroller": {"displayText":"WritableStreamDefaultController","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"WritableStreamDefaultController","type":"interface","url":"#writablestreamdefaultcontroller"}, "#writablestreamdefaultcontroller-abortalgorithm": {"displayText":"[[abortalgorithm]]","export":true,"for_":["WritableStreamDefaultController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[abortalgorithm]]","type":"dfn","url":"#writablestreamdefaultcontroller-abortalgorithm"}, "#writablestreamdefaultcontroller-abortcontroller": {"displayText":"[[abortcontroller]]","export":true,"for_":["WritableStreamDefaultController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[abortcontroller]]","type":"dfn","url":"#writablestreamdefaultcontroller-abortcontroller"}, "#writablestreamdefaultcontroller-closealgorithm": {"displayText":"[[closealgorithm]]","export":true,"for_":["WritableStreamDefaultController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[closealgorithm]]","type":"dfn","url":"#writablestreamdefaultcontroller-closealgorithm"}, "#writablestreamdefaultcontroller-queue": {"displayText":"[[queue]]","export":true,"for_":["WritableStreamDefaultController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[queue]]","type":"dfn","url":"#writablestreamdefaultcontroller-queue"}, "#writablestreamdefaultcontroller-queuetotalsize": {"displayText":"[[queuetotalsize]]","export":true,"for_":["WritableStreamDefaultController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[queuetotalsize]]","type":"dfn","url":"#writablestreamdefaultcontroller-queuetotalsize"}, "#writablestreamdefaultcontroller-started": {"displayText":"[[started]]","export":true,"for_":["WritableStreamDefaultController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[started]]","type":"dfn","url":"#writablestreamdefaultcontroller-started"}, "#writablestreamdefaultcontroller-strategyhwm": {"displayText":"[[strategyhwm]]","export":true,"for_":["WritableStreamDefaultController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[strategyhwm]]","type":"dfn","url":"#writablestreamdefaultcontroller-strategyhwm"}, "#writablestreamdefaultcontroller-strategysizealgorithm": {"displayText":"[[strategysizealgorithm]]","export":true,"for_":["WritableStreamDefaultController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[strategysizealgorithm]]","type":"dfn","url":"#writablestreamdefaultcontroller-strategysizealgorithm"}, "#writablestreamdefaultcontroller-stream": {"displayText":"[[stream]]","export":true,"for_":["WritableStreamDefaultController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[stream]]","type":"dfn","url":"#writablestreamdefaultcontroller-stream"}, "#writablestreamdefaultcontroller-writealgorithm": {"displayText":"[[writealgorithm]]","export":true,"for_":["WritableStreamDefaultController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[writealgorithm]]","type":"dfn","url":"#writablestreamdefaultcontroller-writealgorithm"}, "#writablestreamdefaultwriter": {"displayText":"WritableStreamDefaultWriter","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"WritableStreamDefaultWriter","type":"interface","url":"#writablestreamdefaultwriter"}, "#writablestreamdefaultwriter-closedpromise": {"displayText":"[[closedpromise]]","export":true,"for_":["WritableStreamDefaultWriter"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[closedpromise]]","type":"dfn","url":"#writablestreamdefaultwriter-closedpromise"}, "#writablestreamdefaultwriter-readypromise": {"displayText":"[[readypromise]]","export":true,"for_":["WritableStreamDefaultWriter"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[readypromise]]","type":"dfn","url":"#writablestreamdefaultwriter-readypromise"}, "#writablestreamdefaultwriter-stream": {"displayText":"[[stream]]","export":true,"for_":["WritableStreamDefaultWriter"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"[[stream]]","type":"dfn","url":"#writablestreamdefaultwriter-stream"}, "#writer": {"displayText":"writer","export":true,"for_":[],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"writer","type":"dfn","url":"#writer"}, "#ws-abort": {"displayText":"abort()","export":true,"for_":["WritableStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"abort()","type":"method","url":"#ws-abort"}, "#ws-close": {"displayText":"close()","export":true,"for_":["WritableStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"close()","type":"method","url":"#ws-close"}, "#ws-constructor": {"displayText":"WritableStream()","export":true,"for_":["WritableStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"WritableStream()","type":"constructor","url":"#ws-constructor"}, "#ws-default-controller-error": {"displayText":"error(e)","export":true,"for_":["WritableStreamDefaultController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"error(e)","type":"method","url":"#ws-default-controller-error"}, "#ws-default-controller-signal": {"displayText":"signal","export":true,"for_":["WritableStreamDefaultController"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"signal","type":"attribute","url":"#ws-default-controller-signal"}, "#ws-get-writer": {"displayText":"getWriter()","export":true,"for_":["WritableStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"getWriter()","type":"method","url":"#ws-get-writer"}, "#ws-locked": {"displayText":"locked","export":true,"for_":["WritableStream"],"level":"","normative":true,"shortname":"streams","spec":"streams","status":"local","text":"locked","type":"attribute","url":"#ws-locked"}, "https://compression.spec.whatwg.org/#compressionstream": {"displayText":"CompressionStream","export":true,"for_":[],"level":"1","normative":true,"shortname":"compression","spec":"compression","status":"current","text":"CompressionStream","type":"interface","url":"https://compression.spec.whatwg.org/#compressionstream"}, "https://dom.spec.whatwg.org/#abortcontroller": {"displayText":"AbortController","export":true,"for_":[],"level":"1","normative":true,"shortname":"dom","spec":"dom","status":"current","text":"AbortController","type":"interface","url":"https://dom.spec.whatwg.org/#abortcontroller"}, "https://dom.spec.whatwg.org/#abortcontroller-signal": {"displayText":"signal","export":true,"for_":["AbortController"],"level":"1","normative":true,"shortname":"dom","spec":"dom","status":"current","text":"signal","type":"dfn","url":"https://dom.spec.whatwg.org/#abortcontroller-signal"}, "https://dom.spec.whatwg.org/#abortcontroller-signal-abort": {"displayText":"signal abort","export":true,"for_":["AbortController"],"level":"1","normative":true,"shortname":"dom","spec":"dom","status":"current","text":"signal abort","type":"dfn","url":"https://dom.spec.whatwg.org/#abortcontroller-signal-abort"}, "https://dom.spec.whatwg.org/#abortsignal": {"displayText":"AbortSignal","export":true,"for_":[],"level":"1","normative":true,"shortname":"dom","spec":"dom","status":"current","text":"AbortSignal","type":"interface","url":"https://dom.spec.whatwg.org/#abortsignal"}, "https://dom.spec.whatwg.org/#abortsignal-abort-reason": {"displayText":"abort reason","export":true,"for_":["AbortSignal"],"level":"1","normative":true,"shortname":"dom","spec":"dom","status":"current","text":"abort reason","type":"dfn","url":"https://dom.spec.whatwg.org/#abortsignal-abort-reason"}, "https://dom.spec.whatwg.org/#abortsignal-aborted": {"displayText":"aborted","export":true,"for_":["AbortSignal"],"level":"1","normative":true,"shortname":"dom","spec":"dom","status":"current","text":"aborted","type":"dfn","url":"https://dom.spec.whatwg.org/#abortsignal-aborted"}, "https://dom.spec.whatwg.org/#abortsignal-add": {"displayText":"add","export":true,"for_":["AbortSignal"],"level":"1","normative":true,"shortname":"dom","spec":"dom","status":"current","text":"add","type":"dfn","url":"https://dom.spec.whatwg.org/#abortsignal-add"}, "https://dom.spec.whatwg.org/#abortsignal-remove": {"displayText":"remove","export":true,"for_":["AbortSignal"],"level":"1","normative":true,"shortname":"dom","spec":"dom","status":"current","text":"remove","type":"dfn","url":"https://dom.spec.whatwg.org/#abortsignal-remove"}, "https://encoding.spec.whatwg.org/#textdecoderstream": {"displayText":"TextDecoderStream","export":true,"for_":[],"level":"1","normative":true,"shortname":"encoding","spec":"encoding","status":"current","text":"TextDecoderStream","type":"interface","url":"https://encoding.spec.whatwg.org/#textdecoderstream"}, "https://fetch.spec.whatwg.org/#concept-request-body": {"displayText":"body","export":true,"for_":["request"],"level":"1","normative":true,"shortname":"fetch","spec":"fetch","status":"current","text":"body","type":"dfn","url":"https://fetch.spec.whatwg.org/#concept-request-body"}, "https://fetch.spec.whatwg.org/#dom-global-fetch": {"displayText":"fetch(input)","export":true,"for_":["WindowOrWorkerGlobalScope"],"level":"1","normative":true,"shortname":"fetch","spec":"fetch","status":"current","text":"fetch(input)","type":"method","url":"https://fetch.spec.whatwg.org/#dom-global-fetch"}, "https://fetch.spec.whatwg.org/#response": {"displayText":"Response","export":true,"for_":[],"level":"1","normative":true,"shortname":"fetch","spec":"fetch","status":"current","text":"Response","type":"interface","url":"https://fetch.spec.whatwg.org/#response"}, "https://html.spec.whatwg.org/multipage/embedded-content.html#the-img-element": {"displayText":"img","export":true,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"img","type":"element","url":"https://html.spec.whatwg.org/multipage/embedded-content.html#the-img-element"}, "https://html.spec.whatwg.org/multipage/indices.html#event-message": {"displayText":"message","export":true,"for_":["Window","EventSource","MessagePort","BroadcastChannel","DedicatedWorkerGlobalScope","Worker","ServiceWorkerContainer"],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"message","type":"event","url":"https://html.spec.whatwg.org/multipage/indices.html#event-message"}, "https://html.spec.whatwg.org/multipage/indices.html#event-messageerror": {"displayText":"messageerror","export":true,"for_":["Window","MessagePort","BroadcastChannel","DedicatedWorkerGlobalScope","Worker","ServiceWorkerContainer"],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"messageerror","type":"event","url":"https://html.spec.whatwg.org/multipage/indices.html#event-messageerror"}, "https://html.spec.whatwg.org/multipage/indices.html#event-unhandledrejection": {"displayText":"unhandledrejection","export":true,"for_":["Window","WorkerGlobalScope"],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"unhandledrejection","type":"event","url":"https://html.spec.whatwg.org/multipage/indices.html#event-unhandledrejection"}, "https://html.spec.whatwg.org/multipage/infrastructure.html#in-parallel": {"displayText":"in parallel","export":true,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"in parallel","type":"dfn","url":"https://html.spec.whatwg.org/multipage/infrastructure.html#in-parallel"}, "https://html.spec.whatwg.org/multipage/structured-data.html#serializable-objects": {"displayText":"serializable object","export":true,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"serializable object","type":"dfn","url":"https://html.spec.whatwg.org/multipage/structured-data.html#serializable-objects"}, "https://html.spec.whatwg.org/multipage/structured-data.html#structureddeserialize": {"displayText":"StructuredDeserialize","export":true,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"StructuredDeserialize","type":"abstract-op","url":"https://html.spec.whatwg.org/multipage/structured-data.html#structureddeserialize"}, "https://html.spec.whatwg.org/multipage/structured-data.html#structureddeserializewithtransfer": {"displayText":"StructuredDeserializeWithTransfer","export":true,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"StructuredDeserializeWithTransfer","type":"abstract-op","url":"https://html.spec.whatwg.org/multipage/structured-data.html#structureddeserializewithtransfer"}, "https://html.spec.whatwg.org/multipage/structured-data.html#structuredserialize": {"displayText":"StructuredSerialize","export":true,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"StructuredSerialize","type":"abstract-op","url":"https://html.spec.whatwg.org/multipage/structured-data.html#structuredserialize"}, "https://html.spec.whatwg.org/multipage/structured-data.html#structuredserializewithtransfer": {"displayText":"StructuredSerializeWithTransfer","export":true,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"StructuredSerializeWithTransfer","type":"abstract-op","url":"https://html.spec.whatwg.org/multipage/structured-data.html#structuredserializewithtransfer"}, "https://html.spec.whatwg.org/multipage/structured-data.html#transfer-receiving-steps": {"displayText":"transfer-receiving steps","export":true,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"transfer-receiving steps","type":"dfn","url":"https://html.spec.whatwg.org/multipage/structured-data.html#transfer-receiving-steps"}, "https://html.spec.whatwg.org/multipage/structured-data.html#transfer-steps": {"displayText":"transfer steps","export":true,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"transfer steps","type":"dfn","url":"https://html.spec.whatwg.org/multipage/structured-data.html#transfer-steps"}, "https://html.spec.whatwg.org/multipage/structured-data.html#transferable": {"displayText":"Transferable","export":true,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"Transferable","type":"extended-attribute","url":"https://html.spec.whatwg.org/multipage/structured-data.html#transferable"}, "https://html.spec.whatwg.org/multipage/structured-data.html#transferable-objects": {"displayText":"transferable object","export":true,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"transferable object","type":"dfn","url":"https://html.spec.whatwg.org/multipage/structured-data.html#transferable-objects"}, "https://html.spec.whatwg.org/multipage/web-messaging.html#entangle": {"displayText":"entangle","export":false,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"entangle","type":"dfn","url":"https://html.spec.whatwg.org/multipage/web-messaging.html#entangle"}, "https://html.spec.whatwg.org/multipage/web-messaging.html#message-port-post-message-steps": {"displayText":"message port post message steps","export":false,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"message port post message steps","type":"dfn","url":"https://html.spec.whatwg.org/multipage/web-messaging.html#message-port-post-message-steps"}, "https://html.spec.whatwg.org/multipage/web-messaging.html#messageport": {"displayText":"MessagePort","export":true,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"MessagePort","type":"interface","url":"https://html.spec.whatwg.org/multipage/web-messaging.html#messageport"}, "https://html.spec.whatwg.org/multipage/web-messaging.html#port-message-queue": {"displayText":"port message queue","export":false,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"port message queue","type":"dfn","url":"https://html.spec.whatwg.org/multipage/web-messaging.html#port-message-queue"}, "https://html.spec.whatwg.org/multipage/webappapis.html#concept-relevant-global": {"displayText":"relevant global object","export":true,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"relevant global object","type":"dfn","url":"https://html.spec.whatwg.org/multipage/webappapis.html#concept-relevant-global"}, "https://html.spec.whatwg.org/multipage/webappapis.html#concept-relevant-realm": {"displayText":"relevant realm","export":true,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"relevant realm","type":"dfn","url":"https://html.spec.whatwg.org/multipage/webappapis.html#concept-relevant-realm"}, "https://html.spec.whatwg.org/multipage/webappapis.html#global-object": {"displayText":"global object","export":true,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"global object","type":"dfn","url":"https://html.spec.whatwg.org/multipage/webappapis.html#global-object"}, "https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-microtask": {"displayText":"queue a microtask","export":true,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"queue a microtask","type":"dfn","url":"https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-microtask"}, "https://html.spec.whatwg.org/multipage/webappapis.html#relevant-settings-object": {"displayText":"relevant settings object","export":true,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"relevant settings object","type":"dfn","url":"https://html.spec.whatwg.org/multipage/webappapis.html#relevant-settings-object"}, "https://infra.spec.whatwg.org/#byte-sequence": {"displayText":"byte sequence","export":true,"for_":[],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"byte sequence","type":"dfn","url":"https://infra.spec.whatwg.org/#byte-sequence"}, "https://infra.spec.whatwg.org/#byte-sequence-length": {"displayText":"length","export":true,"for_":["byte sequence"],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"length","type":"dfn","url":"https://infra.spec.whatwg.org/#byte-sequence-length"}, "https://infra.spec.whatwg.org/#implementation-defined": {"displayText":"implementation-defined","export":true,"for_":[],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"implementation-defined","type":"dfn","url":"https://infra.spec.whatwg.org/#implementation-defined"}, "https://infra.spec.whatwg.org/#iteration-break": {"displayText":"break","export":true,"for_":["iteration"],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"break","type":"dfn","url":"https://infra.spec.whatwg.org/#iteration-break"}, "https://infra.spec.whatwg.org/#iteration-while": {"displayText":"while","export":true,"for_":["iteration"],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"while","type":"dfn","url":"https://infra.spec.whatwg.org/#iteration-while"}, "https://infra.spec.whatwg.org/#list": {"displayText":"list","export":true,"for_":[],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"list","type":"dfn","url":"https://infra.spec.whatwg.org/#list"}, "https://infra.spec.whatwg.org/#list-append": {"displayText":"append","export":true,"for_":["list"],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"append","type":"dfn","url":"https://infra.spec.whatwg.org/#list-append"}, "https://infra.spec.whatwg.org/#list-is-empty": {"displayText":"is empty","export":true,"for_":["list","stack","queue","set"],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"is empty","type":"dfn","url":"https://infra.spec.whatwg.org/#list-is-empty"}, "https://infra.spec.whatwg.org/#list-iterate": {"displayText":"for each","export":true,"for_":["list","set"],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"for each","type":"dfn","url":"https://infra.spec.whatwg.org/#list-iterate"}, "https://infra.spec.whatwg.org/#list-remove": {"displayText":"remove","export":true,"for_":["list","set"],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"remove","type":"dfn","url":"https://infra.spec.whatwg.org/#list-remove"}, "https://infra.spec.whatwg.org/#list-size": {"displayText":"size","export":true,"for_":["list","stack","queue","set"],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"size","type":"dfn","url":"https://infra.spec.whatwg.org/#list-size"}, "https://infra.spec.whatwg.org/#map-exists": {"displayText":"exist","export":true,"for_":["map"],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"exist","type":"dfn","url":"https://infra.spec.whatwg.org/#map-exists"}, "https://infra.spec.whatwg.org/#ordered-set": {"displayText":"ordered set","export":true,"for_":[],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"ordered set","type":"dfn","url":"https://infra.spec.whatwg.org/#ordered-set"}, "https://infra.spec.whatwg.org/#set-append": {"displayText":"append","export":true,"for_":["set"],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"append","type":"dfn","url":"https://infra.spec.whatwg.org/#set-append"}, "https://infra.spec.whatwg.org/#struct": {"displayText":"struct","export":true,"for_":[],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"struct","type":"dfn","url":"https://infra.spec.whatwg.org/#struct"}, "https://infra.spec.whatwg.org/#struct-item": {"displayText":"item","export":true,"for_":["struct","tuple"],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"item","type":"dfn","url":"https://infra.spec.whatwg.org/#struct-item"}, "https://tc39.es/ecma262/#current-realm": {"displayText":"the current Realm","export":true,"for_":[],"level":"","normative":true,"shortname":"ecmascript","spec":"ecmascript","status":"anchor-block","text":"the current realm","type":"dfn","url":"https://tc39.es/ecma262/#current-realm"}, "https://tc39.es/ecma262/#sec-algorithm-conventions-abstract-operations": {"displayText":"abstract operation","export":true,"for_":[],"level":"","normative":true,"shortname":"ecmascript","spec":"ecmascript","status":"anchor-block","text":"abstract operation","type":"dfn","url":"https://tc39.es/ecma262/#sec-algorithm-conventions-abstract-operations"}, "https://tc39.es/ecma262/#sec-array-objects": {"displayText":"array","export":true,"for_":[],"level":"","normative":true,"shortname":"ecmascript","spec":"ecmascript","status":"anchor-block","text":"array","type":"dfn","url":"https://tc39.es/ecma262/#sec-array-objects"}, "https://tc39.es/ecma262/#sec-array.prototype.map": {"displayText":"map","export":true,"for_":["Array.prototype"],"level":"","normative":true,"shortname":"ecmascript","spec":"ecmascript","status":"anchor-block","text":"map","type":"method","url":"https://tc39.es/ecma262/#sec-array.prototype.map"}, "https://tc39.es/ecma262/#sec-arraybuffer-objects": {"displayText":"ArrayBuffer","export":true,"for_":[],"level":"","normative":true,"shortname":"ecmascript","spec":"ecmascript","status":"anchor-block","text":"ArrayBuffer","type":"interface","url":"https://tc39.es/ecma262/#sec-arraybuffer-objects"}, "https://tc39.es/ecma262/#sec-asyncgenerator-objects": {"displayText":"async generator","export":true,"for_":[],"level":"","normative":true,"shortname":"ecmascript","spec":"ecmascript","status":"anchor-block","text":"async generator","type":"dfn","url":"https://tc39.es/ecma262/#sec-asyncgenerator-objects"}, "https://tc39.es/ecma262/#sec-asynciterable-interface": {"displayText":"async iterable","export":true,"for_":[],"level":"","normative":true,"shortname":"ecmascript","spec":"ecmascript","status":"anchor-block","text":"async iterable","type":"dfn","url":"https://tc39.es/ecma262/#sec-asynciterable-interface"}, "https://tc39.es/ecma262/#sec-code-realms": {"displayText":"realm","export":true,"for_":[],"level":"","normative":true,"shortname":"ecmascript","spec":"ecmascript","status":"anchor-block","text":"realm","type":"dfn","url":"https://tc39.es/ecma262/#sec-code-realms"}, "https://tc39.es/ecma262/#sec-dataview-objects": {"displayText":"DataView","export":true,"for_":[],"level":"","normative":true,"shortname":"ecmascript","spec":"ecmascript","status":"anchor-block","text":"DataView","type":"interface","url":"https://tc39.es/ecma262/#sec-dataview-objects"}, "https://tc39.es/ecma262/#sec-ecmascript-language-types-number-type": {"displayText":"is not a Number","export":true,"for_":[],"level":"","normative":true,"shortname":"ecmascript","spec":"ecmascript","status":"anchor-block","text":"is not a number","type":"dfn","url":"https://tc39.es/ecma262/#sec-ecmascript-language-types-number-type"}, "https://tc39.es/ecma262/#sec-ecmascript-language-types-string-type": {"displayText":"is a String","export":true,"for_":[],"level":"","normative":true,"shortname":"ecmascript","spec":"ecmascript","status":"anchor-block","text":"is a string","type":"dfn","url":"https://tc39.es/ecma262/#sec-ecmascript-language-types-string-type"}, "https://tc39.es/ecma262/#sec-isinteger": {"displayText":"IsInteger","export":true,"for_":[],"level":"","normative":true,"shortname":"ecmascript","spec":"ecmascript","status":"anchor-block","text":"IsInteger","type":"abstract-op","url":"https://tc39.es/ecma262/#sec-isinteger"}, "https://tc39.es/ecma262/#sec-iterable-interface": {"displayText":"iterable","export":true,"for_":[],"level":"","normative":true,"shortname":"ecmascript","spec":"ecmascript","status":"anchor-block","text":"iterable","type":"dfn","url":"https://tc39.es/ecma262/#sec-iterable-interface"}, "https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror": {"displayText":"TypeError","export":true,"for_":[],"level":"","normative":true,"shortname":"ecmascript","spec":"ecmascript","status":"anchor-block","text":"TypeError","type":"exception","url":"https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-typeerror"}, "https://tc39.es/ecma262/#sec-object-internal-methods-and-internal-slots": {"displayText":"internal slot","export":true,"for_":[],"level":"","normative":true,"shortname":"ecmascript","spec":"ecmascript","status":"anchor-block","text":"internal slot","type":"dfn","url":"https://tc39.es/ecma262/#sec-object-internal-methods-and-internal-slots"}, "https://tc39.es/ecma262/#sec-object-type": {"displayText":"is not an Object","export":true,"for_":[],"level":"","normative":true,"shortname":"ecmascript","spec":"ecmascript","status":"anchor-block","text":"is not an object","type":"dfn","url":"https://tc39.es/ecma262/#sec-object-type"}, "https://tc39.es/ecma262/#sec-sharedarraybuffer-objects": {"displayText":"SharedArrayBuffer","export":true,"for_":[],"level":"","normative":true,"shortname":"ecmascript","spec":"ecmascript","status":"anchor-block","text":"SharedArrayBuffer","type":"interface","url":"https://tc39.es/ecma262/#sec-sharedarraybuffer-objects"}, "https://tc39.es/ecma262/#sec-typedarray-objects": {"displayText":"Uint8Array","export":true,"for_":[],"level":"","normative":true,"shortname":"ecmascript","spec":"ecmascript","status":"anchor-block","text":"Uint8Array","type":"interface","url":"https://tc39.es/ecma262/#sec-typedarray-objects"}, "https://tc39.es/ecma262/#table-49": {"displayText":"the typed array constructors table","export":true,"for_":[],"level":"","normative":true,"shortname":"ecmascript","spec":"ecmascript","status":"anchor-block","text":"the typed array constructors table","type":"dfn","url":"https://tc39.es/ecma262/#table-49"}, "https://tc39.es/ecma262/multipage/abstract-operations.html#sec-call": {"displayText":"Call","export":true,"for_":[],"level":"1","normative":true,"shortname":"ecmascript","spec":"ecmascript","status":"current","text":"Call","type":"abstract-op","url":"https://tc39.es/ecma262/multipage/abstract-operations.html#sec-call"}, "https://tc39.es/ecma262/multipage/abstract-operations.html#sec-construct": {"displayText":"Construct","export":true,"for_":[],"level":"1","normative":true,"shortname":"ecmascript","spec":"ecmascript","status":"current","text":"Construct","type":"abstract-op","url":"https://tc39.es/ecma262/multipage/abstract-operations.html#sec-construct"}, "https://tc39.es/ecma262/multipage/abstract-operations.html#sec-createarrayfromlist": {"displayText":"CreateArrayFromList","export":true,"for_":[],"level":"1","normative":true,"shortname":"ecmascript","spec":"ecmascript","status":"current","text":"CreateArrayFromList","type":"abstract-op","url":"https://tc39.es/ecma262/multipage/abstract-operations.html#sec-createarrayfromlist"}, "https://tc39.es/ecma262/multipage/abstract-operations.html#sec-createdataproperty": {"displayText":"CreateDataProperty","export":true,"for_":[],"level":"1","normative":true,"shortname":"ecmascript","spec":"ecmascript","status":"current","text":"CreateDataProperty","type":"abstract-op","url":"https://tc39.es/ecma262/multipage/abstract-operations.html#sec-createdataproperty"}, "https://tc39.es/ecma262/multipage/abstract-operations.html#sec-get-o-p": {"displayText":"Get","export":true,"for_":[],"level":"1","normative":true,"shortname":"ecmascript","spec":"ecmascript","status":"current","text":"Get","type":"abstract-op","url":"https://tc39.es/ecma262/multipage/abstract-operations.html#sec-get-o-p"}, "https://tc39.es/ecma262/multipage/abstract-operations.html#sec-getiterator": {"displayText":"GetIterator","export":true,"for_":[],"level":"1","normative":true,"shortname":"ecmascript","spec":"ecmascript","status":"current","text":"GetIterator","type":"abstract-op","url":"https://tc39.es/ecma262/multipage/abstract-operations.html#sec-getiterator"}, "https://tc39.es/ecma262/multipage/abstract-operations.html#sec-getmethod": {"displayText":"GetMethod","export":true,"for_":[],"level":"1","normative":true,"shortname":"ecmascript","spec":"ecmascript","status":"current","text":"GetMethod","type":"abstract-op","url":"https://tc39.es/ecma262/multipage/abstract-operations.html#sec-getmethod"}, "https://tc39.es/ecma262/multipage/abstract-operations.html#sec-getv": {"displayText":"GetV","export":true,"for_":[],"level":"1","normative":true,"shortname":"ecmascript","spec":"ecmascript","status":"current","text":"GetV","type":"abstract-op","url":"https://tc39.es/ecma262/multipage/abstract-operations.html#sec-getv"}, "https://tc39.es/ecma262/multipage/abstract-operations.html#sec-iteratorcomplete": {"displayText":"IteratorComplete","export":true,"for_":[],"level":"1","normative":true,"shortname":"ecmascript","spec":"ecmascript","status":"current","text":"IteratorComplete","type":"abstract-op","url":"https://tc39.es/ecma262/multipage/abstract-operations.html#sec-iteratorcomplete"}, "https://tc39.es/ecma262/multipage/abstract-operations.html#sec-iteratornext": {"displayText":"IteratorNext","export":true,"for_":[],"level":"1","normative":true,"shortname":"ecmascript","spec":"ecmascript","status":"current","text":"IteratorNext","type":"abstract-op","url":"https://tc39.es/ecma262/multipage/abstract-operations.html#sec-iteratornext"}, "https://tc39.es/ecma262/multipage/abstract-operations.html#sec-iteratorvalue": {"displayText":"IteratorValue","export":true,"for_":[],"level":"1","normative":true,"shortname":"ecmascript","spec":"ecmascript","status":"current","text":"IteratorValue","type":"abstract-op","url":"https://tc39.es/ecma262/multipage/abstract-operations.html#sec-iteratorvalue"}, "https://tc39.es/ecma262/multipage/abstract-operations.html#sec-samevalue": {"displayText":"SameValue","export":true,"for_":[],"level":"1","normative":true,"shortname":"ecmascript","spec":"ecmascript","status":"current","text":"SameValue","type":"abstract-op","url":"https://tc39.es/ecma262/multipage/abstract-operations.html#sec-samevalue"}, "https://tc39.es/ecma262/multipage/ecmascript-data-types-and-values.html#sec-completion-record-specification-type": {"displayText":"Completion Records","export":true,"for_":["ECMAScript"],"level":"1","normative":true,"shortname":"ecmascript","spec":"ecmascript","status":"current","text":"completion records","type":"dfn","url":"https://tc39.es/ecma262/multipage/ecmascript-data-types-and-values.html#sec-completion-record-specification-type"}, "https://tc39.es/ecma262/multipage/ecmascript-data-types-and-values.html#sec-copydatablockbytes": {"displayText":"CopyDataBlockBytes","export":true,"for_":[],"level":"1","normative":true,"shortname":"ecmascript","spec":"ecmascript","status":"current","text":"CopyDataBlockBytes","type":"abstract-op","url":"https://tc39.es/ecma262/multipage/ecmascript-data-types-and-values.html#sec-copydatablockbytes"}, "https://tc39.es/ecma262/multipage/ecmascript-data-types-and-values.html#sec-ecmascript-language-types-number-type": {"displayText":"number type","export":true,"for_":["ECMAScript"],"level":"1","normative":true,"shortname":"ecmascript","spec":"ecmascript","status":"current","text":"number type","type":"dfn","url":"https://tc39.es/ecma262/multipage/ecmascript-data-types-and-values.html#sec-ecmascript-language-types-number-type"}, "https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-properties-of-the-object-prototype-object": {"displayText":"%Object.prototype%","export":true,"for_":[],"level":"1","normative":true,"shortname":"ecmascript","spec":"ecmascript","status":"current","text":"%Object.prototype%","type":"interface","url":"https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-properties-of-the-object-prototype-object"}, "https://tc39.es/ecma262/multipage/indexed-collections.html#sec-typedarray-objects": {"displayText":"%Uint8Array%","export":true,"for_":[],"level":"1","normative":true,"shortname":"ecmascript","spec":"ecmascript","status":"current","text":"%Uint8Array%","type":"interface","url":"https://tc39.es/ecma262/multipage/indexed-collections.html#sec-typedarray-objects"}, "https://tc39.es/ecma262/multipage/numbers-and-dates.html#sec-number-objects": {"displayText":"Number","export":true,"for_":[],"level":"1","normative":true,"shortname":"ecmascript","spec":"ecmascript","status":"current","text":"Number","type":"interface","url":"https://tc39.es/ecma262/multipage/numbers-and-dates.html#sec-number-objects"}, "https://tc39.es/ecma262/multipage/ordinary-and-exotic-objects-behaviours.html#sec-createbuiltinfunction": {"displayText":"CreateBuiltinFunction","export":true,"for_":[],"level":"1","normative":true,"shortname":"ecmascript","spec":"ecmascript","status":"current","text":"CreateBuiltinFunction","type":"abstract-op","url":"https://tc39.es/ecma262/multipage/ordinary-and-exotic-objects-behaviours.html#sec-createbuiltinfunction"}, "https://tc39.es/ecma262/multipage/ordinary-and-exotic-objects-behaviours.html#sec-ordinaryobjectcreate": {"displayText":"OrdinaryObjectCreate","export":true,"for_":[],"level":"1","normative":true,"shortname":"ecmascript","spec":"ecmascript","status":"current","text":"OrdinaryObjectCreate","type":"abstract-op","url":"https://tc39.es/ecma262/multipage/ordinary-and-exotic-objects-behaviours.html#sec-ordinaryobjectcreate"}, "https://tc39.es/ecma262/multipage/structured-data.html#sec-arraybuffer-constructor": {"displayText":"%ArrayBuffer%","export":true,"for_":[],"level":"1","normative":true,"shortname":"ecmascript","spec":"ecmascript","status":"current","text":"%ArrayBuffer%","type":"interface","url":"https://tc39.es/ecma262/multipage/structured-data.html#sec-arraybuffer-constructor"}, "https://tc39.es/ecma262/multipage/structured-data.html#sec-clonearraybuffer": {"displayText":"CloneArrayBuffer","export":true,"for_":[],"level":"1","normative":true,"shortname":"ecmascript","spec":"ecmascript","status":"current","text":"CloneArrayBuffer","type":"abstract-op","url":"https://tc39.es/ecma262/multipage/structured-data.html#sec-clonearraybuffer"}, "https://tc39.es/ecma262/multipage/structured-data.html#sec-dataview-constructor": {"displayText":"%DataView%","export":true,"for_":[],"level":"1","normative":true,"shortname":"ecmascript","spec":"ecmascript","status":"current","text":"%DataView%","type":"interface","url":"https://tc39.es/ecma262/multipage/structured-data.html#sec-dataview-constructor"}, "https://tc39.es/ecma262/multipage/structured-data.html#sec-detacharraybuffer": {"displayText":"DetachArrayBuffer","export":true,"for_":[],"level":"1","normative":true,"shortname":"ecmascript","spec":"ecmascript","status":"current","text":"DetachArrayBuffer","type":"abstract-op","url":"https://tc39.es/ecma262/multipage/structured-data.html#sec-detacharraybuffer"}, "https://tc39.es/ecma262/multipage/structured-data.html#sec-isdetachedbuffer": {"displayText":"IsDetachedBuffer","export":true,"for_":[],"level":"1","normative":true,"shortname":"ecmascript","spec":"ecmascript","status":"current","text":"IsDetachedBuffer","type":"abstract-op","url":"https://tc39.es/ecma262/multipage/structured-data.html#sec-isdetachedbuffer"}, "https://w3c.github.io/ServiceWorker/#service-worker-global-scope-fetch-event": {"displayText":"fetch","export":true,"for_":["ServiceWorkerGlobalScope"],"level":"1","normative":true,"shortname":"service-workers","spec":"service-workers","status":"current","text":"fetch","type":"event","url":"https://w3c.github.io/ServiceWorker/#service-worker-global-scope-fetch-event"}, "https://w3c.github.io/webrtc-encoded-transform/#rtcrtpscripttransformer": {"displayText":"RTCRtpScriptTransformer","export":true,"for_":[],"level":"1","normative":true,"shortname":"webrtc-encoded-transform","spec":"webrtc-encoded-transform","status":"current","text":"RTCRtpScriptTransformer","type":"interface","url":"https://w3c.github.io/webrtc-encoded-transform/#rtcrtpscripttransformer"}, "https://webassembly.github.io/spec/js-api/#dom-memory-buffer": {"displayText":"buffer","export":true,"for_":["Memory"],"level":"2","normative":true,"shortname":"wasm-js-api","spec":"wasm-js-api-2","status":"current","text":"buffer","type":"attribute","url":"https://webassembly.github.io/spec/js-api/#dom-memory-buffer"}, "https://webassembly.github.io/spec/js-api/#memory": {"displayText":"Memory","export":true,"for_":[],"level":"2","normative":true,"shortname":"wasm-js-api","spec":"wasm-js-api-2","status":"current","text":"Memory","type":"interface","url":"https://webassembly.github.io/spec/js-api/#memory"}, "https://webidl.spec.whatwg.org/#ArrayBufferView": {"displayText":"ArrayBufferView","export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"ArrayBufferView","type":"typedef","url":"https://webidl.spec.whatwg.org/#ArrayBufferView"}, "https://webidl.spec.whatwg.org/#EnforceRange": {"displayText":"EnforceRange","export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"EnforceRange","type":"extended-attribute","url":"https://webidl.spec.whatwg.org/#EnforceRange"}, "https://webidl.spec.whatwg.org/#Function": {"displayText":"Function","export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"Function","type":"callback","url":"https://webidl.spec.whatwg.org/#Function"}, "https://webidl.spec.whatwg.org/#a-new-promise": {"displayText":"a new promise","export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"a new promise","type":"dfn","url":"https://webidl.spec.whatwg.org/#a-new-promise"}, "https://webidl.spec.whatwg.org/#a-promise-rejected-with": {"displayText":"a promise rejected with","export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"a promise rejected with","type":"dfn","url":"https://webidl.spec.whatwg.org/#a-promise-rejected-with"}, "https://webidl.spec.whatwg.org/#a-promise-resolved-with": {"displayText":"a promise resolved with","export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"a promise resolved with","type":"dfn","url":"https://webidl.spec.whatwg.org/#a-promise-resolved-with"}, "https://webidl.spec.whatwg.org/#arraybuffer-transfer": {"displayText":"transfer","export":true,"for_":["ArrayBuffer"],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"transfer","type":"dfn","url":"https://webidl.spec.whatwg.org/#arraybuffer-transfer"}, "https://webidl.spec.whatwg.org/#arraybuffer-write": {"displayText":"write","export":true,"for_":["ArrayBuffer","SharedArrayBuffer"],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"write","type":"dfn","url":"https://webidl.spec.whatwg.org/#arraybuffer-write"}, "https://webidl.spec.whatwg.org/#arraybufferview-create": {"displayText":"create","export":true,"for_":["ArrayBufferView"],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"create","type":"dfn","url":"https://webidl.spec.whatwg.org/#arraybufferview-create"}, "https://webidl.spec.whatwg.org/#arraybufferview-write": {"displayText":"write","export":true,"for_":["ArrayBufferView"],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"write","type":"dfn","url":"https://webidl.spec.whatwg.org/#arraybufferview-write"}, "https://webidl.spec.whatwg.org/#asynchronous-iterator-initialization-steps": {"displayText":"asynchronous iterator initialization steps","export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"asynchronous iterator initialization steps","type":"dfn","url":"https://webidl.spec.whatwg.org/#asynchronous-iterator-initialization-steps"}, "https://webidl.spec.whatwg.org/#asynchronous-iterator-return": {"displayText":"asynchronous iterator return","export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"asynchronous iterator return","type":"dfn","url":"https://webidl.spec.whatwg.org/#asynchronous-iterator-return"}, "https://webidl.spec.whatwg.org/#buffersource-byte-length": {"displayText":"byte length","export":true,"for_":["BufferSource"],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"byte length","type":"dfn","url":"https://webidl.spec.whatwg.org/#buffersource-byte-length"}, "https://webidl.spec.whatwg.org/#buffersource-underlying-buffer": {"displayText":"underlying buffer","export":true,"for_":["BufferSource"],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"underlying buffer","type":"dfn","url":"https://webidl.spec.whatwg.org/#buffersource-underlying-buffer"}, "https://webidl.spec.whatwg.org/#constructor-steps": {"displayText":"constructor steps","export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"constructor steps","type":"dfn","url":"https://webidl.spec.whatwg.org/#constructor-steps"}, "https://webidl.spec.whatwg.org/#datacloneerror": {"displayText":"DataCloneError","export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"DataCloneError","type":"exception","url":"https://webidl.spec.whatwg.org/#datacloneerror"}, "https://webidl.spec.whatwg.org/#dfn-callback-context": {"displayText":"callback context","export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"callback context","type":"dfn","url":"https://webidl.spec.whatwg.org/#dfn-callback-context"}, "https://webidl.spec.whatwg.org/#dfn-callback-this-value": {"displayText":"callback this value","export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"callback this value","type":"dfn","url":"https://webidl.spec.whatwg.org/#dfn-callback-this-value"}, "https://webidl.spec.whatwg.org/#dfn-convert-ecmascript-to-idl-value": {"displayText":"converted to an IDL value","export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"converted to an idl value","type":"dfn","url":"https://webidl.spec.whatwg.org/#dfn-convert-ecmascript-to-idl-value"}, "https://webidl.spec.whatwg.org/#dfn-detach": {"displayText":"detach","export":true,"for_":["ArrayBuffer"],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"detach","type":"dfn","url":"https://webidl.spec.whatwg.org/#dfn-detach"}, "https://webidl.spec.whatwg.org/#dfn-get-buffer-source-copy": {"displayText":"get a copy of the bytes held by the buffer source","export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"get a copy of the bytes held by the buffer source","type":"dfn","url":"https://webidl.spec.whatwg.org/#dfn-get-buffer-source-copy"}, "https://webidl.spec.whatwg.org/#dfn-get-the-next-iteration-result": {"displayText":"get the next iteration result","export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"get the next iteration result","type":"dfn","url":"https://webidl.spec.whatwg.org/#dfn-get-the-next-iteration-result"}, "https://webidl.spec.whatwg.org/#dfn-perform-steps-once-promise-is-settled": {"displayText":"reacting","export":true,"for_":["promise"],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"reacting","type":"dfn","url":"https://webidl.spec.whatwg.org/#dfn-perform-steps-once-promise-is-settled"}, "https://webidl.spec.whatwg.org/#dfn-platform-object": {"displayText":"platform object","export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"platform object","type":"dfn","url":"https://webidl.spec.whatwg.org/#dfn-platform-object"}, "https://webidl.spec.whatwg.org/#end-of-iteration": {"displayText":"end of iteration","export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"end of iteration","type":"dfn","url":"https://webidl.spec.whatwg.org/#end-of-iteration"}, "https://webidl.spec.whatwg.org/#exceptiondef-rangeerror": {"displayText":"RangeError","export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"RangeError","type":"exception","url":"https://webidl.spec.whatwg.org/#exceptiondef-rangeerror"}, "https://webidl.spec.whatwg.org/#idl-DOMException": {"displayText":"DOMException","export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"DOMException","type":"interface","url":"https://webidl.spec.whatwg.org/#idl-DOMException"}, "https://webidl.spec.whatwg.org/#idl-any": {"displayText":"any","export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"any","type":"interface","url":"https://webidl.spec.whatwg.org/#idl-any"}, "https://webidl.spec.whatwg.org/#idl-boolean": {"displayText":"boolean","export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"boolean","type":"interface","url":"https://webidl.spec.whatwg.org/#idl-boolean"}, "https://webidl.spec.whatwg.org/#idl-object": {"displayText":"object","export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"object","type":"interface","url":"https://webidl.spec.whatwg.org/#idl-object"}, "https://webidl.spec.whatwg.org/#idl-promise": {"displayText":"Promise","export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"Promise","type":"interface","url":"https://webidl.spec.whatwg.org/#idl-promise"}, "https://webidl.spec.whatwg.org/#idl-sequence": {"displayText":"sequence","export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"sequence","type":"dfn","url":"https://webidl.spec.whatwg.org/#idl-sequence"}, "https://webidl.spec.whatwg.org/#idl-undefined": {"displayText":"undefined","export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"undefined","type":"interface","url":"https://webidl.spec.whatwg.org/#idl-undefined"}, "https://webidl.spec.whatwg.org/#idl-unrestricted-double": {"displayText":"unrestricted double","export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"unrestricted double","type":"interface","url":"https://webidl.spec.whatwg.org/#idl-unrestricted-double"}, "https://webidl.spec.whatwg.org/#idl-unsigned-long-long": {"displayText":"unsigned long long","export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"unsigned long long","type":"interface","url":"https://webidl.spec.whatwg.org/#idl-unsigned-long-long"}, "https://webidl.spec.whatwg.org/#implements": {"displayText":"implements","export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"implements","type":"dfn","url":"https://webidl.spec.whatwg.org/#implements"}, "https://webidl.spec.whatwg.org/#include": {"displayText":"include","export":true,"for_":["interface"],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"include","type":"dfn","url":"https://webidl.spec.whatwg.org/#include"}, "https://webidl.spec.whatwg.org/#invoke-a-callback-function": {"displayText":"invoke","export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"invoke","type":"dfn","url":"https://webidl.spec.whatwg.org/#invoke-a-callback-function"}, "https://webidl.spec.whatwg.org/#new": {"displayText":"new","export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"new","type":"dfn","url":"https://webidl.spec.whatwg.org/#new"}, "https://webidl.spec.whatwg.org/#reject": {"displayText":"reject","export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"reject","type":"dfn","url":"https://webidl.spec.whatwg.org/#reject"}, "https://webidl.spec.whatwg.org/#resolve": {"displayText":"resolve","export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"resolve","type":"dfn","url":"https://webidl.spec.whatwg.org/#resolve"}, "https://webidl.spec.whatwg.org/#this": {"displayText":"this","export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"this","type":"dfn","url":"https://webidl.spec.whatwg.org/#this"}, "https://webidl.spec.whatwg.org/#upon-fulfillment": {"displayText":"upon fulfillment","export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"upon fulfillment","type":"dfn","url":"https://webidl.spec.whatwg.org/#upon-fulfillment"}, "https://webidl.spec.whatwg.org/#upon-rejection": {"displayText":"upon rejection","export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"upon rejection","type":"dfn","url":"https://webidl.spec.whatwg.org/#upon-rejection"}, "https://webidl.spec.whatwg.org/#waiting-for-all-promise": {"displayText":"getting a promise to wait for all","export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"getting a promise to wait for all","type":"dfn","url":"https://webidl.spec.whatwg.org/#waiting-for-all-promise"}, "https://websockets.spec.whatwg.org/#dom-websocket-bufferedamount": {"displayText":"bufferedAmount","export":true,"for_":["WebSocket"],"level":"1","normative":true,"shortname":"websockets","spec":"websockets","status":"current","text":"bufferedAmount","type":"attribute","url":"https://websockets.spec.whatwg.org/#dom-websocket-bufferedamount"}, "https://websockets.spec.whatwg.org/#websocket": {"displayText":"WebSocket","export":true,"for_":[],"level":"1","normative":true,"shortname":"websockets","spec":"websockets","status":"current","text":"WebSocket","type":"interface","url":"https://websockets.spec.whatwg.org/#websocket"}, }; function mkRefHint(link, ref) { const linkText = link.textContent; let dfnTextElements = ''; if (ref.displayText.toLowerCase() != linkText.toLowerCase()) { // Give the original term if it's being displayed in a different way. // But allow casing differences, they're insignificant. dfnTextElements = mk.li({}, mk.b({}, "Term: "), mk.span({}, ref.displayText) ); } const forList = ref.for_; let forListElements; if(forList.length == 0) { forListElements = []; } else if(forList.length == 1) { forListElements = mk.li({}, mk.b({}, "For: "), mk.span({}, forList[0]), ); } else { forListElements = mk.li({}, mk.b({}, "For: "), mk.ul({}, ...forList.map(forItem => mk.li({}, mk.span({}, forItem) ), ), ), ); } const url = ref.url; const safeUrl = encodeURIComponent(url); const hintPanel = mk.aside({ class: "ref-hint", id: `ref-hint-for-${safeUrl}`, "data-for": url, "aria-labelled-by": `ref-hint-for-${safeUrl}`, }, mk.ul({}, dfnTextElements, mk.li({}, mk.b({}, "URL: "), mk.a({ href: url, class: "ref" }, url), ), mk.li({}, mk.b({}, "Type: "), mk.span({}, `${ref.type}`), ), mk.li({}, mk.b({}, "Spec: "), mk.span({}, `${ref.spec ? ref.spec : ''}`), ), forListElements ), ); hintPanel.forLink = link; setupRefHintEventListeners(link, hintPanel); return hintPanel; } function hideAllRefHints() { queryAll(".ref-hint").forEach(el=>hideRefHint(el)); } function hideRefHint(refHint) { const link = refHint.forLink; link.setAttribute("aria-expanded", "false"); if(refHint.teardownEventListeners) { refHint.teardownEventListeners(); } refHint.remove(); } function showRefHint(link) { if(link.classList.contains("dfn-link")) return; const url = link.getAttribute("href"); const ref = refsData[url]; if(!ref) return; hideAllRefHints(); // Only display one at this time. const refHint = mkRefHint(link, ref); append(document.body, refHint); link.setAttribute("aria-expanded", "true"); positionRefHint(refHint); } function setupRefHintEventListeners(link, refHint) { if (refHint.teardownEventListeners) return; // Add event handlers to hide the refHint after the user moves away // from both the link and refHint, if not hovering either within one second. let timeout = null; const startHidingRefHint = (event) => { if (timeout) { clearTimeout(timeout); } timeout = setTimeout(() => { hideRefHint(refHint); }, 1000); } const resetHidingRefHint = (event) => { if (timeout) clearTimeout(timeout); timeout = null; }; link.addEventListener("mouseleave", startHidingRefHint); link.addEventListener("mouseenter", resetHidingRefHint); link.addEventListener("blur", startHidingRefHint); link.addEventListener("focus", resetHidingRefHint); refHint.addEventListener("mouseleave", startHidingRefHint); refHint.addEventListener("mouseenter", resetHidingRefHint); refHint.addEventListener("blur", startHidingRefHint); refHint.addEventListener("focus", resetHidingRefHint); refHint.teardownEventListeners = () => { // remove event listeners resetHidingRefHint(); link.removeEventListener("mouseleave", startHidingRefHint); link.removeEventListener("mouseenter", resetHidingRefHint); link.removeEventListener("blur", startHidingRefHint); link.removeEventListener("focus", resetHidingRefHint); refHint.removeEventListener("mouseleave", startHidingRefHint); refHint.removeEventListener("mouseenter", resetHidingRefHint); refHint.removeEventListener("blur", startHidingRefHint); refHint.removeEventListener("focus", resetHidingRefHint); }; } function positionRefHint(refHint) { const link = refHint.forLink; const linkPos = getBounds(link); refHint.style.top = linkPos.bottom + "px"; refHint.style.left = linkPos.left + "px"; const panelPos = refHint.getBoundingClientRect(); const panelMargin = 8; const maxRight = document.body.parentNode.clientWidth - panelMargin; if (panelPos.right > maxRight) { const overflowAmount = panelPos.right - maxRight; const newLeft = Math.max(panelMargin, linkPos.left - overflowAmount); refHint.style.left = newLeft + "px"; } } // TODO: shared util // Returns the root-level absolute position {left and top} of element. function getBounds(el, relativeTo=document.body) { const relativeRect = relativeTo.getBoundingClientRect(); const elRect = el.getBoundingClientRect(); const top = elRect.top - relativeRect.top; const left = elRect.left - relativeRect.left; return { top, left, bottom: top + elRect.height, right: left + elRect.width, } } function showRefHintListener(e) { // If the target isn't in a link (or is a link), // just ignore it. let link = e.target.closest("a"); if(!link) return; // If the target is in a ref-hint panel // (aka a link in the already-open one), // also just ignore it. if(link.closest(".ref-hint")) return; // Otherwise, show the panel for the link. showRefHint(link); } function hideAllHintsListener(e) { // If the click is inside a ref-hint panel, ignore it. if(e.target.closest(".ref-hint")) return; // Otherwise, close all the current panels. hideAllRefHints(); } document.addEventListener("DOMContentLoaded", () => { document.body.addEventListener("mousedown", showRefHintListener); document.body.addEventListener("focus", showRefHintListener); document.body.addEventListener("click", hideAllHintsListener); }); window.addEventListener("resize", () => { // Hide any open ref hint. hideAllRefHints(); }); } </script> <script>/* Boilerplate: script-var-click-highlighting */ "use strict"; { /* Color-choosing design: * Colors are ordered by goodness. * On clicking a var, give it the earliest color with the lowest usage in the algorithm. * On re-clicking, re-use the var's most recent color if that's not currently being used elsewhere. */ const COLOR_COUNT = 7; document.addEventListener("click", e=>{ if(e.target.nodeName == "VAR") { highlightSameAlgoVars(e.target); } }); function highlightSameAlgoVars(v) { // Find the algorithm container. let algoContainer = findAlgoContainer(v); // Not highlighting document-global vars, // too likely to be unrelated. if(algoContainer == null) return; const varName = nameFromVar(v); if(!v.hasAttribute("data-var-color")) { const newColor = chooseHighlightColor(algoContainer, v); for(const el of algoContainer.querySelectorAll("var")) { if(nameFromVar(el) == varName) { el.setAttribute("data-var-color", newColor); el.setAttribute("data-var-last-color", newColor); } } } else { for(const el of algoContainer.querySelectorAll("var")) { if(nameFromVar(el) == varName) { el.removeAttribute("data-var-color"); } } } } function findAlgoContainer(el) { while(el != document.body) { if(el.hasAttribute("data-algorithm")) return el; el = el.parentNode; } return null; } function nameFromVar(el) { return el.textContent.replace(/(\s|\xa0)+/g, " ").trim(); } function colorCountsFromContainer(container) { const namesFromColor = Array.from({length:COLOR_COUNT}, x=>new Set()); for(let v of container.querySelectorAll("var[data-var-color]")) { let color = +v.getAttribute("data-var-color"); namesFromColor[color].add(nameFromVar(v)); } return namesFromColor.map(x=>x.size); } function leastUsedColor(colors) { // Find the earliest color with the lowest count. let minCount = Infinity; let minColor = null; for(var i = 0; i < colors.length; i++) { if(colors[i] < minCount) { minColor = i; minCount = colors[i]; } } return minColor; } function chooseHighlightColor(container, v) { const colorCounts = colorCountsFromContainer(container); if(v.hasAttribute("data-var-last-color")) { let color = +v.getAttribute("data-var-last-color"); if(colorCounts[color] == 0) return color; } return leastUsedColor(colorCounts); } } </script>