##Table of Contents:
- getDirs(path, cb)
- getDirsSync(path)
- isEmpty(path, cb)
- isEmptySync(path)
- remove(path, cb)
- removeSync(path)
Get all directories from a path
Example:
var fs = require('extfs');
fs.getDirs('/home/myFolder', function (err, dirs) {
if (err) {
throw err;
}
console.log(dirs); // Array of directories
});
(Synchronously) Get all directories from a path
Example:
var fs = require('extfs');
var dirs = fs.getDirsSync('/home/myFolder');
console.log(dirs); // Array of directories
Check if a file or directory is empty. A file is empty if not exists or not have any content. A directory is empty if not exists or not have any file inside.
Example:
var fs = require('extfs');
fs.isEmpty('/home/myFolder', function (empty) {
console.log(empty);
});
(Synchronously) Check if a file or directory is empty. A file is empty if not exists or not have any content. A directory is empty if not exists or not have any file inside.
Example:
var fs = require('extfs');
var empty = fs.isEmptySync('/home/myFolder');
console.log(empty);
Remove a path or array of paths. A path can be a file or directory. If a directory is not empty, also removes its content.
Example:
var fs = require('extfs');
fs.remove('/home/folder');
fs.remove([ '/home/folder1', '/hole/folder2', '/home/folder3' ]);
(Synchronously) Remove a path or array of paths. A path can be a file or directory. If a directory is not empty, also removes its content.
Example:
var fs = require('extfs');
fs.removeSync('/home/folder', function (err) {
console.log('Folder removed');
});
fs.remove([ '/home/folder1', '/hole/folder2', '/home/folder3' ], function (err) {
console.log('Folders removed');
});