Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

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:

2017-07-23 11 36 03

## 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)