# directory-structur

> Get directory structur

Latest version **1.0.1** (published 2020-08-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install directory-structur
pnpm add directory-structur
yarn add directory-structur
bun add directory-structur
```

Provides the commands `dir-tree`, `directory-structur`.

## 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.1 |
| Published | 2020-08-12 |
| First published | 2020-08-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 6.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | indaam |
| Maintainers | indaam |
| Keywords | directory, tree, structur, folder |

## Links

- npm: https://www.npmjs.com/package/directory-structur
- npm.io page: https://npm.io/package/directory-structur

## Dependencies (1)

- [node-argv-to-object](https://npm.io/package/node-argv-to-object.md) ^1.0.0

## Recent versions

- 1.0.1 (latest) — 2020-08-12
- 1.0.0 — 2020-08-12

## README

# directory-structur

Get directory structur

## Install

`$ npm install -g directory-structur`

## Usage CLI

On terminal, type

- `$ dir-tree` or
- `$ directory-structur`

## Options

| Property | Type                    | Description                 |
| -------- | ----------------------- | --------------------------- |
| ignore   | Array<string> or string | Ignore it when find         |
| maxDept  | number                  | Limit max dept on directory |
| print    | `json | tree`           | Select output type          |
| path     | string                  | Only support on cli         |

## More CLI Example

- `$ dir-tree maxDept=10`
- `$ dir-tree ignore=[\"node-modules\",\"json\"]`
- `$ dir-tree print=json`
- `$ dir-tree path=../`

## Javascript API

`$ npm install directory-structur` or `$ yarn add directory-structur`

```javascript
const dir = require('directory-structur'); // or
// import dir from 'directory-structur';

const options = {
  ignore: ['node-modules'],
  //... other options
};
const res = dir('./', options);
console.log(res);
```

## Output example tree

```
My Directory
├--.editorconfig
├--.gitignore
├--.npmignore
├--.prettierrc.js
├--.vscode
|  ├--extensions.json
|  ├--settings.json
├--README.md
├--cli.js
├--func.js
├--index.js
├--node_modules
|  ├--.yarn-integrity
|  ├--node-argv-to-object
|  |  ├--README.md
|  |  ├--index.js
|  |  ├--package.json
|  |  ├--sample.js
├--package.json
├--yarn.lock
```

## Output example json

```
{
	path: './',
	name: 'My Directory',
	depth: 0,
	parent: 1,
	type: 'directory',
	children: [{
			path: '.editorconfig',
			name: '.editorconfig',
			depth: 0,
			parent: 0,
			type: 'file',
			extension: '.editorconfig'
		},
		{
			path: '.gitignore',
			name: '.gitignore',
			depth: 0,
			parent: 0,
			type: 'file',
			extension: '.gitignore'
		},
		{
			path: '.npmignore',
			name: '.npmignore',
			depth: 0,
			parent: 0,
			type: 'file',
			extension: '.npmignore'
		},
		{
			path: '.prettierrc.js',
			name: '.prettierrc.js',
			depth: 0,
			parent: 0,
			type: 'file',
			extension: '.js'
		},
		{
			path: '.vscode',
			name: '.vscode',
			depth: 0,
			parent: 0,
			type: 'directory',
			children: [Array]
		},
		{
			path: 'README.md',
			name: 'README.md',
			depth: 0,
			parent: 0,
			type: 'file',
			extension: '.md'
		},
		{
			path: 'cli.js',
			name: 'cli.js',
			depth: 0,
			parent: 0,
			type: 'file',
			extension: '.js'
		},
		{
			path: 'func.js',
			name: 'func.js',
			depth: 0,
			parent: 0,
			type: 'file',
			extension: '.js'
		},
		{
			path: 'index.js',
			name: 'index.js',
			depth: 0,
			parent: 0,
			type: 'file',
			extension: '.js'
		},
		{
			path: 'node_modules',
			name: 'node_modules',
			depth: 0,
			parent: 0,
			type: 'directory',
			children: [Array]
		},
		{
			path: 'package.json',
			name: 'package.json',
			depth: 0,
			parent: 0,
			type: 'file',
			extension: '.json'
		},
		{
			path: 'yarn.lock',
			name: 'yarn.lock',
			depth: 0,
			parent: 0,
			type: 'file',
			extension: '.lock'
		}
	]
}
```

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