MCPcopy Create free account
hub / github.com/andymatuschak/orbit / encodeDataURL

Function encodeDataURL

packages/store-shared/src/encodeDataURL.ts:4–7  ·  view source on GitHub ↗
(data: ArrayBuffer, type: AttachmentMIMEType)

Source from the content-addressed store, hash-verified

2import base64 from "base64-js";
3
4export function encodeDataURL(data: ArrayBuffer, type: AttachmentMIMEType) {
5 const b64String = base64.fromByteArray(new Uint8Array(data));
6 return `data:${type};base64,${b64String}`;
7}

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected