I hope my question is not that stupid, but i have read a lot of docs and still don’t understand how does ipfs get works.
3 devices in local network. Each device has ipfs installed. Each device already discovered each other, so there 2 other peers for each node.
In my mind IPFS works next way:
ipfs add <path_to_file> - add file to ipfs repository. Hash returned. Let it be $HASH.
ipfs pin add $HASH. Since add or pin add file started to be distributed over peers current node can reach. It means, i don’t need to start uploading process on other node manually.
Then i have
ipfs refs local command to display local hashes. In my mind if i see created hash on the other node in the list of local refs, it means, file already exists in ipfs local repository. When i say exists i mean, that it was completely uploaded from other nodes.
So question 1 here.
How can i use this file if it hash already in local refs? For example, i was adding binary file and want to run it?
Is there some way to watch how many blocks | bytes already exists in my local repo?
I’m confused, because i have
get cmd, which as i see, always try to download file form remote node instead of using local repo even if i have my file in local refs.
# create file we are going to distribute over peers fallocate -l 499M large_file ipfs add large_file > added QmQacN1u9yygjG3fQn86RuufPdPqGAi7XJmoCUehwdmSRs large_file ipfs pin add QmQacN1u9yygjG3fQn86RuufPdPqGAi7XJmoCUehwdmSRs > pinned QmQacN1u9yygjG3fQn86RuufPdPqGAi7XJmoCUehwdmSRs recursively
ipfs refs local | grep QmQacN1u9yygjG3fQn86RuufPdPqGAi7XJmoCUehwdmSRs > QmQacN1u9yygjG3fQn86RuufPdPqGAi7XJmoCUehwdmSRs # ref found ipfs get QmQacN1u9yygjG3fQn86RuufPdPqGAi7XJmoCUehwdmSRs > Saving file(s) to QmQacN1u9yygjG3fQn86RuufPdPqGAi7XJmoCUehwdmSRs > 176.59 MiB / 499.00 MiB [=======>-----------------------] 35.39% 00m27s
As you can see, when i type
get it starts downloading which takes about 30 seconds with my internet bandwidth.