nmd
node-map-directory
npm i node-map-directory
nmd

node-map-directory

🌲 Asynchronously map directory structure into a JavaScript object

by Dorian Camilleri

0.1.0 (see all)License:MITTypeScript:Not Found
npm i node-map-directory
Readme

node-map-directory

Asyncronously map directory file structure into a JavaScript object

Install

NPM

Build Status

$ npm install node-map-directory

Usage

var mapDir = require('node-map-directory');
mapDir('./')
  .then(function(currentDirMap) {
    // some code
  });

/* You will get an array of file and directory objects

  Directory structure
  - currentDir
    - index.html
    - scripts
      - myScript.js

  Output:
  [
    {
      name: 'index',
      extension: '.html',
      type: 'file'
    },
    {
      name: 'scripts',
      type: 'dir',
      children: [
        {
          name: 'myScript',
          extension: '.js',
          type: 'file'
        }
      ]
    }
  ]
*/

API

mapDir(directory, toIgnore)

options

directory

Type: String
Default: ./

The root directory to get the map from.

toIgnore

Type: array
Default: ['node_modules', 'bower_components', '.ignored_file']

The directories and files to exclude from mapping.

License

MIT © Dorian Camilleri

Downloads/wk

11

GitHub Stars

13

LAST COMMIT

7yrs ago

MAINTAINERS

1

CONTRIBUTORS

2

OPEN ISSUES

1

OPEN PRs

0
VersionTagPublished
0.1.0
latest
7yrs ago
No alternatives found
No tutorials found
Add a tutorial
No dependencies found

Rate & Review

100
No reviews found
Be the first to rate