2.0.0 • Published 6 years ago
dirsize v2.0.0
DirSize
Get directory size with emitter.
Global
DirSize
could be installed global with
npm i dirsize -g
And used this way:
Usage: dirsize [path]
Options:
-h, --help display this help and exit
-v, --version output version information and exit
dirsize /tmp
Local
dirsize
could be used localy. It will emit event on every size change.
Install
npm i dirsize --save
How to use?
const dirsize = require('dirsize');
const cwd = process.cwd();
const from = cwd + '/pipe-io';
const abortOnError = false;
const size = dirsize(from);
size.on('size', (size, currentSize, filename) => {
process.stdout.write('\r' + size);
});
size.on('error', (error) => {
console.error(percent, ' -> ', name, ':', error.message);
if (abortOnError)
cp.abort();
});
size.on('end', () => {});
License
MIT