@aws-sdk/lib-storage

Storage higher order operation

Usage no npm install needed!

<script type="module">
  import awsSdkLibStorage from 'https://cdn.skypack.dev/@aws-sdk/lib-storage';
</script>

README

@aws-sdk/lib-storage

NPM version NPM downloads

Upload

Upload allows for easy and efficient uploading of buffers, blobs, or streams, using a configurable amount of concurrency to perform multipart uploads where possible. This abstraction enables uploading large files or streams of unknown size due to the use of multipart uploads under the hood.

  import { Upload } from "@aws-sdk/lib-storage";
  import { S3Client, S3 } from "@aws-sdk/client-s3";

  const target = { Bucket, Key, Body };
  try {
    const parallelUploads3 = new Upload({
      client: new S3({}) || new S3Client({}),
      tags: [...], // optional tags
      queueSize: 4, // optional concurrency configuration
      partSize: 5MB, // optional size of each part
      leavePartsOnError: false, // optional manually handle dropped parts
      params: target,
    });

    parallelUploads3.on("httpUploadProgress", (progress) => {
      console.log(progress);
    });

    await parallelUploads3.done();
  } catch (e) {
    console.log(e);
  }