You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

util.js 296 B

2 years ago
123456789101112
  1. const fs = require('fs-extra');
  2. exports.isEmpty = (path) => {
  3. try {
  4. let stat = fs.statSync(path);
  5. if (!stat.isDirectory()) return true;
  6. let items = fs.readdirSync(path);
  7. return !items || !items.length;
  8. } catch (e) {
  9. return true;
  10. }
  11. }