Search code examples
aws-sdkaws-sdk-jsaws-sdk-js-v3

S3 ManagedUpload equivalent in aws javascript sdk v3?


In the older version of javascript I was using managedupload function for uploading big files to s3, which will do the queueing and manage multiparting of files. But in V3 this function is not anywhere in documentation, is that removed? or is there any alternatives? Please help...


Solution

  • In V3 the high level abstractions are moved to functionality specific lib packages while the client packages offer a one to one mapping of the low level public apis.

    For S3 the client is in @aws-sdk/client-s3 and the high level operations are in @aws-sdk/lib-storage packages respectively.

    Sample upload code for a managed upload would look like the following

    const { S3Client } = require("@aws-sdk/client-s3");
    const { Upload } = require("@aws-sdk/lib-storage");
    
    const multipartUpload = new Upload({
        client: new S3Client({}),
        params: {Bucket: 'bucket', Key: 'key', Body: stream},
    });
    

    More information here.