MCPcopy Create free account
hub / github.com/amrkmn/x / uploadFileToS3

Function uploadFileToS3

scripts/cache/utils.ts:112–129  ·  view source on GitHub ↗
(key: string, sourcePath: string)

Source from the content-addressed store, hash-verified

110// Helper to upload file to S3 with progress tracking
111export async function uploadFileToS3(key: string, sourcePath: string): Promise<number> {
112 const sizeInBytes = (await stat(sourcePath)).size;
113 const progressLogger = logger.transfer('[cache] uploading', sizeInBytes);
114
115 await uploadToS3(
116 key,
117 createFileUploadStream(sourcePath, (bytes) => {
118 progressLogger.progress(bytes);
119 }),
120 {
121 contentLength: sizeInBytes
122 }
123 );
124
125 progressLogger.complete(sizeInBytes);
126 return sizeInBytes;
127}
128
129// Helper to download file from S3 with progress tracking
130export async function downloadFileFromS3(
131 s3: S3Client,
132 key: string,

Callers 1

uploadCacheFunction · 0.90

Calls 5

uploadToS3Function · 0.90
createFileUploadStreamFunction · 0.85
transferMethod · 0.80
progressMethod · 0.45
completeMethod · 0.45

Tested by

no test coverage detected