Skip to content

marian2js/npm-extfs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Extension for Node.js fs module

##Table of Contents:

getDirs(path, cb)

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
});

getDirsSync(path)

(Synchronously) Get all directories from a path

Example:

var fs = require('extfs');

var dirs = fs.getDirsSync('/home/myFolder');
console.log(dirs); // Array of directories

isEmpty(path, cb)

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);
});

isEmptySync(path)

(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(path, cb)

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' ]);

removeSync(path, cb)

(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');
});

About

Extension for Node.js fs module.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •