benwinding / ngx-filemanager

File manager for Angular
https://benwinding.github.io/ngx-filemanager/
MIT License
9 stars 9 forks source link

Add folder size feature #15

Closed congweibai closed 3 years ago

congweibai commented 3 years ago

Hi Ben,

The original issue here: https://github.com/resvu/communitilink-admin/issues/1144, the folder always shows 0 bytes in UI.

As firebase storage does not provide folder size in metadata, refer to https://stackoverflow.com/questions/38762731/get-storage-space-used-in-a-folder-in-firebase-storage.

So my solution the first step is to hide the size attribute in UI if it is a folder.

The second step is to read custom meta if users calculate folder size and store it in custom metadata, for example, "metaData.size_children" if they pass this path in config object, and UI is able to show this size.

And I also created test input in demo.

Hope you could merge my PR and have a good day!

Thanks Wyatt

benwinding commented 3 years ago

Hi @congweibai,

Yes there's some limitations in the google cloud bucket API, as it's basically just a key value store, meaning folders aren't actually stored in a hierarchy.

Looks like a good solution though, has been merged and should be deployed soon!

Cheers, Ben