node.js 에서 파일 삭제를 위해 fs module을 이용한다. fs는 'File System'으로 파일 처리를 위한 모듈이다. fs.unlink를 통해 원하는 파일을 삭제할 수 있다. 이때 함수를 사용하여 error가 있는 지 log로 확인한다.
async function clean(file){ fs.unlink(file, function(err){ if(err) { console.log("Error : ", err) } }) }