flydrive
Version:
File storage library with unified API to manage files across multiple cloud storage providers like S3, GCS, R2 and so on
61 lines (60 loc) • 2.04 kB
TypeScript
import type { GetObjectAclCommandInput, PutObjectCommandInput, S3Client, S3ClientConfig, ServerSideEncryption } from '@aws-sdk/client-s3';
import type { ObjectVisibility } from '../../src/types.js';
/**
* The base set of options accepted by the S3 driver
*/
type S3DriverBaseOptions = {
/**
* The bucket from which to read and write files
*/
bucket: string;
/**
* The default visibility of all the objects within the
* bucket.
*/
visibility: ObjectVisibility;
/**
* Does service supports ACL?
*
* When set to "false", the ACL related commands uses visibility
* defined within the config without any API call.
*
* Defaults to "true". However, when you are using Cloudflare R2, you
* must set it to "false".
*/
supportsACL?: boolean;
/**
* An optional CDN URL to use for public URLs. Otherwise the endpoint
* will be used
*/
cdnUrl?: string;
/**
* Configure a custom URL builder for creating public and
* temporary URLs
*/
urlBuilder?: {
/**
* Custom implementation for creating public URLs
*/
generateURL?(key: string, bucket: string, client: S3Client): Promise<string>;
/**
* Custom implementation for creating signed/temporary URLs
*/
generateSignedURL?(key: string, options: GetObjectAclCommandInput, client: S3Client, expiresIn?: number | string): Promise<string>;
/**
* Custom implementation for creating signed/temporary URLs for uploading files
*/
generateSignedUploadURL?(key: string, options: PutObjectCommandInput, client: S3Client, expiresIn?: number | string): Promise<string>;
};
/**
* Encryption to use when uploading files to S3.
*/
encryption?: ServerSideEncryption;
};
/**
* The configuration options accepted by the S3 driver
*/
export type S3DriverOptions = (S3ClientConfig & S3DriverBaseOptions) | ({
client: S3Client;
} & S3DriverBaseOptions);
export {};