amplify-s3-chunk-upload
Version:
A custom storage upload plugin for AWS Amplify. Instead of reading file completely in memory, it helps to read file chunk by chunk.
51 lines (50 loc) • 1.47 kB
TypeScript
import { CredentialsClass } from '@aws-amplify/core';
import { S3Client } from '@aws-sdk/client-s3';
export declare interface Part {
bodyPart: any;
partNumber: number;
emitter: any;
etag?: string;
_lastUploadedBytes: number;
}
export declare class StorageChunkManagedUpload {
private credentials;
protected minPartSize: number;
private queueSize;
private body;
private params;
private opts;
private multiPartMap;
private cancel;
private bytesUploaded;
private totalBytesToUpload;
private emitter;
constructor(params: any, credentials: CredentialsClass, opts: any, emitter: any);
upload(): Promise<string | import("@aws-sdk/client-s3").PutObjectCommandOutput>;
private createParts;
private createMultiPartUpload;
/**
* @private Not to be extended outside of tests
* @VisibleFotTesting
*/
protected uploadParts(uploadId: string, parts: Part[]): Promise<void>;
private finishMultiPartUpload;
private checkIfUploadCancelled;
cancelUpload(): void;
private cleanup;
private setupEventListener;
private progressChanged;
private byteLength;
private validateAndSanitizeBody;
private isBlob;
private isGenericObject;
/**
* @private
* creates an S3 client with new V3 aws sdk
*/
protected _createNewS3Client(config: any, emitter?: any): Promise<S3Client>;
/**
* @private
*/
_getCredentials(): any;
}