Move files and folders to trash
The secrecyClient.cloud.deleteNode
method moves a file or folder to the trash (soft delete) in the cloud. It takes a single parameter, nodeId, which represents the ID of the file or folder to be deleted
cloud.ts
const moveFileOrFolderToTrash = async (nodeId: string): Promise<boolean> => {
// First we need to check if the secrecyClient is available
if (!secrecyClient) {
return false;
}
try {
const isDeleted = await secrecyClient.cloud.deleteNode({
nodeId,
});
return isDeleted;
} catch (error) {
console.error(error);
return false;
}
};
Delete definitively file or folder
The secrecyClient.cloud.deleteNodeCloudTrash
permanently deletes a file or folder from the cloud trash. It takes one parameter, nodeId, which represents the ID of the file or folder to be permanently removed.
cloud.ts
const deleteDefinitivelyFileOrFolder = async (
nodeId: string
): Promise<boolean> => {
// First we need to check if the secrecyClient is available
if (!secrecyClient) {
return false;
}
try {
const isDeleted = await secrecyClient.cloud.deleteNodeCloudTrash({
ids: [nodeId],
});
return isDeleted;
} catch (error) {
console.error(error);
return false;
}
};