@fremango/dir-tree
Get a tree view of the directory structure.
Last updated a year ago by fremango .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @fremango/dir-tree 
SYNC missed versions from official npm registry.

dir-tree

Get a tree view of the directory structure.

screenshot

Install

yarn add global @fremango/dir-tree

#or
npm i -g @fremango/dir-tree

Usage

Cli

dir-tree <dir> [options]

Nodejs

const { dirTree, scanDir } = require("dir-tree");

const dir = scanDir({
  dir: "./"
});
console.log("dir for Object", JSON.stringfly(dir, null, 2));
const tree = dirTree({
  dir: "./"
});

console.log("Tree: ", tree);

Apis

scanDir

Scan the directory with the configured options, return directory struct object

scanDir(Options, callback)

return dirStruct

dirStruct

name type default desc
name string '' directory name
isDir boolean false is directory
path string '' directory absolute path
children dirStruct[] [] if isDir is true, children is this directory's children directory

callback

custom the structure of each item

(itemStruct) => itemStruct

name type desc
itemStruct dirStruct directory's struct object

dirTree

return a tree view of the directory structure.

dirTree(options)

Options

deep

desc: Scan the depth of the directory, if it is 0, scan all directories and their subdirectories

type: number

default: 0

use in cli: -d <number> or --deep <number>

ignore

desc: Ignored directory

type: string[]

default: undefined

use in cli: -i "<dir>,<dir>,..." or --ignore "<dir>,<dir>,..."

noChild

desc: Don't scan subdirectories of this directory

type: string[]

default: undefined

use in cli: -n "<dir>,<dir>,..." or --noChild "<dir>,<dir>,..."

color

desc: Output color text

type: Boolean

default: true

use in cli: --no-color disabled color text

Current Tags

  • 0.0.2                                ...           latest (a year ago)

2 Versions

  • 0.0.2                                ...           a year ago
  • 0.0.1                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 1
Last Day 0
Last Week 0
Last Month 6
Dependencies (2)
Dev Dependencies (0)
None
Dependents (1)

Copyright 2014 - 2016 © taobao.org |