Skip to content

Latest commit

 

History

History

du

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

garden cmd-du

Output disk usage, in bytes, for the given directory.

Usage

import { cmdDu } from '@zendeskgarden/scripts';

const KB = 1024;
const SIZES = ['B', 'K', 'M', 'G', 'T'];

(async () => {
  const usage = await cmdDu(dir?: string);
  const index = Math.floor(Math.log(usage) / Math.log(KB));
  const size = (usage / KB ** index).toFixed(1);

  console.log(`${size}${SIZES[index]}`);
})();

Arguments

  • dir directory to get usage for; defaults to the current directory.

Command

garden cmd-du [dir]