1
0
Fork 0
mirror of https://github.com/ChomeNS/chomens-bot-mc.git synced 2025-07-24 12:48:53 -04:00
chomens-bot-js/util/file-list.js

19 lines
351 B
JavaScript
Raw Permalink Normal View History

2022-11-27 14:35:28 +07:00
const fs = require('fs/promises')
2022-08-14 16:51:45 +07:00
2022-11-16 09:33:16 +07:00
/**
* just list the files
* @param {String} filepath file path
* @return {Array} component.
*/
2022-11-27 14:35:28 +07:00
async function list (filepath = '.') {
const files = await fs.readdir(filepath)
2022-08-14 16:51:45 +07:00
2022-11-27 14:35:28 +07:00
const component = []
for (const filename of files) {
2022-11-27 14:35:28 +07:00
component.push(filename)
}
2022-11-27 14:35:28 +07:00
return component
2022-08-14 16:51:45 +07:00
}
2022-11-27 14:35:28 +07:00
module.exports = list