Work with files / Basic operations

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

let filePath = "file.txt";

//Asynchronously:
fs.access(filePath, fs.constants.F_OK, (err) => {
    if (!err) {
        console.log("File exist!");
    }
});

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