MCPcopy Create free account
hub / github.com/Ridter/cf_workers_proxy / base64ToArrayBuffer

Function base64ToArrayBuffer

js/worker.js:468–481  ·  view source on GitHub ↗

* * @param {string} base64Str * @returns

(base64Str)

Source from the content-addressed store, hash-verified

466 * @returns
467 */
468function base64ToArrayBuffer(base64Str) {
469 if (!base64Str) {
470 return { error: null };
471 }
472 try {
473 // go use modified Base64 for URL rfc4648 which js atob not support
474 base64Str = base64Str.replace(/-/g, '+').replace(/_/g, '/');
475 const decode = atob(base64Str);
476 const arryBuffer = Uint8Array.from(decode, (c) => c.charCodeAt(0));
477 return { earlyData: arryBuffer.buffer, error: null };
478 } catch (error) {
479 return { error };
480 }
481}
482
483/**
484 * This is not real UUID validation

Callers 1

startFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected