Download icon

Download

Download a file from IPFS

Overview

This node downloads files from the InterPlanetary File System (IPFS) using a specified IPFS gateway. It supports downloading files as JSON, text, or binary data (file). This is useful for workflows that need to retrieve decentralized content stored on IPFS by specifying its CID (Content Identifier) and optional path.

Common scenarios include:

  • Fetching JSON metadata or configuration files stored on IPFS.
  • Downloading text-based documents or logs.
  • Retrieving binary files such as images, PDFs, or other media from IPFS for further processing or storage.

For example, you can use this node to download a JSON file containing metadata about a digital asset stored on IPFS, or fetch an image file to process it downstream in your workflow.

Properties

Name Meaning
Operation The type of download operation to perform. Options: "Download as File", "Download as JSON", "Download as Text".
IPFS Gateway The IPFS gateway URL template to use for fetching the file. Currently supports "Web3 Storage" with URL format https://<<cid>>.ipfs.w3s.link.
CID The Content Identifier (CID) of the IPFS file to download. Required.
Path Optional path within the IPFS CID to specify a particular file or subdirectory.
Mime Type (Only for "Download as File") Optionally override the MIME type of the downloaded file.
Overwrite File Name (Only for "Download as File") Optionally overwrite the filename of the downloaded file.

Output

The output structure depends on the selected operation:

  • Download as JSON: Outputs a single item with a json property containing the parsed JSON content of the downloaded file.

    {
      "json": { /* parsed JSON content */ }
    }
    
  • Download as Text: Outputs a single item with a json property containing a content field holding the downloaded text content.

    {
      "json": {
        "content": "text content here"
      }
    }
    
  • Download as File: Outputs items with binary data under the binary.data property. The binary data includes metadata such as fileName, mimeType, fileExtension, fileType, and optionally fileSize. If no JSON data exists, the node adds a minimal JSON object describing the file metadata and input data.

    The fileType is inferred from the MIME type (e.g., json, text, pdf, image, html).

Dependencies

  • Requires access to an IPFS gateway URL to fetch files via HTTP GET requests.
  • No external API keys are explicitly required, but network access to the chosen IPFS gateway must be available.
  • No additional n8n credentials or environment variables are needed beyond standard HTTP request capabilities.

Troubleshooting

  • Empty or invalid CID: The node requires a valid CID to locate the file on IPFS. Ensure the CID is correctly provided.
  • File not found or incorrect path: If the specified path within the CID does not exist, the request will fail or return empty. Verify the path parameter.
  • Invalid JSON parsing: When using "Download as JSON", if the file content is not valid JSON, the node will throw a parsing error. Confirm the file content is proper JSON.
  • Network issues: Failure to reach the IPFS gateway due to network restrictions or downtime will cause errors. Check connectivity and gateway status.
  • MIME type mismatches: For "Download as File", setting an incorrect MIME type may affect downstream processing. Use the Mime Type property only if necessary.

Links and References

Discussion