IPFS Files – How to Retrieve an IPFS File/JSON with Pinata?

ipfs

I have been using Pinata API to pin new files and JSON objects in IPFS in a very easy way.
I can see that the file is stored in IPFS when I access it via browser with Cloudflare: https://cloudflare-ipfs.com/ipfs/"MY_IPFS_FILE_HASH"

Best Answer

To access pinned files on IPFS via pinata (ie using pinata as a gateway, files can be pinned via whatever pining-provider), you can use their gateway: https://gateway.pinata.cloud/ipfs/{your hash}

ipfs.io has a gateway too: https://ipfs.io/ipfs/{your hash}

In a programmatic way, there are packages for various languages (for instance this for nodeJS: https://www.npmjs.com/package/js-ipfs-fetch)

Or you can run your own IPFS node and use it in a P2P way to retrieve data from other nodes, as described here: https://docs.ipfs.io/how-to/exchange-files-between-nodes/#prerequisites