isomorphic-git / lightning-fs

A lean and fast 'fs' for the browser
MIT License
487 stars 48 forks source link

Read folder and subfolders as a single file #111

Closed butera-simone closed 1 year ago

butera-simone commented 1 year ago

I'm sorry, this library seems great but not having any experience with browser storage I'm finding the docs very counter-intuitive. I managed to make it do most of what I need, but as the title suggests I'm trying to understand if there's a way to access a folders & its subfolders as a single file (to, for example, download it, or send it via webRTC, or anything else)

jcubic commented 1 year ago

You will need to create a zip or tar file. There is no other way to download a directory as a single file on any system including the browser. And this is have nothing to do with this library.

jcubic commented 1 year ago

You need to traverse a tree and create a zip file, the same as you do with NodeJS.

butera-simone commented 1 year ago

Yeah I intuitively thought about doing that as a last option, but I hoped I could find a library that abstracted it. Like, if you could pass the path of the folder to a method and get an array containing all of the files? Idk, thanks anyways 👍

jcubic commented 1 year ago

You can always create a library like this if you need it.

butera-simone commented 1 year ago

Yeah I'm not saying a library should have it, I'm saying it could have it, and for what I'm building it would make sense to check for libraries with high level management of files before writing it from scratch

This issue was a question about the library not a proposal to change it

jcubic commented 1 year ago

You need to do research to find out if such a library exists. Maybe ask on Reddit. This library doesn't have such a thing this is just Node FS implementation. You can find in the Search engine how to create single file from directory in NodeJS.

jcubic commented 1 year ago

Ok, I'm closing this.

butera-simone commented 1 year ago

Sure! I'm looking through various libraries rn, thanks for your answers 👍