0.1.2 • Published 10 years ago
dir2array v0.1.2
dir2array
Get an array with all files in a directory (including files in subdirectories).
Install
You can install dir2array using NPM:
npm install dir2arrayUsage
dir2array is very easy to use. You only need to call the Scan method with your desired path, and you will get an array with all the content of your path (including files, subdirectories and files in subdirectories).
//Import dir2array
var dir2array = require('dir2array');
//Get an array with all the files and subdirectories
var mydir = dir2array.Scan('path/to/your/dir');Other useful methods
IsDir(path)
Returns true if path is a directory, false if others.
dir2array.IsDir('my/dir/'); //Returns true (if my/dir/ exists!)
dir2array.IsDir('dir/file.txt'); //Returns falseDirExists(path)
Returns true if paht exists and it is a directory.
dir2array.DirExists('dir/file.txt'); //Returns false because file.txt is not a directoryLicense
dir2array is under the MIT license.