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

Function streamVideo

packages/cli/src/commands/cloud/render.ts:719–745  ·  view source on GitHub ↗
(
  url: string,
  destPath: string,
  asJson: boolean,
)

Source from the content-addressed store, hash-verified

717
718// fallow-ignore-next-line complexity
719async function streamVideo(
720 url: string,
721 destPath: string,
722 asJson: boolean,
723): Promise<{ bytes: number }> {
724 // `downloadToFile` already creates the parent directory and cleans
725 // up the partial file on error — no pre-mkdir needed here.
726 if (!asJson) {
727 console.log("");
728 console.log(`${c.accent("◆")} Downloading to ${c.accent(destPath)}`);
729 }
730 try {
731 const result = await downloadToFile(url, destPath);
732 if (!asJson) {
733 console.log(c.dim(` ${formatBytes(result.bytes)} written`));
734 }
735 return { bytes: result.bytes };
736 } catch (err) {
737 const message = normalizeErrorMessage(err);
738 errorBox(
739 "Download failed",
740 message,
741 "The presigned URL is short-lived; re-fetch with `hyperframes cloud get`.",
742 );
743 process.exit(1);
744 }
745}

Callers 1

runFunction · 0.85

Calls 4

downloadToFileFunction · 0.85
errorBoxFunction · 0.85
formatBytesFunction · 0.50
normalizeErrorMessageFunction · 0.50

Tested by

no test coverage detected