managed_upload.d.ts (2313B)
1 import {AWSError} from '../error'; 2 import S3 = require('../../clients/s3'); 3 export class ManagedUpload { 4 /** 5 * Creates a managed upload object with a set of configuration options. 6 */ 7 constructor(options: ManagedUploadOptions); 8 /** 9 * Aborts a managed upload, including all concurrent upload requests. 10 */ 11 abort(): void; 12 /** 13 * Returns a 'thenable' promise. 14 */ 15 promise(): Promise<SendData>; 16 /** 17 * Initiates the managed upload for the payload. 18 */ 19 send(callback?: (err: AWSError, data: SendData) => void): void; 20 /** 21 * Default value: 10000 22 */ 23 static maxTotalParts: number 24 /** 25 * Returns the minimum number of bytes for an individual part upload. 26 * Note: Minimum allowed size is 5 MB. 27 * 1024 * 5 28 */ 29 static minPartSize: number 30 } 31 export interface SendData { 32 /** 33 * URL of the uploaded object. 34 */ 35 Location: string 36 /** 37 * ETag of the uploaded object. 38 */ 39 ETag: string 40 /** 41 * Bucket to which the object was uploaded. 42 */ 43 Bucket: string 44 /** 45 * Key to which the object was uploaded. 46 */ 47 Key: string 48 } 49 export interface ManagedUploadOptions { 50 /** 51 * A map of parameters to pass to the upload requests. 52 * The "Body" parameter is required to be specified either on the service or in the params option. 53 */ 54 params?: S3.Types.PutObjectRequest 55 /** 56 * The size of the concurrent queue manager to upload parts in parallel. Set to 1 for synchronous uploading of parts. Note that the uploader will buffer at most queueSize * partSize bytes into memory at any given time. 57 * default: 4 58 */ 59 queueSize?: number 60 /** 61 * Default: 5 mb 62 * The size in bytes for each individual part to be uploaded. Adjust the part size to ensure the number of parts does not exceed maxTotalParts. See minPartSize for the minimum allowed part size. 63 */ 64 partSize?: number 65 /** 66 * Default: false 67 * Whether to abort the multipart upload if an error occurs. Set to true if you want to handle failures manually. 68 */ 69 leavePartsOnError?: boolean 70 /** 71 * An optional S3 service object to use for requests. 72 * This object might have bound parameters used by the uploader. 73 */ 74 service?: S3 75 }