title: How do i pass javascript variables to electron and manipulate it
body: <p>Hi i'm very new to <code>electron</code> please bear with me.</p>
  
  <p><strong>i have a situation like this:</strong></p>
  
  <ol>
  <li><p>i will get filename from <code>li</code></p></li>
  <li><p>once the <code>filename</code> got i want to write it with below code</p>
  
  <pre><code>var fs = require('fs');
  fs.writeFile('gotfromjsvariable', 'Hello content!', function (err) 
  </code></pre>
  
  <p>{
          if (err) throw err;
            console.log('Saved!');
        });</p></li>
  </ol>
  
  <p>suppose <code>gotfromjsvariable</code> is coming from below code</p>
  
  <p>question is, How do i pass it to electron main.js or same file node.js</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$(document).on('click','#files li',function(){
     var gotfromjsvariable = $(this).data('filename');
     // gotfromjsvariable has to be sent a filename to nodejs or electron
     
     /*
    
   var fs = require('fs');
  fs.writeFile('gotfromjsvariable', 'Hello content!', function (err) {
              if (err) throw err;
                console.log('Saved!');
    });
     
     */
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;ul id="files"&gt;
    &lt;li data-filename="abc.json"&gt;abc.json&lt;/li&gt;
    &lt;li data-filename="pqr.json"&gt;pqr.json&lt;/li&gt;
  &lt;/ul&gt;</code></pre>
  </div>
  </div>
  </p>