(bucket: Bucket, bucketFilePath: string, filePath: string)
| 118 | }; |
| 119 | |
| 120 | export const storeFileToBucket = async (bucket: Bucket, bucketFilePath: string, filePath: string) => { |
| 121 | const { name: bucketName } = bucket; |
| 122 | const gcsBucket = initializeGcsBucket(bucketName); |
| 123 | |
| 124 | logger.debug(`Storing file '${filePath}' as '${bucketFilePath}' to GCS bucket '${bucketName}'`); |
| 125 | const goSave = await go(() => gcsBucket.upload(filePath, { destination: bucketFilePath })); |
| 126 | if (!goSave.success) { |
| 127 | throw new Error(`Failed to store file '${filePath}' to GCS bucket '${bucketName}': ${goSave.error}`); |
| 128 | } |
| 129 | }; |
| 130 | |
| 131 | export const getFileFromBucket = async (bucket: Bucket, filePath: string) => { |
| 132 | const { name: bucketName } = bucket; |
no test coverage detected