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

Function uploadFileToS3

packages/aws-lambda/src/s3Transport.ts:85–105  ·  view source on GitHub ↗
(
  client: S3Client,
  localPath: string,
  uri: string,
  contentType?: string,
)

Source from the content-addressed store, hash-verified

83 * adapter handles.
84 */
85export async function uploadFileToS3(
86 client: S3Client,
87 localPath: string,
88 uri: string,
89 contentType?: string,
90): Promise<void> {
91 if (!existsSync(localPath)) {
92 throw new Error(`[s3Transport] upload source missing: ${localPath}`);
93 }
94 const { bucket, key } = parseS3Uri(uri);
95 const size = statSync(localPath).size;
96 await client.send(
97 new PutObjectCommand({
98 Bucket: bucket,
99 Key: key,
100 Body: createReadStream(localPath),
101 ContentType: contentType,
102 ContentLength: size,
103 }),
104 );
105}
106
107/**
108 * Pack a directory into a `.tar.gz` at `destTarball`. Uses the `tar` npm

Callers 4

handlePlanFunction · 0.85
uploadChunkOutputFunction · 0.85
handleAssembleFunction · 0.85
deploySiteFunction · 0.85

Calls 2

parseS3UriFunction · 0.85
sendMethod · 0.45

Tested by

no test coverage detected