files-tree
v1.0.8
Published
For recursive query folder under all documents and file information
Downloads
271
Maintainers
Readme
files-tree
For recursive query folder under all documents and file information
Installation:
npm install files-tree --save
Usage:
var util = require('files-tree'),
path = './',
tree = util.tree(path); //recursion
console.log(tree);
/**output**/
[
{
"path": "./index.js",
"name": "index.js",
"size": 3051,
"directory": false, // Is directory
"file": true // Is file
},
{
"path": "./package.json",
"name": "package.json",
"size": 662,
"directory": false,
"file": true
},
{
"path": "./test",
"name": "test",
"size": 0,
"directory": true,
"file": false,
"list": [ // All files in the folder
{
"path": "./test/index.js",
"name": "index.js",
"size": 261,
"directory": false,
"file": true
}
]
}
]
API:
list(path,[options])
Export files in current folder
path
string, by default './'options
object,specific filter and settingoptions.suffix
string,defining a specific file suffixoptions.ignore
string,file name or folder name ,ignore specific file or folderoptions.md5
boolean,return the md5 value of the file
tree(path,[options])
In accordance with the tree structure of all directories and subdirectories in the file
path
string, by default './'options
object,specific filter and settingoptions.suffix
string,defining a specific file suffixoptions.ignore
string,file name or folder name ,ignore specific file or folderoptions.md5
boolean,return the md5 value of the file
allFile(path,[options])
Export files in all directories and subdirectories
path
string, by default './'options
object,specific filter and settingoptions.suffix
string,defining a specific file suffixoptions.ignore
string,file name or folder name ,ignore specific file or folderoptions.md5
boolean,return the md5 value of the file