title: Google cloud storage directory size
body: <p>I'm trying to find out how to calculate the size of a directory inside a google-cloud-storage bucket.</p>
  
  <p>I've found two ways so far:</p>
  
  <ul>
  <li>Using <code>gsutils</code> (which I can't really, because it won't be available in the machine I need to do this from)</li>
  <li>Using the <code>getMetadata</code> method from the <code>nodejs</code> library.</li>
  </ul>
  
  <p>The problem is that the <code>getMetatada</code> method only works on files, and not directories (or prefixes as they're called).</p>
  
  <p>I could list all the files and ask them all for their size but <code>getMetadata</code> doesn't allow for query batching and I would probably be making people angry at @google.</p>
  
  <p>Do you guys know of any way to do that properly in a respectful manner?</p>
  
  <p>Sincerely</p>