const fs = require('fs');
const path = require('path')
//Unlink方法异步删除文件,需要写回调函数
fs.unlink(path.join(__dirname,"./tmp/hello.txt"),(err)=>{
if(err){
console.log('error ocurred');
throw err;
}
console.log('successfully d-eleted /tmp/hello');
});
//同步删除文件不需要写回调函数但是需要用try-catch包起来,以免抛出异常
try{
fs.unlinkSync(path.join(__dirname,'./tmp/hello.txt'));
console.log(<