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.

Is pinning a DAG supported yet in the IPFS javascript API? Thx