ReadableStream.webidl (1666B)
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/. 5 * 6 * The origin of this IDL file is 7 * https://streams.spec.whatwg.org/#rs-class-definition 8 */ 9 10 [Exposed=*] // [Transferable] - See Bug 1562065 11 interface ReadableStream { 12 [Throws] 13 constructor(optional object underlyingSource, optional QueuingStrategy strategy = {}); 14 15 [Throws] 16 static ReadableStream from(any asyncIterable); 17 18 readonly attribute boolean locked; 19 20 [NewObject] 21 Promise<undefined> cancel(optional any reason); 22 23 [Throws] 24 ReadableStreamReader getReader(optional ReadableStreamGetReaderOptions options = {}); 25 26 [Throws] 27 ReadableStream pipeThrough(ReadableWritablePair transform, optional StreamPipeOptions options = {}); 28 29 [NewObject] 30 Promise<undefined> pipeTo(WritableStream destination, optional StreamPipeOptions options = {}); 31 32 [Throws] 33 sequence<ReadableStream> tee(); 34 35 [GenerateReturnMethod] 36 async_iterable<any>(optional ReadableStreamIteratorOptions options = {}); 37 }; 38 39 enum ReadableStreamReaderMode { "byob" }; 40 41 dictionary ReadableStreamGetReaderOptions { 42 ReadableStreamReaderMode mode; 43 }; 44 45 dictionary ReadableStreamIteratorOptions { 46 boolean preventCancel = false; 47 }; 48 49 dictionary ReadableWritablePair { 50 required ReadableStream readable; 51 required WritableStream writable; 52 }; 53 54 dictionary StreamPipeOptions { 55 boolean preventClose = false; 56 boolean preventAbort = false; 57 boolean preventCancel = false; 58 AbortSignal signal; 59 };