API reference / @evolu/common / Buffer
Buffer
Classes
| Class | Description |
|---|---|
| BufferError | Custom error for Buffer-related failures like premature end of data. Provides better stack traces for debugging binary protocol issues. |
Interfaces
| 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. |
Functions
| 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 | - |
| hexToBytes | Convert hex string to byte array. Uses built-in function, when available. |
| utf8ToBytes | Converts string to bytes using UTF8 encoding. |