If I understand you correctly, you would like to create a CID representing a folder containing the two files.
Is it possible to created such folder having only these 2 CIDs without downloading original files?
Technically, that should be possible.
As far as I know, creating a CID for the folder containing the two files will have its hash calculated based on the CIDs of the children. So having just the CIDs should be sufficient without downloading the file.
However, you’ll probably need to write code for this because I don’t think it can be done using the Kubo cli.
> ipfs dag put --store-codec=dag-pb dag.json
bafybeidtuvmy7ratlnfkuh5pkz4whjvqa3367bok43ozcm4oet2epypgwy
> ipfs cid format -v=0 bafybeidtuvmy7ratlnfkuh5pkz4whjvqa3367bok43ozcm4oet2epypgwy
QmW85q9pmby55reZb9YrcLRr5L2gHcvTFGoSmjADCbhq1w
As you can see, you end up with the same CID for the folder.
You could do this with ipfs object patch add-link using the empty folder CID as root, but the ipfs object subcommands have been deprecated. Anyway there are examples if you search the forums.
The way to do it now is the ipfs files way explained above.
ipfs object path add-link is a bit dangerous to work with which is why it’s been deprecated in favor of other commands such as those in ipfs files.
Basically, ipfs object worked on dag-pb data structures rather than UnixFS files and directories. This meant commands like add-link did not use sharded directories and could result in blocks of data that would not be transferrable over bitswap (and that even if they could be would’ve been sad for doing directory traversals).
How would we write the JSON if we wanted both blocks in a single file rather than directory? The thing that is tripping me up is the block size array because it is not translated to a human readable form in the JSON. How would I encode it?