Hi there,
I’ve searched through the forum and Internet and it seems I can’t find any tutorial or documentation on the topic.
For a file or a directory, I could easily get the CID using IPFS Add CLI or API provided by the IPFS daemon. What I’d like to know is how do we get the same CID locally without running an IPFS daemon?
For encoded string content, I have no problem getting the CID using the official CID and multihash implementations (https://github.com/multiformats/cid#implementations). However, from what I understand so far, to get a CID of a file/directory, files should be chunked and built into a DAG, then the CID will be computed from the DAG. The implementation of DAG building, the chunking algorithm and chunker size, all these factors would make the result CID different.
It seems there are Go and JavaScript implementation of the UnixFS to handle the DAG building. But after trying blindly for a while I still can’t get the CID we’ll get when using the default configuration to add a file via IPFS daemon.
Maybe there’s some official documentation or community project about how to create exactly same CID as the CID created through IPFS daemon. Any help or direction would be appreciated.
Thanks for the reply. I understand there’s actually no such thing as uploading in IPFS. I guess I used the word uploading because I’m currently using a remote IPFS node so I used the term without thinking too much.
I’m not sure if there’s anything I missed or if it is an issue of ipfs-only-hash. It seems like I’ll have to look into the source code you mentioned. Thanks for the information.