Overview
This node downloads a file from the InterPlanetary File System (IPFS) using a specified CID (Content Identifier) and path. It supports downloading the file in three formats: as binary data (file), as JSON, or as plain text. This is useful for workflows that need to retrieve decentralized content stored on IPFS, such as documents, images, or JSON metadata.
Practical examples:
- Downloading an image or PDF stored on IPFS to process or store it locally.
- Retrieving JSON metadata from IPFS for further automation or analysis.
- Fetching textual content from IPFS for display or transformation.
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" gateway with URL pattern https://<<cid>>.ipfs.w3s.link . |
CID | The Content Identifier of the file to download from IPFS. |
Path | The path within the IPFS content to the specific file to download. |
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 file name of the downloaded file. |
Output
The output structure depends on the selected operation:
Download as Text: Outputs a JSON object with a single field:
{ "content": "<textual content of the downloaded file>" }
This contains the entire file content as a string under the
content
key.Download as JSON: Parses the downloaded file content as JSON and outputs it directly as the JSON data.
Download as File: Outputs binary data representing the downloaded file. The binary data includes metadata such as:
fileName
: The name of the file (can be overwritten).mimeType
: The MIME type of the file (can be set manually).fileExtension
: The file extension derived from the file name.fileType
: A categorized type based on MIME type (e.g., json, text, pdf, image, html).- Other binary metadata like directory, file size, and id if available.
Additionally, if the JSON part of the output is empty, it populates it with file metadata and input data reference.
Dependencies
- Requires access to an IPFS gateway service to fetch files by CID and path.
- No explicit external API keys are required, but the gateway URL must be accessible.
- Uses standard HTTP GET requests to retrieve files.
- No additional environment variables or n8n credentials are needed beyond network access.
Troubleshooting
Common issues:
- Invalid or inaccessible CID or path will result in failed HTTP requests.
- Incorrect gateway URL format may cause request failures.
- Parsing errors when selecting "Download as JSON" if the file content is not valid JSON.
- Empty or missing file content if the path does not point to a valid file.
Error messages:
- HTTP errors (404, 500, etc.) indicate problems accessing the file on the IPFS gateway.
- JSON parsing errors occur if the content is not valid JSON when using "Download as JSON".
Resolutions:
- Verify the CID and path correctness.
- Ensure the IPFS gateway URL is reachable and correctly formatted.
- Use the appropriate operation matching the expected file content type.
- For JSON downloads, confirm the file content is valid JSON.
Links and References
- IPFS Documentation
- Web3.Storage Gateway
- n8n Documentation on HTTP Request Node (for understanding underlying HTTP calls)