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