Cloud
Move files and folders

Displace files and folders

The secrecyClient.cloud.moveNodes function moves multiple files or folders to a new parent folder in the cloud. It takes an object with two parameters: nodeIds (an array of file or folder IDs to be moved) and parentId (the ID of the new parent folder).

cloud.ts
const displaceFilesOrFolders = async ({
  nodeIds,
  parentId,
}: {
  nodeIds: string[];
  parentId: string;
}): Promise<boolean> => {
  // First we need to check if the secrecyClient is available
  if (!secrecyClient) {
    return false;
  }
 
  try {
    const isDisplaced = await secrecyClient.cloud.moveNodes({
      nodeIds,
      parentNodeId: parentId,
    });
 
    return isDisplaced;
  } catch (error) {
    console.error(error);
    return false;
  }
};