title: Uncaught TypeError: file.open is not a function
body: <p>I'm simply trying to write open a .txt file using Javascript and write code inside this .txt file by means of a user pressing a button in an HTML aframe application.</p>
  
  <p>Unfortunately, I've run into the following error: </p>
  
  <pre><code>Uncaught TypeError: file.open is not a function
  </code></pre>
  
  <p>This is my current code: </p>
  
  <pre><code>&lt;script&gt;
  /// write to file
  var txtFile = "skycolour.txt";
  var file = new File([""], txtFile);
  var str = "My string of text";
  
  file.open("w"); // open file with write access
  file.writeln("First line of text");
  file.writeln("Second line of text " + str);
  file.write(str);
  file.close();
  &lt;/script&gt;"
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/wv1HT.jpg" rel="nofollow noreferrer">Image of error encountered</a></p>