i want to remove all of the things of my folder metadata my attempt is this
const folderPath = './metadata/'
await fs.promises.readdir(folderPath)
.then((f) => Promise.all(f.map(e => fs.promises.unlink(`${folderPath}${e}`))))
but i am getting this error:
(node:7329) UnhandledPromiseRejectionWarning: Error: EPERM: operation not permitted, unlink './metadata/LP'
BTW: LP is a directory
Error: EPERM: operation not permitted, unlink './metadata/LP'
Maybe ./metadata/LP is a directory. Unlink can delete only files.
Try to use fs.rmdir() or del NPM.