IPFS
IPFS is theInter-Planetary File System. curl supports IPFS only via anHTTP gateway. It means that it understands IPFS URLs when given to it, butyou must also provide a working gateway URL for curl to use to retrieve thecontent. curl does not speak IPFS natively.
Gateway
The--ipfs-gateway
lets the user specify the IPFS HTTP gateway URL. Like this:
curl --ipfs-gateway http://localhost:8080 ipfs://bafybeigagd5nmnn2iys2f3d/
If you opt to go for a remote gateway you should be aware that you completelytrust the gateway. This is fine in local gateways as you host it yourself.With remote gateways there could potentially be a malicious actor returningyou data that does not match the request you made, inspect or even interferewith the request. You might not notice this when getting IPFS using curl.
If the--ipfs-gateway
option is not used, curl checks theIPFS_GATEWAY
environment variable for guidance and if not set, the~/.ipfs/gateway
filethat can be used to identify the gateway.
IPFS support was first added to curl in version 8.4.0.