MCPcopy Create free account
hub / github.com/Bytez-com/docs / getDataUrl

Function getDataUrl

sdk/javascript/tests/tasks.test.ts:8–14  ·  view source on GitHub ↗
(url: string)

Source from the content-addressed store, hash-verified

6// import Bytez from "../src/index.browser";;
7
8async function getDataUrl(url: string) {
9 const response = await fetch(url);
10 const blob = await response.blob();
11 const buffer = await blob.arrayBuffer().then(Buffer.from);
12
13 return `data:${blob.type};base64,${buffer.toString("base64")}`;
14}
15
16const client = new Bytez(process.env.BYTEZ_KEY ?? "", true);
17

Callers 1

tasks.test.tsFile · 0.85

Calls 1

toStringMethod · 0.80

Tested by

no test coverage detected