Represents an instance used to write unknown type of data.
Here is an example of custom Writer class used to write binary strings:
class BinaryStringWriter extends Writer { constructor() { super(); this.binaryString = ""; } writeUint8Array(array) { for (let indexCharacter = 0; indexCharacter < array.length; indexCharacter++) { this.binaryString += String.fromCharCode(array[indexCharacter]); } } getData() { return this.binaryString; }} Copy
class BinaryStringWriter extends Writer { constructor() { super(); this.binaryString = ""; } writeUint8Array(array) { for (let indexCharacter = 0; indexCharacter < array.length; indexCharacter++) { this.binaryString += String.fromCharCode(array[indexCharacter]); } } getData() { return this.binaryString; }}
The WritableStream instance.
WritableStream
Retrieves all the written data
A promise resolving to the written data.
Optional
Initializes the instance asynchronously
the total size of the written data in bytes.
Appends a chunk of data
The chunk data to append.
Represents an instance used to write unknown type of data.
Example
Here is an example of custom Writer class used to write binary strings: