parrier
v0.2.1-alpha
Published
This is a package that lists everything inside the provided "path" (or the full tree structure if "recurse" is set), asynchronously.
Downloads
43
Maintainers
Readme
Welcome to parrier
This is a package that lists everything inside the provided "path" (or the full tree structure if "recurse" is set), asynchronously.
Table of Contents
Prerequisites
- node: >=8.0.0
- npm: >=5.0.0
Install
npm install parrier
Usage
Async / await example
/**
* Async / await
*/
const parrier = require('parrier');
// import parrier from 'parrier'; // for typescript
const path = './example-folder/';
(() => {
try {
async () => {
const folderContent = await parrier(path);
console.log(folderContent); // logs an array of IFile
// IFile is a typescript interface (of this package)
// that represents the file object (including
// file.name, file.extension, file.isFile, etc...)
// refer to API to know more
};
} catch (err) {
console.log(err.message);
}
})();
Promise example
/**
* Promise
*/
const parrier = require('parrier');
// import parrier from 'parrier'; // for typescript
const path = './example-folder/';
parrier(path)
.then((folderContent) => console.log(folderContent))
.catch((err) => console.log(err.message));
Run tests
npm run test
Author
jruipinto
- GitHub: @jruipinto
- LinkedIn: https://pt.linkedin.com/in/j-rui-pinto
Contributing
Contributions, issues and feature requests are welcome!
Feel free to check issues page. You can also take a look at the contributing guide.
References
- Package name generated with Namelix
- Readme generated with @appnest/readme
Show your support
Give a ⭐️ if this project helped you!
License
Copyright © 2021 jruipinto.
This project is MIT licensed.