title: Load file into IMAGE object using Phantom.js
body: <p>I'm trying to load image and put its data into HTML <code>Image</code> element but without success.</p>
  
  <pre><code>var fs = require("fs");
  var content = fs.read('logo.png');
  </code></pre>
  
  <p>After reading content of the file I have to convert it somehow to Image or just print it to canvas. I was trying to conver binary data to Base64 Data URL with the code I've found on Stack.</p>
  
  <pre><code>function base64encode(binary) {
    return btoa(unescape(encodeURIComponent(binary)));
  }
  var base64Data = 'data:image/png;base64,' +base64encode(content);
  console.log(base64Data);
  </code></pre>
  
  <p>Returned Base64 is not valid Data URL. I was trying few more approaches but without success. Do you know the best (shortest) way to achieve that?</p>