Search code examples
ipfs

If you use a folder when you store your data on IPFS, the data is retrieved faster than storing each file separately?


For example, I store these files:

file1.txt, file2.txt, file3.txt

I will get a CID for each one of this QmWxTu252QLFko2eEzJNV16wMqR@sWMvRDjyzFzXw6RVbxE, QmWxTu252QLFko2eEzJNV16wMqSZW3vRDjyzFzXw6RVbxE,QmWxTu252QLFko2eEzJNV16wMq31ZWMvRDjyzFzXw6RVbxE and then I can access them using a gateway(but this process is very slow) (NOTE: this CID are not created)

But if a put these files behind a folder something like this:

folder1-file1.txt ,file2.txt ,file3.txt

I will get a CID just for the folder QmWxTu252QLFko2eEzJNV16wMqSZWMvRDjyzFzXw6RVbxE, and then I can access the file using a gateway.

Now, using a folder is faster to retrieve than storing each file individually? (I prefer that you don't need to stay 10s for each file, you stay once 10s and get all the files)

And when using folders the data is stored separately or is stored in the place?

Here is a folder that I created https://gateway.ipfs.io/ipfs/QmWxTu252QLFko2eEzJNV16wMqSZWMvRDjyzFzXw6RVbxE

And other people can contribute with information to this?


Solution

  • And when using folders the data is stored separately or is stored in the place?

    If you store the files individually or all in a directory, it's still the same data, so it's not duplicated.

    Now, using a folder is faster to retrieve than storing each file individually?

    It might be faster because you're doing less requests. It all depends on your use-case, do you want/need a directory? Directories are useful just for the fact you can actually give files human readable names and the directories are easy to index.

    And other people can contribute with information to this?

    The directory is addressed by CID, if someone copied the directory and changed it, they'd have a new CID.