ipfs add
command gets me the hash, but it also makes the data available to the peers online.
For testing purpose, while building apps, I need the hash code without making it available to peers.
IPFS allows pin and unpin for pinning objects to local storage. But I am unable to understand how it works.
If an object is unpinned, will the data be available to peers?
Also if I download a new file from other peers using a hash, will it get automatically pinned to the local storage?
Hey @amiyatulu, great questions. You should ask this in ipfs/faq; that's where questions like this are most likely to be answered. This repo is not a discussion repo.
Link your questions back here, and I'll close this issue up then. Thanks!
From ipfs add --help
it looks like ipfs add --only-hash <ipfs-path>
is what you want!
If an object is unpinned, will the data be available to peers?
It will be if other peers already have it in their datastore (pinned or not).
Also if I download a new file from other peers using a hash, will it get automatically pinned to the local storage?
It won't be pinned but it will be cached in your datastore so you don't have to download it again and can start serving it to other peers. I believe by default the datastore size is set to 10GB. When you pin a file it will not get removed from your datastore until you explicitly unpin it (ipfs pin rm <ipfs-path>
).
Thanks for answering @basile-henry.
Tagging this issue as duplicate, see original https://discuss.ipfs.io/t/can-i-get-the-hash-for-my-data-without-adding-it-to-ipfs/269
Most helpful comment
From
ipfs add --help
it looks likeipfs add --only-hash <ipfs-path>
is what you want!It will be if other peers already have it in their datastore (pinned or not).
It won't be pinned but it will be cached in your datastore so you don't have to download it again and can start serving it to other peers. I believe by default the datastore size is set to 10GB. When you pin a file it will not get removed from your datastore until you explicitly unpin it (
ipfs pin rm <ipfs-path>
).