Skip to content

egoist/tre

Repository files navigation

tre

NPM version NPM downloads CircleCI donate

To get an output like this:

2017-07-23 11 36 03

Install

npm i --save tre

Usage

const tre = require('tre')

tre([
  { 
    type: 'file', name: 'index.js' 
  },
  { 
    type: 'folder', name: 'lib', children: [
      { type: 'file', name: 'utils.js' }
    ] 
  }
])
//=> ⇣⇣⇣
.
├── index.js
└── lib 
    └── utils.js

API

tre(files, [opts])

files

Type: Array
Default: []

An array of File/Folder.

File: { type: 'file', name: 'file name' }
Folder: { type: 'folder', name: 'folder name' }

opts

root

Type: string
Default: .

The root folder name which will be shown at the top the generated file tree.

dot

Type: boolean
Default: undefined

Whether to include dot files. Excluded by default.

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Author

tre © egoist, Released under the MIT License.
Authored and maintained by egoist with help from contributors (list).

egoist.moe · GitHub @egoist · Twitter @rem_rin_rin