Warm up WASM in a dedicated worker with a tiny JPEG probe and expose init/read RPC to the main thread.
11 lines
257 B
TypeScript
11 lines
257 B
TypeScript
export function base64ToBytes(base64: string): Uint8Array {
|
|
const binary = atob(base64);
|
|
const bytes = new Uint8Array(binary.length);
|
|
|
|
for (let i = 0; i < binary.length; i++) {
|
|
bytes[i] = binary.charCodeAt(i);
|
|
}
|
|
|
|
return bytes;
|
|
}
|