title: Why do i get existsSync not a function error? node.js
body: <p>Why am I getting fs.existSync is not a function error? This is a unique and specific question.</p>
  <p>Code:</p>
  <pre><code>(async () =&gt; {
   var inputfile = &quot;c:/computer/image.png&quot;
   var timeouttimeinms = 2000;
  
   function checkExistsWithTimeout(filePath, timeout) {
          return new Promise(function (resolve, reject) {
              
              //filePath = fileindex
              
              //say image waitign for
              console.log(filePath);
              
              var timer = setTimeout(function () {
                  watcher.close();//'Waiting for Completed Image download.'
                  reject(new Error(&quot;Waiting for image to fully download.&quot;));
              }, timeout);
              
              ;
              fs.access(filePath, fs.constants.R_OK, function (err) {
                  if (!err) {
                      clearTimeout(timer);
                      watcher.close();
                      resolve();
                  }
              });
              
              var dir = path.dirname(filePath);
              var basename = path.basename(filePath)
              //check if file still exists before watching for changes
              if(fs.existSync(filePath)){
                  var watcher = fs.watch(dir, function (eventType, filename) {
                      if (eventType === 'rename' &amp;&amp; filename === basename) {
                          clearTimeout(timer);
                          watcher.close();
                          //resolve('Image Downloaded Sucessfully.');
                          resolve();
                      }
                  });
              
              }
              
          });
      }
  
      checkExistsWithTimeout(inputfile ,timeouttimeinms );
  })();
  </code></pre>
  <p>error:</p>
  <blockquote>
  <p>(node:7492) UnhandledPromiseRejectionWarning: TypeError: fs.existSync
  is not a function</p>
  </blockquote>