title: Why do I get error `TypeError: fs.readdir is not a function` in Cypress
body: <p>I wrote this code and it works fine that is written in TypeScript. When I use the same code in the test file in cypress I get error <code>TypeError: fs.readdir is not a function</code></p>
  
  <pre><code>import * as fs from 'fs'
  
  let inputPath: String = "C:\\Users\\rkon";
  let replacementString = "/";
  let newInputPath = inputPath.split('\\').join(replacementString)
  console.log('path after replacement: ' + newInputPath);
  
  fs.readdir(newInputPath as string, function (err: any, files: any[]) {
      //handling error
      if (err) {
          return console.log('Unable to scan directory: ' + err);
      }
      //listing all files using forEach
      files.forEach(function (file) {
          console.log('file: ' + file);
      });
  });
  </code></pre>
  
  <p>I verified the above code by first doing:</p>
  
  <pre><code>&gt;tsc temp.ts
  &gt;node temp.js
  </code></pre>
  
  <p>As I said it worked fine but why does the same code not work in Cypress giving the following error:</p>
  
  <blockquote>
    <p>TypeError: fs.readdir is not a function</p>
  </blockquote>