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 = []
|
2023-01-23 19:19:49 +07:00
|
|
|
for (const filename of files) {
|
2022-11-27 14:35:28 +07:00
|
|
|
component.push(filename)
|
2023-01-23 19:19:49 +07:00
|
|
|
}
|
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
|