@tradle/aws-s3-client
Version:
> TODO: description
64 lines • 4.1 kB
TypeScript
import { S3 } from 'aws-sdk';
import * as Types from './types';
export declare const mapHeadersToS3PutOptions: (headers: any) => Partial<S3.PutObjectRequest>;
export interface S3ClientOpts {
client: AWS.S3;
}
export declare class S3Client {
private s3;
constructor({ client }: S3ClientOpts);
put: ({ key, value, bucket, headers, acl }: Types.PutOpts) => Promise<import("aws-sdk/lib/request").PromiseResult<S3.PutObjectOutput, import("aws-sdk").AWSError>>;
gzipAndPut: (opts: Types.PutOpts) => Promise<import("aws-sdk/lib/request").PromiseResult<S3.PutObjectOutput, import("aws-sdk").AWSError>>;
get: ({ key, bucket, s3Opts }: Types.GetOpts) => Promise<S3.Types.GetObjectOutput>;
getByUrl: (url: string) => Promise<any>;
forEachItemInBucket: ({ bucket, getBody, map, s3Opts }: Types.ForEachItemInBucketOpts) => Promise<void>;
listBuckets: () => Promise<string[]>;
listObjects: (opts: Types.ListBucketOpts) => Promise<Types.S3ObjWithBody[]>;
listObjectsWithKeyPrefix: (opts: Types.ForEachItemInBucketWithPrefixOpts) => Promise<Types.S3ObjWithBody[]>;
listBucket: (opts: Types.ListBucketOpts) => Promise<S3.Object[]>;
clearBucket: ({ bucket }: Types.BaseBucketOpts) => Promise<void>;
getCacheable: ({ key, bucket, ttl, parse, ...defaultOpts }: Types.GetCacheableOpts) => {
get: (opts?: any) => Promise<any>;
put: ({ value, ...opts }: {
[x: string]: any;
value: any;
}) => Promise<void>;
invalidateCache: () => void;
};
putJSON: ({ key, value, bucket, headers, acl }: Types.PutOpts) => Promise<import("aws-sdk/lib/request").PromiseResult<S3.PutObjectOutput, import("aws-sdk").AWSError>>;
getJSON: ({ key, bucket }: {
key: any;
bucket: any;
}) => Promise<any>;
head: ({ key, bucket }: Types.BaseObjectOpts) => Promise<import("aws-sdk/lib/request").PromiseResult<S3.HeadObjectOutput, import("aws-sdk").AWSError>>;
exists: ({ key, bucket }: Types.BaseObjectOpts) => Promise<boolean>;
del: ({ key, bucket }: Types.BaseObjectOpts) => Promise<void>;
createPresignedUrl: ({ bucket, key }: Types.BaseObjectOpts) => string;
createBucket: ({ bucket }: {
bucket: any;
}) => Promise<import("aws-sdk/lib/request").PromiseResult<S3.CreateBucketOutput, import("aws-sdk").AWSError>>;
destroyBucket: ({ bucket }: {
bucket: any;
}) => Promise<void>;
disableReplication: ({ bucket }: Types.BaseBucketOpts) => Promise<void>;
deleteBucket: ({ bucket }: Types.BaseBucketOpts) => Promise<void>;
getUrlForKey: ({ bucket, key, region }: Types.BaseObjectOpts) => string;
disableEncryption: ({ bucket }: Types.BaseBucketOpts) => Promise<void>;
enableEncryption: ({ bucket, kmsKeyId }: Types.EnableEncryptionOpts) => Promise<void>;
getEncryption: ({ bucket }: Types.BaseBucketOpts) => Promise<import("aws-sdk/lib/request").PromiseResult<S3.GetBucketEncryptionOutput, import("aws-sdk").AWSError>>;
getLatest: (list: S3.Object[]) => S3.Object;
makePublic: ({ bucket }: Types.BaseBucketOpts) => Promise<void>;
isBucketPublic: ({ bucket }: Types.BaseBucketOpts) => Promise<boolean>;
getBucketPolicy: ({ bucket }: Types.BaseBucketOpts) => Promise<any>;
makeKeysPublic: ({ bucket, keys }: Types.BaseMultiKeyOpOpts) => Promise<void>;
setPolicyForKeys: ({ bucket, keys, policy }: Types.SetPolicyForKeysOpts) => Promise<void>;
allowGuestToRead: ({ bucket, keys }: Types.BaseMultiKeyOpOpts) => Promise<void>;
deleteVersions: ({ bucket, versions }: Types.DeleteVersonsOpts) => Promise<void>;
emptyBucket: ({ bucket }: Types.BaseBucketOpts) => Promise<any>;
listBucketWithPrefix: ({ s3Opts, prefix, ...listOpts }: Types.ForEachItemInBucketWithPrefixOpts) => Promise<S3.Object[]>;
copyFilesBetweenBuckets: ({ source, target, keys, prefix, acl }: Types.BucketCopyOpts) => Promise<void>;
parseS3Url: (url: string) => any;
}
export declare const parseS3Url: (url: string) => any;
export declare const createClient: (opts: S3ClientOpts) => S3Client;
//# sourceMappingURL=client.d.ts.map