@tradle/aws-s3-client
Version:
> TODO: description
63 lines • 3.5 kB
TypeScript
import { KeyValueStoreExtended } from '@tradle/aws-common-utils';
import { PutOpts, BucketOpts, CopyFilesToOpts, ListBucketOpts, ListOptsMinusBucket, EnableEncryptionOpts } from './types';
import { S3Client } from './client';
export declare class Bucket implements KeyValueStoreExtended {
private opts;
get id(): string;
get name(): string;
bucket: string;
prefix: string;
client: S3Client;
constructor(opts: BucketOpts);
folder: (prefix: string) => Bucket;
sub: (prefix: string) => Bucket;
withPrefix: (prefix: string) => Bucket;
get: (key: string) => Promise<import("aws-sdk/clients/s3").GetObjectOutput>;
maybeGet: (key: string) => Promise<void | import("aws-sdk/clients/s3").GetObjectOutput>;
getJSON: (key: string) => Promise<any>;
maybeGetJSON: (key: string) => Promise<any>;
list: (opts: Omit<ListBucketOpts, 'bucket'>) => Promise<import("aws-sdk/clients/s3").Object[]>;
listObjects: (opts: Omit<ListBucketOpts, 'bucket'>) => Promise<import("./types").S3ObjWithBody[]>;
listWithPrefix: (prefix: string, listOpts?: ListOptsMinusBucket) => void;
listObjectsWithKeyPrefix: (prefix: string, listOpts?: ListOptsMinusBucket) => Promise<import("./types").S3ObjWithBody[]>;
put: (key: string, value: any, opts?: Partial<PutOpts>) => Promise<void>;
putJSON: (key: string, value: any, opts?: Partial<PutOpts>) => Promise<void>;
gzipAndPut: (key: string, value: any, opts?: Partial<PutOpts>) => Promise<import("aws-sdk/lib/request").PromiseResult<import("aws-sdk/clients/s3").PutObjectOutput, import("aws-sdk").AWSError>>;
head: (key: string) => Promise<import("aws-sdk/lib/request").PromiseResult<import("aws-sdk/clients/s3").HeadObjectOutput, import("aws-sdk").AWSError>>;
exists: (key: string) => Promise<boolean>;
has: (key: string) => Promise<boolean>;
del: (key: string) => Promise<void>;
getCacheable: (opts: any) => {
get: (opts?: any) => Promise<any>;
put: ({ value, ...opts }: {
[x: string]: any;
value: any;
}) => Promise<void>;
invalidateCache: () => void;
};
create: () => Promise<import("aws-sdk/lib/request").PromiseResult<import("aws-sdk/clients/s3").CreateBucketOutput, import("aws-sdk").AWSError>>;
destroy: () => Promise<void>;
clear: () => Promise<void>;
toString: () => string;
getUrlForKey: (key: string) => string;
forEach: (opts: any) => Promise<void>;
enableEncryption: (opts: Omit<EnableEncryptionOpts, 'bucket'>) => Promise<void>;
disableEncryption: () => Promise<void>;
getEncryption: () => Promise<import("aws-sdk/lib/request").PromiseResult<import("aws-sdk/clients/s3").GetBucketEncryptionOutput, import("aws-sdk").AWSError>>;
putIfDifferent: (key: string, value: any) => Promise<boolean>;
makePublic: () => Promise<void>;
empty: () => Promise<any>;
copyFilesTo: ({ bucket, keys, prefix, acl }: CopyFilesToOpts) => Promise<void>;
isPublic: () => Promise<boolean>;
makeKeysPublic: (keys: string[]) => Promise<void>;
createPresignedUrl: (key: string) => string;
kv: () => KeyValueStoreExtended;
kvWithGzip: () => KeyValueStoreExtended;
jsonKV: () => KeyValueStoreExtended;
jsonKVWithGzip: () => KeyValueStoreExtended;
private _getKey;
}
export { Bucket as Folder };
export declare const wrapBucket: (opts: BucketOpts) => Bucket;
export declare const wrapFolder: (opts: BucketOpts) => Bucket;
//# sourceMappingURL=bucket.d.ts.map