MCPcopy Index your code
hub / github.com/heygen-com/hyperframes / uploadChunkOutput

Function uploadChunkOutput

packages/aws-lambda/src/handler.ts:367–388  ·  view source on GitHub ↗
(
  s3: S3Client,
  result: ChunkResult,
  prefix: string,
  chunkIndex: number,
)

Source from the content-addressed store, hash-verified

365}
366
367async function uploadChunkOutput(
368 s3: S3Client,
369 result: ChunkResult,
370 prefix: string,
371 chunkIndex: number,
372): Promise<string> {
373 const trimmed = trimTrailingSlash(prefix);
374 if (result.outputKind === "file") {
375 const ext = result.outputPath.slice(result.outputPath.lastIndexOf("."));
376 const uri = `${trimmed}/chunks/${pad(chunkIndex)}${ext}`;
377 await uploadFileToS3(s3, result.outputPath, uri);
378 return uri;
379 }
380 // frame-dir: upload as a tarball so a single S3 object represents the chunk.
381 // Assemble's png-sequence path expects a directory per chunk; it untars on
382 // its end.
383 const tarball = `${result.outputPath}.tar.gz`;
384 await tarDirectory(result.outputPath, tarball);
385 const uri = `${trimmed}/chunks/${pad(chunkIndex)}.tar.gz`;
386 await uploadFileToS3(s3, tarball, uri, "application/gzip");
387 return uri;
388}
389
390// ── Assemble ────────────────────────────────────────────────────────────────
391

Callers 1

handleRenderChunkFunction · 0.70

Calls 4

uploadFileToS3Function · 0.85
trimTrailingSlashFunction · 0.70
padFunction · 0.70
tarDirectoryFunction · 0.70

Tested by

no test coverage detected