2024-04-06 19:02:28 +02:00
|
|
|
#import <DOM/AbortSignal.idl>
|
2023-06-18 21:57:07 +12:00
|
|
|
#import <Streams/QueuingStrategy.idl>
|
2023-04-09 01:26:48 -07:00
|
|
|
#import <Streams/ReadableStreamBYOBReader.idl>
|
2023-03-28 20:01:04 -07:00
|
|
|
#import <Streams/ReadableStreamDefaultReader.idl>
|
2024-04-06 19:02:28 +02:00
|
|
|
#import <Streams/WritableStream.idl>
|
|
|
|
|
|
2024-04-07 13:01:33 +02:00
|
|
|
dictionary ReadableWritablePair {
|
|
|
|
|
required ReadableStream readable;
|
|
|
|
|
required WritableStream writable;
|
|
|
|
|
};
|
|
|
|
|
|
2024-04-06 19:02:28 +02:00
|
|
|
dictionary StreamPipeOptions {
|
|
|
|
|
boolean preventClose = false;
|
|
|
|
|
boolean preventAbort = false;
|
|
|
|
|
boolean preventCancel = false;
|
|
|
|
|
AbortSignal signal;
|
|
|
|
|
};
|
2022-09-21 23:27:13 +01:00
|
|
|
|
2023-06-29 20:53:19 +12:00
|
|
|
// https://streams.spec.whatwg.org/#enumdef-readablestreamreadermode
|
|
|
|
|
enum ReadableStreamReaderMode { "byob" };
|
|
|
|
|
|
|
|
|
|
// https://streams.spec.whatwg.org/#dictdef-readablestreamgetreaderoptions
|
|
|
|
|
dictionary ReadableStreamGetReaderOptions {
|
|
|
|
|
ReadableStreamReaderMode mode;
|
|
|
|
|
};
|
|
|
|
|
|
2022-09-21 23:27:13 +01:00
|
|
|
// https://streams.spec.whatwg.org/#readablestream
|
2022-10-07 16:45:09 -06:00
|
|
|
[Exposed=*, Transferable]
|
2022-09-21 23:27:13 +01:00
|
|
|
interface ReadableStream {
|
2023-06-18 21:57:07 +12:00
|
|
|
constructor(optional object underlyingSource, optional QueuingStrategy strategy = {});
|
2023-03-28 20:01:04 -07:00
|
|
|
|
2024-06-08 10:44:35 +02:00
|
|
|
static ReadableStream from(any asyncIterable);
|
2023-10-25 17:27:19 +02:00
|
|
|
|
2023-03-28 20:01:04 -07:00
|
|
|
readonly attribute boolean locked;
|
|
|
|
|
|
|
|
|
|
Promise<undefined> cancel(optional any reason);
|
2023-06-29 20:53:19 +12:00
|
|
|
ReadableStreamReader getReader(optional ReadableStreamGetReaderOptions options = {});
|
2024-04-07 13:01:33 +02:00
|
|
|
ReadableStream pipeThrough(ReadableWritablePair transform, optional StreamPipeOptions options = {});
|
2024-04-06 19:02:28 +02:00
|
|
|
Promise<undefined> pipeTo(WritableStream destination, optional StreamPipeOptions options = {});
|
2024-01-28 10:28:59 -05:00
|
|
|
sequence<ReadableStream> tee();
|
2023-10-25 17:27:19 +02:00
|
|
|
|
|
|
|
|
// FIXME: async iterable<any>(optional ReadableStreamIteratorOptions options = {});
|
2022-09-21 23:27:13 +01:00
|
|
|
};
|
2023-03-28 20:01:04 -07:00
|
|
|
|
2023-04-09 01:26:48 -07:00
|
|
|
typedef (ReadableStreamDefaultReader or ReadableStreamBYOBReader) ReadableStreamReader;
|