UNPKG

@arcane-utils/storage

Version:

Storage helper functions.

34 lines (31 loc) 1.63 kB
import { Storage, File, GetAclResponse, Bucket, CopyOptions } from '@google-cloud/storage'; declare const HUBMETRICS_FILE_FOLDER: string; declare const getStorageClient: (gcpProject: string, serviceAccount: string) => Storage; declare const getFileObject: (bucketName: string, fileName: string, storageClient: Storage) => File; declare const getFileACL: (file: File, aclQuery: any) => Promise<GetAclResponse>; /** * Set file metadata * @example * metadata = { * metadata: { * key1: "value1", * key2: "value2", * } * } */ declare const setFileMetadata: (file: File, metadata: any) => Promise<void>; declare const copyFile: (sourceFile: File, destinationFile: string | File | Bucket, options?: CopyOptions) => Promise<void>; declare const downloadFile: (file: File, destination: string) => Promise<void>; declare const getFileHash: (file: File) => Promise<string>; declare const uploadFile: (bucket: Bucket, filePath: string, destFileName: string | File) => Promise<any>; declare const deleteFiles: (filesList: File[]) => Promise<void>; /** * * @param filesList list of files to combine * @param filePath the result file path * @param bucket a working bucket used for file concatenation (not datalake bucket) * @param metadata optional metadata to set on the result file * @returns */ declare const concatenateSubFiles: (filesList: File[], outputFile: File, bucket: Bucket, logger?: any, metadata?: Object) => Promise<File>; export { HUBMETRICS_FILE_FOLDER, concatenateSubFiles, copyFile, deleteFiles, downloadFile, getFileACL, getFileHash, getFileObject, getStorageClient, setFileMetadata, uploadFile };