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 preSignUrlconstresultPreSignUrl=awaitgetPreSignedUrlApplicationFile( { applicationId:"my-application-id" }, { type:PreSignUrlType.UPLOAD, fileName:fileToUpload.name, },);consttransfer=newTransfer({ name:"My Transfer", type:TransferType.UPLOAD,});transfer.setAction(() => {// Set any action to trigger on Upload/Download Progression});// Use the PreSignUrl to upload the fileawaituploadApplicationFile( { token:resultPreSignUrl.data.preSignUrl }, {}, file, { transfer },);
Write File
// Generate a preSignUrlconstresultPreSignUrl=awaitgetPreSignedUrlApplicationFile( { applicationId:"my-application-id", applicationFileId:"file-id" }, { type:PreSignUrlType.WRITE, },);consttransfer=newTransfer({ name:"My Transfer", type:TransferType.UPLOAD,});transfer.setAction(() => {// Set any action to trigger on Upload/Download Progression});// Use the PreSignUrl to write the new fileawaitwriteApplicationFile( { token:resultPreSignUrl.data.preSignUrl }, {}, file, { transfer },);
Download File
// Generate a preSignUrlconstresultPreSignUrl=awaitgetPreSignedUrlApplicationFile( { applicationId:"my-application-id", }, { type:PreSignUrlType.DOWNLOAD, userApplicationFileId:userApplicationFile.id, },);consttransfer=newTransfer({ name:"My Transfer", type:TransferType.DOWNLOAD,});transfer.setAction(() => {// Set any action to trigger on Upload/Download Progression});// Use the PreSignUrl to downloadthe new fileconstresult=awaitdownloadApplicationFile( { token:resultPreSignUrl.data.preSignUrl }, { transfer },);
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
// By reseting the PublicAccess, you can also enable itawaitresetPublicAccessApplicationFile({ applicationId:"application-id", applicationFileId:"application-file-id",});// You can also disable this feature by unsetting the PublicAccessawaitunsetPublicAccessApplicationFile({ applicationId:"application-id", applicationFileId:"application-file-id",});
You can download (without authentication) file by PublicAccess with downloadWithPublicAccessApplicationFile method
Upload from an external link
You can provide a link referring to a file to upload it to your storage.