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

Function storeFileToBucket

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

Source from the content-addressed store, hash-verified

118};
119
120export 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
131export const getFileFromBucket = async (bucket: Bucket, filePath: string) => {
132 const { name: bucketName } = bucket;

Callers 1

gcp.test.tsFile · 0.90

Calls 1

initializeGcsBucketFunction · 0.85

Tested by

no test coverage detected