Ipfs dag put pinning

Hey, can someone asnwer. How to pin a dag? When i doing “ipfs add file” it’s pinning automatically, but how to pin dag hash?

In this article we have example with adding foo and baz to foo.json, so if i add this json with “ipfs dag put foo.json”
Is child hashesh will keep alive with root hash?

1 Like

Hey there, @nezzard. Thanks for your question. What article are you referring to?

There’s a flag for that! All you need is: ipfs dag put --pin foo.json :slight_smile:

That’s essentially:

$ ipfs dag put foo.json
# outputs <hash>
$ ipfs pin add <hash>
# 'pinned <hash>'

Pinning foo.json's hash will prevent that dag node from being removed.


Is child hashesh will keep alive with root hash?

I don’t know what you mean by child hash here. If I haven’t answered your question, can you say it another way?

Note that pinning is not yet available in js-ipfs. We are super close to adding it, though. It should be in the next release or two.