Cloudflare R2 icon

Cloudflare R2

Cloudflare R2 存储操作

Overview

This node provides integration 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 clean up storage by deleting old files.

Properties

Name Meaning
Bucket 名称 The name of the Cloudflare R2 bucket where the operation will be performed.
文件名 The key (filename) of the object in the bucket to upload, download, or delete.

Note:

  • The "文件名" property is required for upload, download, and delete operations but not for listing files.
  • Additional properties exist for upload operation only (not requested here), such as whether to use binary data and the binary property name.

Output

The node outputs an array of JSON objects, each corresponding to one input item processed. The structure varies by operation:

  • Upload:

    {
      "success": true,
      "operation": "upload",
      "bucket": "<bucket_name>",
      "key": "<file_key>"
    }
    

    Indicates successful upload of the specified file to the bucket.

  • Download:

    {
      "success": true,
      "operation": "download",
      "bucket": "<bucket_name>",
      "key": "<file_key>",
      "data": "<file_content_as_utf8_string>"
    }
    

    Contains the downloaded file content as a UTF-8 string under data.

  • Delete:

    {
      "success": true,
      "operation": "delete",
      "bucket": "<bucket_name>",
      "key": "<file_key>"
    }
    

    Confirms successful deletion of the specified file.

  • List:

    {
      "success": true,
      "operation": "list",
      "bucket": "<bucket_name>",
      "files": [ /* array of file metadata objects */ ]
    }
    

    Lists files in the bucket; files contains metadata about each object.

The node does not output binary data directly; downloaded file contents are returned as UTF-8 strings.

Dependencies

  • Requires valid credentials for Cloudflare R2, including an account identifier and access keys.
  • Uses AWS SDK's S3 client configured to communicate with Cloudflare R2 endpoints.
  • The node expects these credentials to be configured in n8n via an API key credential setup.

Troubleshooting

  • Download failure with empty content error: If the node throws an error indicating the downloaded file content is empty, verify that the specified file key exists in the bucket and is not empty.
  • Authentication errors: Ensure that the provided API credentials are correct and have sufficient permissions for the requested operations.
  • Bucket or key not found: Confirm that the bucket name and file key are correctly specified and exist in your Cloudflare R2 account.
  • Network or endpoint issues: Check network connectivity and that the endpoint URL matches your Cloudflare R2 account region and configuration.

Links and References

Discussion