File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed
Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -288,20 +288,28 @@ async function getQuota (root, serverUri) {
288288 return quota
289289}
290290
291+ /**
292+ * Returns true of the user has exceeded their quota
293+ */
294+
291295async function overQuota ( root , serverUri ) {
292296 let quota = await getQuota ( root , serverUri )
293297 if ( quota === Infinity ) {
294298 return false
295299 }
296- // IMPORTANT NOTE: The following will traverse the directory to find
297- // the actual file size of the files in the file system. This is a
298- // costly operation, but neglible for the small quotas we currently
299- // allow. If the quotas grow bigger, this will significantly reduce
300- // write performance, and so it needs to be rewritten.
301300 var size = await actualSize ( root )
302301 return ( size > quota )
303302}
304303
304+ /**
305+ * Returns the number of bytes that is occupied by the actual files in
306+ * the file system. IMPORTANT NOTE: Since it traverses the directory
307+ * to find the actual file sizes, this does a costly operation, but
308+ * neglible for the small quotas we currently allow. If the quotas
309+ * grow bigger, this will significantly reduce write performance, and
310+ * so it needs to be rewritten.
311+ */
312+
305313function actualSize ( root ) {
306314 return util . promisify ( getSize ) ( root )
307315}
You can’t perform that action at this time.
0 commit comments