import { Drive, DriveFileStats, SignedUrlOptions, WriteOptions } from '@apoyo/files'; import { StorageOptions, Storage } from '@google-cloud/storage'; declare type GcsDriveConfig = StorageOptions & { bucket: string; prefix?: string; usingUniformAcl?: boolean; cdnUrl?: string; }; declare class GcsDrive implements Drive { private _config; /** * Reference to the GCS Bucket */ private _gcsBucket; /** * Reference to the gcs storage instance */ adapter: Storage; /** * Name of the driver */ name: 'gcs'; constructor(_config: GcsDriveConfig); /** * Make absolute path to a given location */ makePath(location: string): string; /** * Transforms the write options to GCS properties. Checkout the * following example in the docs to see the available options * * https://googleapis.dev/nodejs/storage/latest/File.html#createWriteStream */ private _transformWriteOptions; /** * Transform content headers to GCS response headers */ private _transformContentHeaders; /** * Converts seconds to milliseconds */ private _secondsToTimeStamp; /** * Returns a new instance of the GCS driver with * a custom runtime bucket */ bucket(bucket: string): GcsDrive; /** * Returns the file contents as a buffer. The buffer return * value allows you to self choose the encoding when * converting the buffer to a string. */ get(location: string): Promise; /** * Returns the file contents as a stream */ getStream(location: string): Promise; /** * A boolean to find if the location path exists or not */ exists(location: string): Promise; /** * Returns the file stats */ getStats(location: string): Promise; /** * Returns the signed url for a given path */ getSignedUrl(location: string, options?: SignedUrlOptions): Promise; /** * Returns URL to a given path */ getUrl(location: string): Promise; /** * Write string|buffer contents to a destination. The missing * intermediate directories will be created (if required). */ put(location: string, contents: Buffer | string, options?: WriteOptions): Promise; /** * Write a stream to a destination. The missing intermediate * directories will be created (if required). */ putStream(location: string, contents: NodeJS.ReadableStream, options?: WriteOptions): Promise; /** * Remove a given location path */ delete(location: string): Promise; /** * Copy a given location path from the source to the desination. * The missing intermediate directories will be created (if required) */ copy(source: string, destination: string, options?: WriteOptions): Promise; /** * Move a given location path from the source to the desination. * The missing intermediate directories will be created (if required) */ move(source: string, destination: string, options?: WriteOptions): Promise; } export { GcsDrive, GcsDriveConfig };