I'm currently looking into ways to quickly check if a given IPFS object (i.e. an IPFS hash) is on your node.
One command I found is
ipfs object stat <hash>
If the object is on your node, whether pinned or just cached,
ipfs will immediately print the object stats like cumulative size. For objects not on your node, stats might still be printed eventually, but it will take longer, so you could then timeout the
ipfs object stat command, but it would be better, if
ipfs just returned an error like "nope, not on your local node".
Is there a command like this?