MCPcopy
hub / github.com/tldraw/tldraw / urlToArrayBuffer

Method urlToArrayBuffer

packages/utils/src/lib/file.ts:40–43  ·  view source on GitHub ↗

* Converts a URL to an ArrayBuffer by fetching the resource. * * Fetches the resource at the given URL and returns its content as an ArrayBuffer. * This is useful for loading binary data like images, videos, or other file types. * * @param url - The URL of the file to fetch * @returns Pr

(url: string)

Source from the content-addressed store, hash-verified

38 * @public
39 */
40 static async urlToArrayBuffer(url: string) {
41 const response = await fetch(url)
42 return await response.arrayBuffer()
43 }
44
45 /**
46 * Converts a URL to a Blob by fetching the resource.

Callers

nothing calls this directly

Calls 2

fetchFunction · 0.90
arrayBufferMethod · 0.65

Tested by

no test coverage detected