chomens-bot-js/util/file-list.js
2022-11-16 09:33:16 +07:00

18 lines
363 B
JavaScript

const fs = require('fs/promises');
/**
* just list the files
* @param {String} filepath file path
* @return {Array} component.
*/
async function list(filepath = '.') {
const files = await fs.readdir(filepath);
const component = [];
files.forEach((filename, index) => {
component.push(filename);
});
return component;
}
module.exports = list;