Answer the question
In order to leave comments, you need to log in
What is the correct way to use readdirSync?
There is the following code:
app.get("/data", (req, res) => {
const files = fs.readdirSync(path.join(__dirname, "uploads"))
const array = []
files.forEach(file => {
array.push(file.fileName)
})
res.send(JSON.stringify({"arr": array}))
})
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question