MCPcopy Create free account
hub / github.com/api3dao/airnode / copyFileInBucket

Function copyFileInBucket

packages/airnode-deployer/src/infrastructure/aws.ts:208–224  ·  view source on GitHub ↗
(bucket: Bucket, fromFilePath: string, toFilePath: string)

Source from the content-addressed store, hash-verified

206};
207
208export const copyFileInBucket = async (bucket: Bucket, fromFilePath: string, toFilePath: string) => {
209 const { name: bucketName, region: bucketRegion } = bucket;
210 const s3 = initializeS3Service(bucketRegion);
211
212 logger.debug(`Copying file '${fromFilePath}' to file '${toFilePath}' within S3 bucket '${bucketName}'`);
213 const copyCommand = new CopyObjectCommand({
214 Bucket: bucketName,
215 CopySource: `/${bucketName}/${fromFilePath}`,
216 Key: toFilePath,
217 });
218 const goCopy = await go(() => s3.send(copyCommand));
219 if (!goCopy.success) {
220 throw new Error(
221 `Failed to copy file '${fromFilePath}' to file '${toFilePath}' within S3 bucket '${bucketName}': ${goCopy.error}`
222 );
223 }
224};
225
226const gatherBucketKeys = (directory: Directory): string[] => [
227 directory.bucketKey,

Callers 1

aws.test.tsFile · 0.90

Calls 1

initializeS3ServiceFunction · 0.85

Tested by

no test coverage detected