Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/egoist/tre
Create file tree.
https://github.com/egoist/tre
file-tree tree unix
Last synced: 21 days ago
JSON representation
Create file tree.
- Host: GitHub
- URL: https://github.com/egoist/tre
- Owner: egoist
- License: mit
- Created: 2017-07-23T15:26:51.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-12-25T14:42:36.000Z (almost 3 years ago)
- Last Synced: 2024-10-04T12:05:41.908Z (about 1 month ago)
- Topics: file-tree, tree, unix
- Language: JavaScript
- Homepage:
- Size: 58.6 KB
- Stars: 40
- Watchers: 3
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tre
[![NPM version](https://img.shields.io/npm/v/tre.svg?style=flat)](https://npmjs.com/package/tre) [![NPM downloads](https://img.shields.io/npm/dm/tre.svg?style=flat)](https://npmjs.com/package/tre) [![CircleCI](https://circleci.com/gh/egoist/tre/tree/master.svg?style=shield)](https://circleci.com/gh/egoist/tre/tree/master) [![donate](https://img.shields.io/badge/$-donate-ff69b4.svg?maxAge=2592000&style=flat)](https://github.com/egoist/donate)
To get an output like this:
## Install
```bash
npm i --save tre
```## Usage
```js
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](https://github.com/egoist), Released under the [MIT](./LICENSE) License.
Authored and maintained by egoist with help from contributors ([list](https://github.com/egoist/tre/contributors)).> [egoist.moe](https://egoist.moe) · GitHub [@egoist](https://github.com/egoist) · Twitter [@rem_rin_rin](https://twitter.com/rem_rin_rin)