Delete Library File
Controlled node
Overview
The Delete Library File node permanently removes a file from the project's library. This is a destructive operation that cannot be undone. The node accepts a file object (typically obtained from other library nodes such as Get Library Files or Find Library Files) and deletes the corresponding file from storage and the library index.
Inputs
| Input | Type | Description | Default |
|---|---|---|---|
| Run | Event | Fires the node to start the deletion process. | - |
| File | Data | The file object to delete. Must contain an id property. Can accept an array of file objects, in which case only the first file in the array will be deleted. | - |
Outputs
| Output | Type | Description |
|---|---|---|
| Done | Event | Fires when the deletion operation has completed, regardless of success or failure. |
| Result | Data | Contains the result of the deletion operation. Returns {success: true} on successful deletion, or {error: 'error message'} if the operation fails (e.g., if the file is not found, the project ID is unavailable, or the file data is invalid). |
Runtime Behavior and Defaults
When triggered by the Run event, the node performs the following steps:
- Validation: Checks that the
fileinput contains a valid file object with anidproperty. If the input is an array, it extracts the first element. - Project Context: Retrieves the runtime project ID from the workflow context. If no project ID is available, the operation fails.
- Deletion: Calls the library system to permanently delete the document from storage and remove its metadata from the library index.
- Result: Outputs
{success: true}if deletion succeeds, or an error object with a descriptive message if it fails.
This node permanently deletes files from the library. Deleted files cannot be recovered. Ensure you have appropriate validation or confirmation steps in your workflow before triggering this node.
Example Usage
Basic File Deletion:
- Use a Get Library Files node to retrieve a file object from the library.
- Connect the
metadataoutput (or the file object output) to thefileinput of the Delete Library File node. - Trigger the
runevent to execute the deletion. - Connect the
resultoutput to an Assert node or conditional logic to verify the deletion succeeded (checking forsuccess: true).
Batch Deletion (First File Only):
If you pass an array of files to the file input, only the first file in the array will be deleted. To delete multiple files, you would need to iterate through the array using a For Each node, passing each file individually to the Delete Library File node.