Generate Presigned URL To Upload Image (IPFS)

Request

In order to get a presigned url to upload image to IPFS, SDK provides you with a generatePresignedImage endpoint to do so

try {
  const apiProtocol = nft2Client.getAPIService();
 
  const presignedList = await apiProtocol.generatePresignedImage({
    files: [
      {
        fileName: 'file1.png',
        mimeType: 'image/png',
      },
      {
        fileName: 'file2.jpeg',
        mimeType: 'image/jpeg',
      },
      ...
    ]
  });
 
  console.log(presignedList)
} catch (e) {
  console.error(e);
}

Parameters

  • Params type: PresignImageData

  • files (Array): Array of presign image metadata (fileName and mimeType).

(!) To ensure IPFS service performance and avoid rate limit when upload files, size of array files must be <= 50.

(!) Image mimeType only support in ["image/png", "image/jpeg", "image/svg+xml"]

Response

Using presigned URL to upload image to S3

Last updated