checkFileExists.js 206 B

12345678910
  1. const fs = require('fs');
  2. const checkFileExists = (path) => {
  3. return fs.promises
  4. .access(path, fs.constants.F_OK)
  5. .then(() => true)
  6. .catch(() => false);
  7. };
  8. module.exports = checkFileExists;