The existsSync method of the fs module is used to check if a file or directory exists in the file system.
fs.existsSync(path)
See index.js file for the code
temp.js. This file can be viewed in the left side panel of the code widget.checkIfFileExists. This method uses the existsSync method to check if the file present in the provided path.path variable with the file path, ./temp.js, as a value.checkIfFileExists method with the path variable as an argument. This returns true../te.js, to the path variable.checkIfFileExists method with the path variable as an argument. This returns false.