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

Function copyFileInBucket

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

Source from the content-addressed store, hash-verified

143};
144
145export 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
159const gatherBucketKeys = (directory: Directory): string[] => [
160 ...Object.values(directory.children).reduce(

Callers 1

gcp.test.tsFile · 0.90

Calls 1

initializeGcsBucketFunction · 0.85

Tested by

no test coverage detected