Skip to content

Instantly share code, notes, and snippets.

@darrenmothersele
Created December 19, 2018 18:30
Show Gist options
  • Select an option

  • Save darrenmothersele/6db60e7c42203720cfeb9cf51553e6e4 to your computer and use it in GitHub Desktop.

Select an option

Save darrenmothersele/6db60e7c42203720cfeb9cf51553e6e4 to your computer and use it in GitHub Desktop.
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