(bucket: Bucket, fromFilePath: string, toFilePath: string)
| 143 | }; |
| 144 | |
| 145 | export const copyFileInBucket = async (bucket: Bucket, fromFilePath: string, toFilePath: string) => { |
| 146 | const { name: bucketName } = bucket; |
| 147 | const gcsBucket = initializeGcsBucket(bucketName); |
| 148 | const file = gcsBucket.file(fromFilePath); |
| 149 | |
| 150 | logger.debug(`Copying file '${fromFilePath}' to file '${toFilePath}' within GCS bucket '${bucketName}'`); |
| 151 | const goCopy = await go(() => file.copy(toFilePath)); |
| 152 | if (!goCopy.success) { |
| 153 | throw new Error( |
| 154 | `Failed to copy file '${fromFilePath}' to file '${toFilePath}' within GCS bucket '${bucketName}': ${goCopy.error}` |
| 155 | ); |
| 156 | } |
| 157 | }; |
| 158 | |
| 159 | const gatherBucketKeys = (directory: Directory): string[] => [ |
| 160 | ...Object.values(directory.children).reduce( |
no test coverage detected