MCPcopy Create free account
hub / github.com/cloudflare/agents / createArchive

Method createArchive

packages/shell/src/memory.ts:310–326  ·  view source on GitHub ↗
(
    path: string,
    sources: string[]
  )

Source from the content-addressed store, hash-verified

308 }
309
310 async createArchive(
311 path: string,
312 sources: string[]
313 ): Promise<StateArchiveCreateResult> {
314 const entries = await this.collectArchiveEntries(sources);
315 const tar = buildTar(entries);
316 await this.writeFileBytes(path, tar);
317 return {
318 path,
319 entries: entries.map((entry) => ({
320 path: entry.path,
321 type: entry.type,
322 size: entry.type === "file" ? entry.bytes.byteLength : 0
323 })),
324 bytesWritten: tar.byteLength
325 };
326 }
327
328 async listArchive(path: string): Promise<StateArchiveEntry[]> {
329 return listTar(await this.readFileBytes(path));

Callers

nothing calls this directly

Calls 3

collectArchiveEntriesMethod · 0.95
writeFileBytesMethod · 0.95
buildTarFunction · 0.90

Tested by

no test coverage detected