Answers for "how to remove file with the help of fs in node js"

7

nodejs fs delete file

const fs = require('fs')

const path = './file.txt'

try {
  fs.unlinkSync(path)
  //file removed
} catch(err) {
  console.error(err)
}
Posted by: Guest on February-10-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language