Suite of AT Protocol TypeScript libraries built on web standards
1/**
2 * Returns a `Uint8Array` of the requested size. Referenced memory will
3 * be initialized to 0.
4 */
5export function alloc(size: number = 0): Uint8Array {
6 return new Uint8Array(size);
7}
8
9/**
10 * Where possible returns a Uint8Array of the requested size that references
11 * uninitialized memory. Only use if you are certain you will immediately
12 * overwrite every value in the returned `Uint8Array`.
13 */
14export function allocUnsafe(size: number = 0): Uint8Array {
15 return new Uint8Array(size);
16}