mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-21 00:38:56 +00:00
LibWeb: Implement ReadableStream.pipeTo()
This commit is contained in:
parent
559d983fa1
commit
d3b2cd8ab6
Notes:
sideshowbarker
2024-07-16 22:18:54 +09:00
Author: https://github.com/kennethmyhra
Commit: d3b2cd8ab6
Pull-request: https://github.com/SerenityOS/serenity/pull/23869
Reviewed-by: https://github.com/shannonbooth ✅
3 changed files with 46 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Linus Groh <linusg@serenityos.org>
|
||||
* Copyright (c) 2024, Kenneth Myhra <kennethmyhra@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -26,6 +27,13 @@ struct ReadableStreamGetReaderOptions {
|
|||
Optional<Bindings::ReadableStreamReaderMode> mode;
|
||||
};
|
||||
|
||||
struct StreamPipeOptions {
|
||||
bool prevent_close { false };
|
||||
bool prevent_abort { false };
|
||||
bool prevent_cancel { false };
|
||||
Optional<JS::NonnullGCPtr<DOM::AbortSignal>> signal;
|
||||
};
|
||||
|
||||
struct ReadableStreamPair {
|
||||
// Define a couple container-like methods so this type may be used as the return type of the IDL `tee` implementation.
|
||||
size_t size() const { return 2; }
|
||||
|
@ -62,6 +70,7 @@ public:
|
|||
bool locked() const;
|
||||
WebIDL::ExceptionOr<JS::GCPtr<JS::Object>> cancel(JS::Value reason);
|
||||
WebIDL::ExceptionOr<ReadableStreamReader> get_reader(ReadableStreamGetReaderOptions const& = {});
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<JS::Object>> pipe_to(WritableStream& destination, StreamPipeOptions const& = {});
|
||||
WebIDL::ExceptionOr<ReadableStreamPair> tee();
|
||||
|
||||
Optional<ReadableStreamController>& controller() { return m_controller; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue