Download icon

Download

Download a file from IPFS

Overview

This node downloads a file from the InterPlanetary File System (IPFS) using a specified IPFS gateway, Content Identifier (CID), and optional file path. It supports downloading the file in three formats: as binary data (file), as JSON, or as plain text. This node is useful for workflows that need to retrieve decentralized content stored on IPFS, such as fetching documents, images, or JSON metadata.

Practical examples:

  • Downloading an image or PDF stored on IPFS as a binary file to process or save locally.
  • Retrieving JSON metadata from IPFS for further automation or analysis.
  • Fetching textual content from IPFS to use within a workflow or send via messaging.

Properties

Name Meaning
IPFS Gateway The IPFS gateway URL template to use for downloading. Currently supports "Web3 Storage".
CID The Content Identifier of the file to download. Required.
Path The path within the IPFS content to the specific file to download.
Operation The download mode: "Download as File" (binary), "Download as JSON", or "Download as Text".
Mime Type (Only for "Download as File") Optionally set the MIME type of the downloaded file.
Overwrite File Name (Only for "Download as File") Optionally overwrite the downloaded file's name.

Output

The output depends on the selected operation:

  • Download as File: Outputs binary data under the binary.data property. The binary object includes metadata such as fileName, mimeType, fileExtension, fileType, directory, and fileSize. Additionally, if the JSON part is empty, it populates json.file with file metadata and includes the input data under json.input.

  • Download as JSON: Parses the downloaded content as JSON and outputs it under the json property.

  • Download as Text: Converts the downloaded content to a string and outputs it as { json: { content: <text> } }.

Dependencies

  • Requires access to an IPFS gateway URL that supports HTTP GET requests.
  • No external API keys are explicitly required, but the chosen IPFS gateway may require authentication depending on configuration.
  • Uses standard HTTP methods; no additional n8n credentials are needed unless the gateway requires them.

Troubleshooting

  • Empty or invalid CID: The node requires a valid CID. Ensure the CID is correctly provided; otherwise, the request will fail.
  • Incorrect path: If the path does not exist within the IPFS content, the request will return an error or empty response.
  • Gateway issues: If the IPFS gateway is down or unreachable, the node will fail to download the file.
  • Parsing errors (JSON operation): If the content is not valid JSON, the node will throw a parsing error. Verify the content format before selecting this operation.
  • Binary data issues: When downloading as a file, ensure the MIME type and file name are correctly set if you want proper handling downstream.

Links and References

Discussion