MCPcopy Index your code
hub / github.com/TanStack/ai / fsWrite

Method fsWrite

packages/ai-sandbox-sprites/src/client.ts:260–273  ·  view source on GitHub ↗
(name: string, path: string, data: Uint8Array)

Source from the content-addressed store, hash-verified

258 }
259
260 async fsWrite(name: string, path: string, data: Uint8Array): Promise<void> {
261 const url = this.spritePath(
262 name,
263 `/fs/write?path=${encodeURIComponent(path)}`,
264 )
265 // Copy into a fresh ArrayBuffer-backed view so the body is a plain BodyInit.
266 const response = await fetch(url, {
267 method: 'PUT',
268 headers: this.headers({ 'content-type': 'application/octet-stream' }),
269 body: data.slice(),
270 })
271 if (!response.ok) await this.fail('PUT', url, response)
272 await response.body?.cancel()
273 }
274
275 async fsList(name: string, path: string): Promise<Array<SpriteFsEntry>> {
276 const url = this.spritePath(

Callers 1

constructorMethod · 0.80

Calls 5

spritePathMethod · 0.95
headersMethod · 0.95
failMethod · 0.95
cancelMethod · 0.65
fetchFunction · 0.50

Tested by

no test coverage detected