API reference › @evolu/common › Buffer
Binary data handling and byte array utilities.
| Class | Description |
|---|
| BufferError | Custom error for Buffer-related failures like premature end of data. Provides better stack traces for debugging binary protocol issues. |
| Function | Description |
|---|
| bytesToHex | Convert byte array to hex string. Uses built-in function, when available. |
| bytesToUtf8 | Converts bytes to string using UTF8 encoding. |
| concatBytes | Copies several Uint8Arrays into one. |
| createBuffer | Creates a Buffer for efficient byte operations. |
| hexToBytes | Convert hex string to byte array. Uses built-in function, when available. |
| utf8ToBytes | Converts string to bytes using UTF8 encoding. |
| Interface | Description |
|---|
| Buffer | A Buffer is a dynamic, resizable container for binary data, optimized for scenarios where the final size is unknown. It grows exponentially (doubling its capacity) to minimize memory reallocations and uses subarray for efficient, copy-free data access in methods like unwrap and shift. |