1.0.0 • Published 4 years ago

folder-info v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

folder-info

Get the directory structure under the specified path (获取指定路径下的目录结构)

Installation

npm install folder-info --save

Usage

const folder = require('folder-info')

/**
 * data
 *    |
 *    tool
 *       |
 *       ---find.js
 *       |
 *       ---do.js
 *    addr
 *       |
 *       ---east.js
 *       |
 *       ---west.js
 * 
*/

let struct = folder.getStructure('./data')

/*
[
  {
    "type": "directory",
    "name": "addr",
    "child": [
      {
        "type": "file",
        "name": "east.js",
        "sizeByte": 279982
      },
      {
        "type": "file",
        "name": "west.js",
        "sizeByte": 0
      }
    ]
  },
  {
    "type": "directory",
    "name": "tool",
    "child": [
      {
        "type": "file",
        "name": "do.js",
        "sizeByte": 0
      },
      {
        "type": "file",
        "name": "find.js",
        "sizeByte": 0
      }
    ]
  }
]
*/

let files = folder.getAllFile('./data')
/*
  [
    "data\\addr\\east.js",
    "data\\addr\\west.js",
    "data\\tool\\do.js",
    "data\\tool\\find.js"
  ] 
*/
1.0.0

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago