Created
December 19, 2018 18:30
-
-
Save darrenmothersele/6db60e7c42203720cfeb9cf51553e6e4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const getUsage = async uid => { | |
| const [ files ] = await bucket.getFiles({ prefix: uid }); | |
| if (!files || !files.length) { | |
| return 0; | |
| } | |
| const getFileSize = file => +file.metadata.size; | |
| const sum = (a, b) => a + b; | |
| return files.map(getFileSize).reduce(sum, 0); | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment