更新时间:2023-02-14 22:39:12
好问题.简而言之,没有简单的方法可以做到这一点(即使对我们来说也是如此!),因为这实际上需要我们递归遍历整个文件集并将它们加总.这是一个很大的mapreduce,每次上传文件时运行效率都不高.
Great question. In short, there's no easy way to do this (even for us!) since this effectively requires that we recurse over an entire set of files and sum them all up. It's a pretty big mapreduce that isn't efficient to run every time a file is uploaded.
但是,我们会在metadata.size
属性中返回单个文件的大小,因此您可以在服务器上执行自己的list
调用(请参见
We do however, return the size of an individual file in the metadata.size
property, so you can perform your own list
call on a server (look at gcloud`) which will give you a list of files and "folders". Take the sizes of the files and add them up, then recurse and do the same for all subfolders. Sum them up, and write them something like the Firebase Realtime Database, where you can easily grab the folder sizes from clients.