Optional
options: UploadOptionsOptional
options: UploadOptionsFinishes a multipart upload instance
Optional
options: UploadOptionsUploads a single part to TagoIO
Changes visibility settings for multiple files.
If receive an error "Authorization Denied", check policy File / Edit in Access Management.
const result = await Resources.files.changePermission([{
file: "/path/to/file.txt",
public: true
}]);
console.log(result); // Successfully Updated
Checks if a file is public or private.
If receive an error "Authorization Denied", check policy File / Access in Access Management.
const permission = await Resources.files.checkPermission("/path/to/file.txt");
console.log(permission.public); // true or false
Copies files in TagoIO files.
const resources = new Resources({ token: "YOUR-PROFILE-TOKEN" });
const result = await resources.files.copy([{
from: "/source/file.txt",
to: "/destination/copy.txt"
}]);
console.log(result);
Deletes files or folders from TagoIO storage.
If receive an error "Authorization Denied", check policy File / Upload in Access Management.
const result = await Resources.files.delete([
"/path/to/file.txt",
"/folder/to/delete"
]);
console.log(result); // Successfully Removed
Gets the MD5 hash of a file with authentication for private files. This hash can be used to verify file integrity.
If receive an error "Authorization Denied", check policy File / Access in Access Management
const md5Hash = await Resources.files.getFileMD5("https://storage.tago.io/file/path/document.pdf");
console.log(md5Hash); // e.g. "d41d8cd98f00b204e9800998ecf8427e"
Gets a signed URL with temporary authentication token.
If receive an error "Authorization Denied", check policy File / Access in Access Management.
const signedUrl = await Resources.files.getFileURLSigned("https://api.tago.io/file/...");
console.log(signedUrl);
Optional
queryObj: FileQueryLists all files in the application with pagination support.
https://help.tago.io/portal/en/kb/articles/127-files Files
If receive an error "Authorization Denied", check policy File / Access in Access Management.
const result = await Resources.files.list({
path: "/my/folder",
quantity: 100
});
console.log(result); // { total: 200, usage: 0.05, files: [ { size: 7812, ...} ], folders: [ 'my-folder' ] }
Moves or renames files in TagoIO storage.
If receive an error "Authorization Denied", check policy File / Edit in Access Management.
const result = await Resources.files.move([{
from: "/old/path/file.txt",
to: "/new/path/renamed.txt"
}]);
console.log(result); // Successfully Updated
Uploads base64 encoded files to TagoIO storage.
https://help.tago.io/portal/en/kb/articles/140-uploading-files Uploading Files
If receive an error "Authorization Denied", check policy File / Upload in Access Management.
const result = await Resources.files.uploadBase64([{
filename: "/my-files/document.pdf",
file: "base64EncodedContent",
public: true,
}]);
console.log(result);
Optional
options: UploadOptionsUploads a single file to TagoIO using multipart upload. The file is divided into chunks and uploaded in parallel for better performance.
If receive an error "Authorization Denied", check policy File / Upload in Access Management.
const file = Buffer.from("file content");
const result = await Resources.files.uploadFile(file, "/uploads/myfile.txt", {
chunkSize: 5 * 1024 * 1024, // 5MB chunks
onProgress: (progress) => console.log(`Upload progress: ${progress}%`)
});
console.log(result.file); // https://api.tago.io/file/.../uploads/myfile.txt
Description
Adds an upload to the queue. It will try to upload for 'opts.maxTriesForEachChunk' and fail if it couldn't upload after those many tries.