dstruc
Quickly get directory structure and files from a specified path in node, with support for recursive operations.
Installation
$ npm install dstruc --save
Usage
var dstruc = ;var structure = dstruc;console; /* { files: [ 'level.one.file.txt' ], dirs: { another_level_two: { files: [Object], dirs: {} }, level_two: { files: [Object], dirs: {} } } }*/ var structureWithExtensions = dstruc;console;/*{ files: { txt: [ 'one.file.txt', 'two.file.txt' ] }, dirs: {} }*/
Options
recursive: Will traverse directories until it reaches the bottom. If set to false, directories of the top level will instead be put in an array.
extensionAsKey: Will put the files in an object with their extension as the key instead of an array.
Testing
$ npm test
Todo
- Add async version
License
BSD