Работа с файлами / Базовые операции

//using Node.js
//npm i @types/node
const fs = require("fs")

let filePath = "file.txt"

//Asynchronously:
fs.exists(filePath, (exists: boolean) => { 
    if (exists) { 
        console.log("File exist!")
    } 
})

//Synchronously:
if (fs.existsSync(filePath)) { 
    console.log("File exist!")