Overview
This node integrates with Cloudflare R2, a cloud object storage service compatible with the S3 API. It allows users to perform common file storage operations such as uploading files to a bucket, downloading files from a bucket, deleting files, and listing files within a bucket.
Typical use cases include:
- Backing up data or files by uploading them to Cloudflare R2.
- Retrieving stored files for processing or delivery.
- Managing stored files by deleting obsolete or unwanted objects.
- Enumerating files in a bucket to display or process them further.
For example, you could automate uploading generated reports to Cloudflare R2, download images for processing workflows, or list all files in a bucket to trigger actions on each.
Properties
Name | Meaning |
---|---|
Bucket 名称 | The name of the Cloudflare R2 bucket where files will be uploaded, downloaded, deleted, or listed. This is required for all operations. |
Note: The provided properties JSON only includes the "bucket" property relevant to the "list" operation, but the node supports other operations with additional properties (like "key" for specifying file names).
Output
The node outputs an array of JSON objects, each corresponding to one input item processed. The structure varies by operation:
- upload: Outputs
{ success: true, operation: 'upload', bucket: <bucketName>, key: <fileKey> }
indicating successful upload. - download: Outputs
{ success: true, operation: 'download', bucket: <bucketName>, key: <fileKey>, data: <fileContentAsString> }
containing the downloaded file content as a UTF-8 string. - delete: Outputs
{ success: true, operation: 'delete', bucket: <bucketName>, key: <fileKey> }
confirming deletion. - list: Outputs
{ success: true, operation: 'list', bucket: <bucketName>, files: <arrayOfFileObjects> }
wherefiles
is an array of objects representing files in the bucket.
The node does not output binary data directly; downloaded file contents are returned as UTF-8 strings in the JSON output.
Dependencies
- Requires valid credentials for Cloudflare R2, including an account ID, access key ID, and secret access key.
- Uses AWS SDK's S3 client configured to connect to Cloudflare R2 endpoints.
- Requires n8n credentials setup for authenticating with Cloudflare R2.
Troubleshooting
- Download failure due to empty file content: If the downloaded file body is empty, the node throws an error indicating download failure because the file content is empty. Ensure the specified file key exists and contains data.
- Invalid credentials or permissions: Authentication errors may occur if the provided API keys or account ID are incorrect or lack necessary permissions. Verify credential correctness and permissions.
- Bucket or key not found: Errors can arise if the specified bucket or file key does not exist. Double-check bucket names and file keys.
- Binary data handling: For uploads using binary data, ensure the binary property name matches the actual binary data field in the input.