Lazy loading content of a folder

Is there anyway that ipfs can support lazyloading content of a folder? Is this do-able or part of planned features?

I don’t know that it is an official feature, but theorically you should be able to mess with BitSwap to ask around if people have the content, but only request them to send it when needed, lazily. You won’t be able to verify the integrity vefore having downloaded the whole folder and content, to the best of my knowledge.

1 Like

As far as I can tell MFS naturally works like this.

If I map in a folder then the contents of the folder are not fetched locally until I actually try to pull them via the node. Once they have been fetched they remain pinned until deleted from MFS

1 Like

What is MFS?
When I upload a Folder in ipfs, I get one hash. When I cat the hash, I believe the whole content would load together or am I wrong? If it doesn’t load together, what is the criteria to load which one first?

It’s not just doable it’s the default. For example, if you do ipfs ls QmDirectoryCID it doesn’t download the whole folder. Similarly if you do ipfs get QmDirectoryCID/subfolder it’ll only download the subfolder for you not everything under the root directory.

Note: despite ipfs ls QmDirectoryCID not downloading everything it does download some data for each object in the directory by default so it can tell you if it’s a file or directory so if your directory is big this might take a bit of time. There are flags in the command to disable that though (--resolve-type=false --size=false)