MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / makeMinimalProjectTar

Function makeMinimalProjectTar

packages/aws-lambda/src/handler.test.ts:535–547  ·  view source on GitHub ↗

* Build the smallest valid `.tar.gz` the handler's untar step accepts: a * single file inside an archive. Uses the npm `tar` package (same as * `s3Transport.ts`) so the fixture builder runs cross-platform — Windows * doesn't ship GNU tar in `/usr/bin/tar`, and bare Alpine containers * don't ship

()

Source from the content-addressed store, hash-verified

533 * of the suite runs.
534 */
535async function makeMinimalProjectTar(): Promise<Buffer> {
536 const tar = await import("tar");
537 const { mkdtempSync: mk, readFileSync, rmSync: rm, writeFileSync: wf } = await import("node:fs");
538 const dir = mk(join(tmpdir(), "hf-lambda-mktar-"));
539 try {
540 wf(join(dir, "index.html"), "<!doctype html><title>test</title>");
541 const tarPath = join(dir, "out.tar.gz");
542 await tar.create({ gzip: true, file: tarPath, cwd: dir }, ["index.html"]);
543 return readFileSync(tarPath);
544 } finally {
545 rm(dir, { recursive: true, force: true });
546 }
547}
548
549/**
550 * Build a minimal `.tar.gz` for a tiny planDir containing `plan.json` +

Callers 1

handler.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected