On this page
Node.js에서 파일이 존재하는지 확인하는 방법
On this page
Goal
fs
모듈을 사용해 파일이 존재하는지 확인하는 방법 알아보기
fs.existsSync()
fs.existsSync()
메서드를 사용해서 파일이 존재하는지 확인할 수 있다.
const fs = require('fs')const filePath = './text.md'if (fs.existsSync(filePath)) {// 파일이 존재하는 경우 처리할 내용}
reference
LINKS TO THIS PAGE
Edit this page
Last updated on 8/13/2022