tencent cloud

All product documents
Tencent Cloud EdgeOne
WritableStream
Last updated: 2024-01-30 16:00:52
WritableStream
Last updated: 2024-01-30 16:00:52
The WritableStream API represents a writable stream or writable side. It is designed based on the standard Web API WritableStream.
Note:
A WritableStream object cannot be constructed directly. You can use TransformStream to construct a WritableStream object.

Overview

// Use TransformStream to construct a WritableStream object.
const { writable } = new TransformStream();

Attributes

locked

// writable.locked
readonly locked: boolean;
The locked attribute indicates whether the stream is locked.
Note:
A stream is locked in the following scenarios:
The stream has no more than one activated writer. Before the writer calls the releaseLock() method, the stream is locked.
The stream is in being piped. The stream is locked until the piping ends.

highWaterMark

// writable.highWaterMark
readonly highWaterMark: number;
The size of the writable buffer in bytes. Default value: 32K. Maximum value: 256K. If you enter a value greater than 256K, the value is changed to 256K automatically.

Methods

Note:
Before you use any of the following methods, make sure that the stream is not locked. Otherwise, an exception is returned.

getWriter

writable.getWriter(): WritableStreamDefaultWriter;
The getWriter() method creates a writer and locks the current stream until the writer calls the releaseLock() method. For more information about the returned values, see WritableStreamDefaultWriter.

close

writable.close(): Promise<void>;
The close() method closes the current stream.

abort

writable.abort(reason?: string): Promise<string>;
The abort() method stops the current stream.

References

Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback

Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 available.

7x24 Phone Support
Hong Kong, China
+852 800 906 020 (Toll Free)
United States
+1 844 606 0804 (Toll Free)
United Kingdom
+44 808 196 4551 (Toll Free)
Canada
+1 888 605 7930 (Toll Free)
Australia
+61 1300 986 386 (Toll Free)
EdgeOne hotline
+852 300 80699
More local hotlines coming soon