scandir-async
- Iterates trough a directory and returns a js object tree
- Result can be directories/files sorted first
Install
npm install scandir-async
Usage
var scandir = exec = exec;scandir;// or exposed;
Tree Object
isdir: true name: dirname fullpath: /abs/path/to/dirname stats: dev: 310691535 ino: 2814749767439347 uid: 0 gid: 0 rdev: 0 size: 0 mode: 16822 nlink: 1 blocks: false blksize: false atime: 1436683130000 mtime: 1436683130000 ctime: 1436683130000 birthtime: 1436683129000 files: isdir: false files: false name: dirname stats: object fullpath: /abs/path/to/dirname isdir: true files: ... name: dirname stats: object fullpath: /abs/path/to/dirname ...
Options
Folder
- absolute path
Options Object
Currently implemented
sorted: false // Default not sorted sorted: true // 'ASC' sorted: 'ASC' sorted: 'DESC'
Not implemented yet
depth: 0 filters: '**/*.hml'
Issues
Tests
Git add/clone does not take care of empty folder used for tests, it must be created manually Or launch test using npm test
mkdir spec/expected/explore_method/subnofilesmkdir spec/expected/files_method/nofilemkdir spec/expected/files_method/threefile/subfolder
History
- v0.1.15: Sorted fix name lowercase
- v0.1.12: Sorted options added
- v0.1.11: Files prop for directory is an array
- v0.1.10: Changes on tree object