# tre

> Create file tree.

Latest version **1.0.5** (published 2017-07-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install tre
pnpm add tre
yarn add tre
bun add tre
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2017-07-23 |
| First published | 2017-07-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 40 |
| Author | egoist |
| Maintainers | rem |
| Keywords | file, tree, unix, cmd, file-tree, map |

## Links

- npm: https://www.npmjs.com/package/tre
- Repository: https://github.com/egoist/tre
- Homepage: https://github.com/egoist/tre#readme
- Issues: https://github.com/egoist/tre/issues
- npm.io page: https://npm.io/package/tre

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 1.0.5 (latest) — 2017-07-23
- 1.0.4 — 2017-07-23
- 1.0.3 — 2017-07-23
- 1.0.2 — 2017-07-23
- 1.0.1 — 2017-07-23
- 1.0.0 — 2017-07-23

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

<img width="201" alt="2017-07-23 11 36 03" src="https://user-images.githubusercontent.com/8784712/28500720-bcb71424-6fff-11e7-8f7a-b696b3842024.png">


## 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`<br>
Default: `[]`

An array of File/Folder.

File: `{ type: 'file', name: 'file name' }`<br>
Folder: `{ type: 'folder', name: 'folder name' }`

#### opts

##### root

Type: `string`<br>
Default: `.`

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

##### dot

Type: `boolean`<br>
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.<br>
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)

---
_Source: https://npm.io/package/tre · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
