title: How can I create File Instance on nodejs
body: <p>I need a File instance on Nodejs. I have the file path but my main function accepts  File instance. How can I get a File instance from file path?</p>
  <pre class="lang-js prettyprint-override"><code>// I need a function like that, but it throws an error like `File is not defined`
  
  const fs = require('fs');
  const path = require('path');
  
  /**
   * @param {string} filepath
   * @returns {File} 
   */
  function getFileFromPath(filepath) {
    const buffer = fs.readFileSync(filepath);
    return new File(buffer, path.basename(filepath));
  }
  
  
  
  </code></pre>