mirror of
https://git.undefined-dev.fr/Blendman974/faceclaw.git
synced 2026-11-19 21:03:09 +00:00
10 lines
267 B
TypeScript
10 lines
267 B
TypeScript
|
|
export function toUint8Array(bytes: ArrayLike<number> | null | undefined): Uint8Array {
|
|
if (!bytes) return new Uint8Array(0);
|
|
const out = new Uint8Array(bytes.length);
|
|
for (let i = 0; i < bytes.length; i++) {
|
|
out[i] = bytes[i]! & 0xff;
|
|
}
|
|
return out;
|
|
}
|