BinaryWriter
Streaming binary writer returned by utils.OpenBinaryWriter.
Streaming binary writer returned by utils.OpenBinaryWriter.
Closed: boolean = false
Indicates whether the writer has been closed.
Position: number = 0
Number of bytes successfully written to the file.
Close()
Closes the file. Calling Close() more than once is allowed.
boolean — true if the writer is closed successfully; false if closing/flushing the file fails. Calling it again after a successful close returns true.
Flush()
Flushes buffered output to the file.
boolean — true on success; false if flushing fails.
Error — If the writer is closed.
Write(buffer, offset, count)
Writes bytes from an existing Uint8Array without creating a temporary typed array.
If offset is omitted, writing starts at index 0. If count is omitted, bytes are written up to the end of the buffer.
An explicitly supplied offset + count must fit inside the buffer.
| Name | Type | Description |
|---|---|---|
buffer | Uint8Array | Source buffer. |
offset = 0optional | number | Source offset in bytes. |
countoptional | number | Number of bytes to write. Defaults to the remaining buffer size. |
boolean — true on success; false if the buffer/range is invalid or the write fails.
Error — If the writer is closed.