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

npm like directory tree structure creator based on the given root path

  • 4.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
253
decreased by-24.02%
Maintainers
1
Weekly downloads
 
Created
Source

dir-tree-creator

npm Build Status

Standard JavaScript

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

Install

npm i dir-tree-creator

Usage

dirtree(dir[, opts], cb)

  • dir <String> root directory path
  • opts <Object> (optional) object with the following properties:
    • label <String> label for the root node of the directory tree; if nothing specified, the root path's basename will be used.
    • hidden <Boolean> determines if hidden files should be included; set to false to ignore hidden files; defaults to true.
  • cb <Function>
    • err <Error | null>
    • dirtree <String> string representation of the directory structure

Example

const dirTree = require('dir-tree-creator')

dirTree('some/dir', (err, tr) => {
  if (err) return console.error(err)
  console.log(tr)
})
const dirTree = require('dir-tree-creator')

dirTree('some/dir', { label: 'custom label' }, (err, tr) => {
  if (err) return console.error(err)
  console.log(tr)
})

Sample output

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

Keywords

FAQs

Package last updated on 10 Dec 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