File Management

To manipulate file (upload, writeor downlaod), you need to generate a PreSignUrl

You can securly send the PreSignUrl to your Client to let him upload, write ordownlaod a file from your storage.

When Uploading or Writing a file, it will automatically generate a new thumbnail for this file. You can disabling it by providing should_not_generate_thumbnail=true as Query params (second parameter of this uploadApplicationFile function

Upload File

// Generate a preSignUrl
const resultPreSignUrl = await getPreSignedUrlApplicationFile(
  { applicationId: "my-application-id" },
  {
    type: PreSignUrlType.UPLOAD,
    fileName: fileToUpload.name,
  },
);

const transfer = new Transfer({
  name: "My Transfer",
  type: TransferType.UPLOAD,
});

transfer.setAction(() => {
  // Set any action to trigger on Upload/Download Progression
});

// Use the PreSignUrl to upload the file
await uploadApplicationFile(
  { token: resultPreSignUrl.data.preSignUrl },
  {},
  file,
  { transfer },
);

Write File

Download File

Publish a file

Each file get be accessed from PreSignUrl but you can also enable a public access link to let anybody download your file, such as a Image Provider for your Website

You can download (without authentication) file by PublicAccess with downloadWithPublicAccessApplicationFile method

You can provide a link referring to a file to upload it to your storage.

Last updated