MCPcopy Index your code
hub / github.com/OpenSignLabs/OpenSign / base64ToArrayBuffer

Function base64ToArrayBuffer

apps/OpenSign/src/constant/Utils.js:3397–3409  ·  view source on GitHub ↗
(base64)

Source from the content-addressed store, hash-verified

3395 return { arrayBuffer: arrayBuffer, base64: pdfbase64 };
3396}
3397export function base64ToArrayBuffer(base64) {
3398 // Decode the base64 string to a binary string
3399 const binaryString = atob(base64);
3400 // Create a new ArrayBuffer with the same length as the binary string
3401 const len = binaryString.length;
3402 const bytes = new Uint8Array(len);
3403 // Convert the binary string to a byte array
3404 for (let i = 0; i < len; i++) {
3405 bytes[i] = binaryString.charCodeAt(i);
3406 }
3407 // Return the ArrayBuffer
3408 return bytes.buffer;
3409}
3410export function removeBase64Prefix(base64String) {
3411 return base64String.replace(/^data:.*;base64,/, "");
3412}

Callers 9

handleSubmitFunction · 0.90
handleFileUploadFunction · 0.90
handleFileUploadFunction · 0.90
handleFileUploadFunction · 0.90
embedWidgetsDataFunction · 0.85
rotatePdfPageFunction · 0.85
deletePdfPageFunction · 0.85
reorderPdfPagesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected