chomens-bot-js/util/file-list.js
2022-08-14 16:51:45 +07:00

14 lines
314 B
JavaScript

const fs = require('fs/promises')
async function list (filepath = '.') {
const files = await fs.readdir(filepath)
const component = []
files.forEach((filename, index) => {
component.push(filename)
if (index !== files.length - 1) component.push(' ')
})
return component
}
module.exports = list