title: Executing Binary Code
body: <p>I'm designing a game and have a somewhat unique problem.    </p>
  
  <p>To play the game, players each write a simple javascript program that continually makes a request of my backend for the game state and then decides what to do and posts their move (also to my backend).</p>
  
  <p>I want to store the user scripts on my end though, so I've given them the option to upload their scripts with the standard HTML5 input type="file". Then I use FileReader to read in the raw binary, and associate that binary input as a "bot" for the user in Mongo. (My backend is written in Go)</p>
  
  <p>Docs for FileReader:<br>
  <a href="https://developer.mozilla.org/en-US/docs/Web/API/FileReader" rel="nofollow noreferrer">https://developer.mozilla.org/en-US/docs/Web/API/FileReader</a></p>
  
  <p>So far, I've found a resource for converting the binary back to ascii:<br>
  <a href="https://stackoverflow.com/questions/21354235/converting-binary-to-text-using-javascript">Converting Binary to text using javascript</a>   </p>
  
  <p>I found a javascript interpreter that I can <em>allegedly</em> execute javascript from:
  <a href="https://github.com/jterrace/js.js" rel="nofollow noreferrer">https://github.com/jterrace/js.js</a>   </p>
  
  <p>In this situation, is there a better way to run the uploaded code, perhaps as an executable? Is a javascript sandbox solution like JSJS overkill?</p>