delete with unlinksync node
snippet in javascript

delete with unlinksync node

user3525

const fs = require('fs')

const path = './file.txt'

try {
  fs.unlinkSync(path)
  //file removed
} catch(err) {
  console.error(err)
}