Cloud
Restore from trash

Restore files and folders from trash

The secrecyClient.cloud.recoverNode method restores a file or folder from the cloud trash back to its original location.

cloud.ts
const removeFileOrFolderFromTrash = async (
  nodeId: string
): Promise<boolean> => {
  // First we need to check if the secrecyClient is available
  if (!secrecyClient) {
    return false;
  }
 
  try {
    const isRecovered = await await secrecyClient.cloud.recoverNode(nodeId);
 
    return isRecovered;
  } catch (error) {
    console.error(error);
    return false;
  }
};