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

Function getFileFromBucket

packages/airnode-deployer/src/infrastructure/gcp.ts:131–143  ·  view source on GitHub ↗
(bucket: Bucket, filePath: string)

Source from the content-addressed store, hash-verified

129};
130
131export const getFileFromBucket = async (bucket: Bucket, filePath: string) => {
132 const { name: bucketName } = bucket;
133 const gcsBucket = initializeGcsBucket(bucketName);
134 const file = gcsBucket.file(filePath);
135
136 logger.debug(`Fetching file '${filePath}' from GCS bucket '${bucketName}'`);
137 const goDownload = await go(() => file.download());
138 if (!goDownload.success) {
139 throw new Error(`Failed to fetch file '${filePath}' from GCS bucket '${bucketName}': ${goDownload.error}`);
140 }
141
142 return goDownload.data[0].toString('utf-8');
143};
144
145export const copyFileInBucket = async (bucket: Bucket, fromFilePath: string, toFilePath: string) => {
146 const { name: bucketName } = bucket;

Callers 1

gcp.test.tsFile · 0.90

Calls 1

initializeGcsBucketFunction · 0.85

Tested by

no test coverage detected