calculate the size of all files of a given directory, you can use it by cli or npm package.
// install locally
$ npm install @mxydl2009/dir-size
// install globally
$ npm install @mxydl2009/dir-size -g
// foo.js
const { size } = require('@mxydl2009/dir-size');
// size of current working directory, exclude node_modules directory
console.log(await size('./', 'node_modules'));
# calculate size of current working directory
$ dsize --dir . --exclude node_modules
Returns a Promise<number>
of all files size of path.
Returns a number
of all files size of path.
require absolute path or relative path, when relative path is relative to the current working directory
option argument, require the whole directory name, exclude the directory that you don't want to include