@graperank/storage-s3
Version:
The S3 Storage plugin provides GrapeRank the means to store and retrieve scorecards from any S3 compatible simple storage service.
41 lines (40 loc) • 1.27 kB
TypeScript
import { s3Config, StorageFileList } from '@graperank/util/types';
export type S3FileList = {
Key: string;
filenames: string[];
nextKey?: string;
};
export interface S3ObjectInput {
Bucket: string;
}
export interface S3GetObjectInput extends S3ObjectInput {
Key: string;
}
export interface S3PutObjectInput extends S3GetObjectInput {
Body: any;
ACL: "private" | "public-read" | "public-read-write" | "authenticated-read" | "aws-exec-read" | "bucket-owner-read" | "bucket-owner-full-control";
Expires?: Date;
Metadata?: {};
}
export interface S3ListObjectsInput extends S3ObjectInput {
Marker?: string;
MaxKeys?: number;
Prefix?: string;
}
export declare class s3Api {
private readonly bucket;
private readonly client;
constructor(config: s3Config);
private send;
get(Key: string): Promise<any>;
put(Key: string, data: any, overwrite?: boolean): Promise<boolean>;
/**
* Returns S3FileList
* containing a`filenames` array of items found.
* if `nextKey` is a string, use its value to get more items
* @param type
* @param userid
* @returns s3ListObjectOutput {IsTruncated : boolean, Keys : string[]}
*/
list(Key: string): Promise<StorageFileList | undefined>;
}