The better ipfs output path

When i use the command ‘ipfs get XXXXXXXX’, i find the downloaded content in the go-ipfs binary directory, and when i use ‘ipfs pin ls’,i can’t see that.
So, i think maybe set the default output path to RepoPath will be better.
:joy:

For me ipfs get downloads to the location from which ipfs is being run (pwd). So not sure what you mean…

2 Likes

Same here: new terminal defaults to $HOME, and that’s where ipfs get puts the downloaded file.

As for the pin command, and correct me if I’m wrong: if you just ipfs get an object, it’s not pinned, maybe not even cached. You need to run ipfs pin add <hash>. Don’t know how it is with ipfs cat <hash> > filename. This will also download the object to your working directory, but will the object also get pinned? Cached sure, but pinned I believe not.

@Alvin it seems like you might be confused about the purpose of ipfs get. The documentation might be unclear.

The ipfs get command is basically a “read this thing out of the ipfs system and put it on my regular filesystem”. It’s asking your ipfs node to get content from the ipfs network – maybe from your local ipfs repo, maybe from another node – and write it to your regular filesystem. It’s a more user-friendly version of ipfs cat. With ipfs cat you would have to write the contents of the output into a file. ipfs get handles that for you.

As with ipfs cat, running ipfs get does not pin the content into your repo. It just retrieves the content and passes it to the destination on your filesystem (by default, the directory where you ran the command). If you want that content pinned on your node, you have to use the ipfs pin add command.

1 Like

Question for the pro @flyingzumwalt: so if get is the user-friendly version of cat, does that mean that both commands (get & cat) will temporarily cache the file?

cat definitely caches the file (or data) temporarily. I’m pretty sure that get does too. @Kubuxu can you confirm that?

Yes, both those functions save date they download and save data to the blockstore. It will be there (if not pinned) until next GC.

2 Likes