1.0.8 • Published 8 years ago
files-tree v1.0.8
files-tree
For recursive query folder under all documents and file information
Installation:
npm install files-tree --saveUsage:
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
pathstring, by default './'optionsobject,specific filter and settingoptions.suffixstring,defining a specific file suffixoptions.ignorestring,file name or folder name ,ignore specific file or folderoptions.md5boolean,return the md5 value of the file
tree(path,options)
In accordance with the tree structure of all directories and subdirectories in the file
pathstring, by default './'optionsobject,specific filter and settingoptions.suffixstring,defining a specific file suffixoptions.ignorestring,file name or folder name ,ignore specific file or folderoptions.md5boolean,return the md5 value of the file
allFile(path,options)
Export files in all directories and subdirectories
pathstring, by default './'optionsobject,specific filter and settingoptions.suffixstring,defining a specific file suffixoptions.ignorestring,file name or folder name ,ignore specific file or folderoptions.md5boolean,return the md5 value of the file