Create a new output stream from a buffer
the initial size for the internal Uint8Array, or buffer to use as source.
The buffer to write to
The number of bytes that have been written
Ensure that the output stream has enough capacity
the capacity the buffer should have
Return written bytes as a base64 encoded string.
The base64 encoded string
Return the written bytes as a buffer, sized to the last value written.
Any modifications to the returned buffer will be reflected in this OutputStream.
A Uint8Array containing all the bytes current written to this OutputStream.
Grow the buffer up to the next minimum capacity (or higher).
the minimum capacity required
Write a single byte.
the byte to append
Write a signed, big-endian 32-bit integer.
the number to write
Write a signed, big-endian 64-bit long.
the number to write.
Write a signed 8-bit integer.
the number to write
Write many bytes.
The contents of the provided buffer will be copied and appended. The full length of the buffer will be copied, irrespective of byte content.
The bytes to append.
Write a String in UTF-8 format.
the string value to be appended.
Copyright © 2025 DiffusionData Ltd. All Rights Reserved.
Wrapper around a single Uint8Array, providing auto-resizing capabilities.
All write operations will append to the internal buffer.
Loosely inspired by Java's ByteArrayOutputStream.