folder2some
folder2some is a simple util to convert folder into some structures(like JSON,Tree,Info).
Installation
npm install folder2some
Usage
import foder2some
let FT = require('folder2some'),
dir = 'F://web//javascript';
let ft = new FT(dir,{
ignoreFolder: ['node_modules'],
getFile: true
})
console.log(ft.toTree())
console.log(ft.toJSON())
console.log(ft.toAnalysis())
Output maybe like :
├─clone
│ └─cloner.js
├─es6
│ └─es6.js
├─filestype
│ ├─test.js
│ └─ft.js
├─gallery
│ ├─utils.js
│ ├─gallery.styl
│ └─gallery.js
├─zepto
│ ├─test
│ │ ├─test2
│ │ │ └─2.html
│ │ └─1.html
│ ├─test2
│ └─zepto.js
├─text.html
└─1.html
[
"1.html",
{
"clone": [
"cloner.js"
]
},
{
"es6": [
"es6.js"
]
},
{
"filestype": [
"ft.js",
"test.js"
]
},
{
"gallery": [
"gallery.js",
"gallery.styl",
"utils.js"
]
},
"text.html",
{
"zepto": [
{
"test": [
"1.html",
{
"test2": [
"2.html"
]
}
]
},
{
"test2": []
},
"zepto.js"
]
}
]
{
"path": "F://web//javascript",
"totalSize": "85.56KB",
"totalCount": 12,
"extPercent": [
{
"ext": ".html",
"percent": "0.00",
"count": 4
},
{
"ext": ".js",
"percent": "99.04",
"count": 7
},
{
"ext": ".styl",
"percent": "0.96",
"count": 1
}
]
}
Options
ignoreFolder : Array
: the directory be ignored.
getFile : boolean
it will generate an output file.
About me
Perhaps more configuration can be extended. :)
github: https://github.com/Lemonreds
e-mail: lemonreds@163.com