system_assignation/node_modules/get-folder-size/example.js

16 lines
329 B
JavaScript
Raw Normal View History

2022-03-24 09:22:39 -04:00
'use strict';
const path = require('path');
const getSize = require('./');
if (!process.env.FOLDER) {
throw new Error('FOLDER env var needed');
}
getSize(path.resolve(process.env.FOLDER), (err, size) => {
if (err) { throw err; }
console.log(size + ' bytes');
console.log((size / 1024 / 1024).toFixed(2) + ' Mb');
});