title: How do I use fs.writeFile in HTML (using node.JS)?
body: <p>So I've been searching for hours on this topic, and still have not found any real way to achieve what I'm trying to do here.</p>
  
  <p>Simply, I just want to write some text to a text file through the use of a button in HTML. This is what I have:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;TEST&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;button onclick="write_text()"&gt;WRITE FILE&lt;/button&gt;
  
  &lt;script&gt;
      function write_text(){
          var fs = require('fs');
  
          fs.writeFile("test.txt", "okay this is epic", function(err){
              if (err) return console.log(err);
              console.log("Nice");
          });
      };
  &lt;/script&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I'm unsure as to why this doesn't work, do I need to make a separate .js file for the function that the button references?</p>
  
  <p>Any help would be appreciated,
  Thanks.</p>
  
  <p>EDIT: I'm trying to save the file to my GoDaddy server so that I can access it later, not just download the file. Testing it locally, it should create a file in the directory of my html document.</p>