Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dir-tree-creator

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dir-tree-creator

simple directory tree structure creator based on the given root path

  • 2.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
304
increased by19.69%
Maintainers
1
Weekly downloads
 
Created
Source

#dir-tree-creator

npm

dir-tree-creator is a tiny module that creates an npm like directory tree structure of the given path and returns the string representation of it.

####Install

Please use npm install dir-tree-creator.

####API

dirtree(options, cb)

  • options {Object}

  • root {String} root path

  • label {String} (optional) label for the root node of the directory tree; if nothing specified, then the root path's basename will be used.

  • ignore {Array} (optional) an array of node-glob patterns to ignore. By default, node_modules and .git are ignored.

  • cb {Function}

  • err {Error | null}

  • dirtree {String} String representation of the directory structure

const dir_tree = require('dir-tree-creator');

var opts = {
  root: __dirname,
  label: 'your custom label',
  ignore: ['foo.js', 'test/**'] // ignore foo.js and test dir
};

dir_tree(opts, (er, tr) => {
  if (er) {
    console.error(er);
  } else {
    console.log(tr);
  }
});

#####Sample output

your custom label
├─┬ dir0
│ └── file0.js  
├─┬ dir1
│ ├─┬ dir2  
│ │ └── file2.js  
│ └── file1.md 
├── file-under-root.js
└── .gitignore  

Keywords

FAQs

Package last updated on 17 Jan 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc