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

Function buildTar

packages/shell/src/extras.ts:172–187  ·  view source on GitHub ↗
(entries: Array<TarInputEntry>)

Source from the content-addressed store, hash-verified

170}
171
172export function buildTar(entries: Array<TarInputEntry>): Uint8Array {
173 const chunks: Uint8Array[] = [];
174 for (const entry of entries) {
175 const header = createTarHeader(entry);
176 chunks.push(header);
177 if (entry.type === "file") {
178 chunks.push(entry.bytes);
179 const remainder = entry.bytes.byteLength % 512;
180 if (remainder !== 0) {
181 chunks.push(new Uint8Array(512 - remainder));
182 }
183 }
184 }
185 chunks.push(new Uint8Array(1024));
186 return concatBytes(chunks);
187}
188
189export function listTar(bytes: Uint8Array): StateArchiveEntry[] {
190 return parseTar(bytes)

Callers 1

createArchiveMethod · 0.90

Calls 2

createTarHeaderFunction · 0.85
concatBytesFunction · 0.85

Tested by

no test coverage detected