UNPKG

pretty-file-tree

Version:

Given a list of file paths, outputs a pretty-printed file tree

25 lines (22 loc) 609 B
# pretty-file-tree [![Build Status](https://travis-ci.org/codysmithd/pretty-file-tree.svg?branch=main)](https://travis-ci.org/codysmithd/pretty-file-tree) A tiny, simple utility for pretty-printing lists of file paths as a tree for command-line-interfaces. ## Example ```javascript const prettyTree = require('pretty-file-tree'); console.log(prettyTree([ 'home/user/foo.js', 'home/user/test/bar.js', 'home/user/test/baz.js', 'home/user/bat.js' ])); ``` Result ``` home/user ├── foo.js ├── test | ├── bar.js | └── baz.js └── bat.js ```