Multipart uploads

Multipart uploads allow you to upload a single file as a series of parts independently from one another. Uploading different parts of the file can be parallelized, making multipart uploads efficient for uploading larger objects. You can read about multipart uploads in detail in the S3 documentation.

The Uploadjoy API provides a number of endpoints that allow you to interact with multipart uploads.


POST/v1/multipart-upload/complete

Complete Multipart Upload

In order for S3 to assemble the uploaded parts of an object and make it available, the multipart upload must be completed. This endpoint allows you to complete a multipart upload.

Required attributes

  • Name
    uploadId
    Type
    string
    Description

    Id of the multipart upload. This is returned when you initiate the multipart upload.

  • Name
    key
    Type
    string
    Description

    Key of the uploaded object.

  • Name
    completedParts
    Type
    CompletedPart[]
    Description

    List of CompletedPart objects. Each CompletedPart object contains the partNumber and eTag of the part.

    The eTag is returned from AWS when you upload a part using a presigned URL.

CompletedPart

type CompletedPart {
  partNumber: number;
  eTag: string;
}

Request

POST
/v1/multipart-upload/complete
import { Uploadjoy } from "@uploadjoy/client";

const ujClient = new Uploadjoy({
  apiToken: process.env.UPLOADJOY_API_TOKEN,
});

const response = await ujClient.multipartUpload.complete({
  uploadId: "uploadId123",
  key: "foo.jpg",
  completedParts: [
    { partNumber: 1, eTag: "etag123" },
    { partNumber: 2, eTag: "etag456" },
  ],
});

Response

type Response {
  data?: {
    uploadId: string;
    key: string;
  }
  httpError?: HTTPError
}

POST/v1/multipart-upload/abort

Abort Multipart Upload

Use this endpoint to abort a multipart upload.

Required attributes

  • Name
    uploadId
    Type
    string
    Description

    Id of the multipart upload. This is returned when you initiate the multipart upload.

  • Name
    key
    Type
    string
    Description

    Key of the uploaded object.

Request

POST
/v1/multipart-upload/abort
import { Uploadjoy } from "@uploadjoy/client";

const ujClient = new Uploadjoy({
  apiToken: process.env.UPLOADJOY_API_TOKEN,
});

const response = await ujClient.multipartUpload.abort({
  uploadId: "uploadId123",
  key: "foo.jpg",
});

Response

type Response {
  data?: {
    uploadId: string;
    key: string;
  }
  httpError?: HTTPError;
}