If you wish to use the same terminal for future commands, you need to run ipfs daemon &
. This will run the daemon in the background and return control to the terminal.
How to retrieve your pinned content
Retrieving content using a Kubo client
Once your content is pinned on our service, you can retrieve it via any other Kubo client, compatible with Linux, Mac, and Windows.
-
Run the following CLI command to initialize your local IPFS node:
ipfs init -
Run the following CLI command to launch the IPFS background process, effectively turning your device into a functioning node in the IPFS network:
ipfs daemonTip -
Run the following command to fetch your content using its CID and store it in a file. Make sure to replace the example values with your own:
ipfs get <YOUR_PINNED_CID> > myFileNoteYour content will be stored in a file called
myFile
.
Retrieving content using an HTTP gateway
There are different ways to access data over the HTTP or HTTPS protocols. You can either use a web browser or the curl command.
Paste the following link into your web browser to retrieve public content via an IPFS gateway. Make sure to replace the example value with your own:
https://ipfs.io/ipfs/<YOUR_PINNED_CID>
Alternatively, run the following curl
command to retrieve it via a local client. Also make sure to replace the example value with your own:
curl https://ipfs.io/ipfs/<YOUR_PINNED_CID>
Retrieving content using a Go client
You can also retrieve pinned content via the Go program. To do so, we recommend using the official kubo client rpc.
In this case, you need to run an IPFS node (like Kubo) to perform operations with the IPFS network.
package mainimport ("context""fmt""os""github.com/ipfs/boxo/files""github.com/ipfs/kubo/client/rpc""github.com/ipfs/kubo/core/commands/cmdutils")func main() {// Create an IPFS RPC client for the local APIapi, err := rpc.NewLocalApi()if err != nil {fmt.Println("Error creating IPFS RPC client:", err)return}// CID of the content you want to retrievecid := "<YOUR_PINNED_CID>"// Convert the CID to a pathp, err := cmdutils.PathOrCidPath(cid)if err != nil {fmt.Println("Error resolving path:", err)return}// Send get command to ipfs nodectx := context.Background()file, err := api.Unixfs().Get(ctx, p)if err != nil {fmt.Println("Error getting content:", err)return}// Write the content to the fileerr = files.WriteTo(file, "myFile")if err != nil {os.Exit(1)}// Write the content to the file with cid filename by default//res := files.ToFile(file)}