Skip to main content

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

InputTypeDescriptionDefault
RunEventFires the node to start the deletion process.-
FileDataThe 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

OutputTypeDescription
DoneEventFires when the deletion operation has completed, regardless of success or failure.
ResultDataContains 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:

  1. Validation: Checks that the file input contains a valid file object with an id property. If the input is an array, it extracts the first element.
  2. Project Context: Retrieves the runtime project ID from the workflow context. If no project ID is available, the operation fails.
  3. Deletion: Calls the library system to permanently delete the document from storage and remove its metadata from the library index.
  4. Result: Outputs {success: true} if deletion succeeds, or an error object with a descriptive message if it fails.
Permanent Deletion

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:

  1. Use a Get Library Files node to retrieve a file object from the library.
  2. Connect the metadata output (or the file object output) to the file input of the Delete Library File node.
  3. Trigger the run event to execute the deletion.
  4. Connect the result output to an Assert node or conditional logic to verify the deletion succeeded (checking for success: 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.