https://github.com/danielstjules/dirmap
Accepts a dir path and returns an object mapping file names to their full path
https://github.com/danielstjules/dirmap
directory nodejs
Last synced: about 1 month ago
JSON representation
Accepts a dir path and returns an object mapping file names to their full path
- Host: GitHub
- URL: https://github.com/danielstjules/dirmap
- Owner: danielstjules
- License: mit
- Created: 2017-02-11T03:43:14.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-02-11T04:04:45.000Z (over 9 years ago)
- Last Synced: 2026-06-04T23:25:06.113Z (about 2 months ago)
- Topics: directory, nodejs
- Language: JavaScript
- Size: 3.91 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# dirmap
``` javascript
/**
* Accepts a dir path and returns an object mapping file names to their full
* path. If dropExtension is true, the file extension is dropped from the
* object keys. Does not recurse into directories.
*
* @param {string} dir
* @param {boolean} dropExtension
* @returns {object}
*/
```
## Installation
```
npm install dirmap
```
## Example
``` javascript
var dirmap = require('dirmap');
dirmap('.', true);
// { '.git': '/Users/danielstjules/dirmap/.git',
// '.gitignore': '/Users/danielstjules/dirmap/.gitignore',
// LICENSE: '/Users/danielstjules/dirmap/LICENSE',
// README: '/Users/danielstjules/dirmap/README.md',
// index: '/Users/danielstjules/dirmap/index.js',
// package: '/Users/danielstjules/dirmap/package.json' }
```