directory-tree-promise
Install
npm install directory-tree-promise
Usage
Use async await while traversing a directory tree.
const directoryTree = const tree = await
Output of tree
:
You can also pass an async function as a second parameter to modify the object returned for files
const directoryTree = const tree = await
Object Property Reference
Items are returned with the following properties:
- path (path to item)
- name (name of file including extension)
- extension (extension of object if isFile())
- size (file or folder size in bytes)
- children (array of items)
API Reference
isFile() -> bool
Each object in the tree is extended with a function isFile
const directoryTree = const tree = await treechildren0 // true or false
Note
Device, FIFO and socket files are ignored.
Contributing
Fork this repository and run npm install
in project directory.
Tests
npm run test