1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/.
6 * The origin of this IDL file is
7 * https://streams.spec.whatwg.org/#rs-class-definition
10 [Exposed=*] // [Transferable] - See Bug 1562065
11 interface ReadableStream {
13 constructor(optional object underlyingSource, optional QueuingStrategy strategy = {});
15 [Pref="dom.streams.from.enabled", Throws]
16 static ReadableStream from(any asyncIterable);
18 readonly attribute boolean locked;
21 Promise<undefined> cancel(optional any reason);
24 ReadableStreamReader getReader(optional ReadableStreamGetReaderOptions options = {});
27 ReadableStream pipeThrough(ReadableWritablePair transform, optional StreamPipeOptions options = {});
30 Promise<undefined> pipeTo(WritableStream destination, optional StreamPipeOptions options = {});
33 sequence<ReadableStream> tee();
35 [GenerateReturnMethod]
36 async iterable<any>(optional ReadableStreamIteratorOptions options = {});
39 enum ReadableStreamReaderMode { "byob" };
41 dictionary ReadableStreamGetReaderOptions {
42 ReadableStreamReaderMode mode;
45 dictionary ReadableStreamIteratorOptions {
46 boolean preventCancel = false;
49 dictionary ReadableWritablePair {
50 required ReadableStream readable;
51 required WritableStream writable;
54 dictionary StreamPipeOptions {
55 boolean preventClose = false;
56 boolean preventAbort = false;
57 boolean preventCancel = false;