MCPcopy
hub / github.com/tldraw/tldraw / storeAsset

Function storeAsset

templates/socketio-server-example/src/server/assets.ts:8–11  ·  view source on GitHub ↗
(id: string, stream: Readable)

Source from the content-addressed store, hash-verified

6const DIR = resolve('./.assets')
7
8export async function storeAsset(id: string, stream: Readable) {
9 await mkdir(DIR, { recursive: true })
10 await writeFile(join(DIR, id), stream)
11}
12
13export async function loadAsset(id: string) {
14 return await readFile(join(DIR, id))

Callers 1

server.tsFile · 0.90

Calls 1

writeFileFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…