Actions111
- Item Actions
- Webhook Actions
- Collection Actions
- File Actions
- Activity Actions
- Asset Actions
- Authentication Actions
- Extension Actions
- Field Actions
- Folder Actions
- Permission Actions
- Preset Actions
- Relation Actions
- Revision Actions
- Role Actions
- Setting Actions
- User Actions
- Utility Actions
Overview
The File - List operation in this custom n8n node is designed to retrieve a list of files from a connected service (likely Directus, based on the code and property names). It supports advanced querying, filtering, aggregation, and export options. This node is beneficial when you need to:
- Fetch all or a subset of files with flexible limits.
- Apply filters, sorting, grouping, and aggregation functions to file data.
- Export file lists in various formats (CSV, JSON, XML).
- Integrate file listing into automated workflows for reporting, migration, or data analysis.
Practical examples:
- Retrieve all image files uploaded in the last month and export them as a CSV report.
- Get a paginated list of files matching a search term for further processing.
- Aggregate file counts by type or uploader.
Properties
| Name | Type | Meaning |
|---|---|---|
| Return All | Boolean | Whether to return all results or only up to a given limit. If false, the Limit property applies. |
| Limit | Number | Maximum number of results to return (applies if Return All is false). Range: 1–100. |
| Split Into Items | Boolean | Whether to output each element of an array as its own item in the workflow. |
| JSON/RAW Parameters | Boolean | Whether query/body parameters should be set via the UI (off) or as raw JSON (on). |
| Body Parameters | JSON | Body parameters as JSON or RAW (used if JSON/RAW Parameters is true). |
| Additional Fields | Collection | Extra options for customizing the request, including: |
| — Aggregate | Collection | Aggregation functions (e.g., count, sum, average) to perform calculations on fields. |
| — Binary Property for Export Data | String | Name of the binary property to store exported data (for file downloads). |
| — Deep (JSON) | JSON | Set nested query parameters for relational datasets. |
| — Export | Options | Format to save API response: csv, json, or xml. |
| — File Name for Export Data | String | File name (without extension) for exported data. |
| — Fields | String | Specify which fields to return in the object. |
| — Filter (JSON) | JSON | Conditions to filter items in the collection. |
| — Group By | String | Field(s) to group results by (e.g., author, year). Useful for aggregations. |
| — Meta | String | Metadata to include in the response. |
| — Offset | Number | How many items to skip (for pagination). |
| — Search | String | Search query to filter items containing the term in any field. |
| — Sort | String | Sorting order for returned items. Comma-separated fields; use minus sign for descending, question mark for random. |
Output
- The node outputs a
jsonfield containing the list of files and any additional metadata as returned by the underlying API. - If the "Export" option is used, the node can output binary data (e.g., CSV, JSON, or XML file) under the specified binary property name. This allows downstream nodes to access the exported file directly.
Dependencies
- Requires connection to a Directus (or compatible) API endpoint.
- May require API credentials or authentication configured in n8n.
- No external npm dependencies are visible in the provided code, but the node relies on internal methods and router logic.
Troubleshooting
Common issues:
- Authentication errors: Ensure API credentials are correctly configured in n8n.
- Invalid filter/group/sort syntax: Double-check JSON formatting and field names.
- Limit exceeded: If requesting more than allowed, reduce the Limit value.
- Export errors: If binary output is missing, verify the "Binary Property for Export Data" and "Export" settings.
Error messages:
- "Invalid JSON in filter/deep/body parameters": Check that your JSON input is valid.
- "Field not found in aggregation/group by": Make sure the field names exist in your dataset.
- "API error: Unauthorized/Forbidden": Review your API credentials and permissions.