title: How to embed a script in electron binary?
body: <p>I'm doing long-running computations in an electron app. I'm "forking" the node process using <a href="https://nodejs.org/api/child_process.html#child_process_child_process_fork_modulepath_args_options" rel="nofollow noreferrer">child_process.fork</a> to execute a script in a separate process not to block the renderer process. </p>
  
  <p>The app is working fine provided that the script I'm launching with <em>child_process.fork</em> is in the directory I'm launching it from. What I'd like to do instead is to ship the script inside the binary (I'm using <a href="https://github.com/electron-userland/electron-builder" rel="nofollow noreferrer">electron-builder</a> to build one).</p>
  
  <p>I've found out that the builder packs everything (including the script I'm interested in) into an <code>.asar</code> archive - can it be accessed by the binary at runtime?</p>
  
  <p><a href="https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options" rel="nofollow noreferrer">child_process.spawn</a> and using a language other than JS is an option too, but the problem persists - I don't know how to embed the script into the binary.</p>