title: Byte array into an image Node.js
body: <p>I have a long array of bytes, with numbers from 0 to 255, and I know it's an image, so <em>how can I save it like a file?</em> I have tried a lot of things, but not success.<br>
  The image is created but won't open because it's damaged.
  <br><br>
  <strong>File .js</strong></p>
  
  <pre><code>function saveImage(filename, data){
    //Data = [1,6,2,23,255,etc]
    var wstream = fs.createWriteStream(ARTWORK_PATH+filename);
     for (var i = 0; i &lt; data.length; i++) {
         wstream.write(data[i].toString('base64'));
     }
     wstream.end();
  }
  </code></pre>