(key: string, sourcePath: string)
| 110 | // Helper to upload file to S3 with progress tracking |
| 111 | export 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 |
| 130 | export async function downloadFileFromS3( |
| 131 | s3: S3Client, |
| 132 | key: string, |
no test coverage detected