title: Convert from Base64 String to PNG File
body: <p>I am trying to convert a base64 encoded string to an image object using the method below.</p>
  
  <pre><code>function gotFileWriter(writer) {
      console.log('Starting gotFileWriter');
      writer.onwrite = function (evt) {
          console.log("write success");
      };
  
      $.mobile.showPageLoadingMsg();
      //        console.log('height: ' + cb_canvas.height);
      //        console.log('width: ' + cb_canvas.width);
      Signaturebase64 = cb_canvas.toDataURL();
  
      //I need to save the base64 string to a PNG image on the Phone here.  
      writer.write(Signaturebase64 );
  
      $.mobile.hidePageLoadingMsg();
      $.mobile.changePage("#MyJob");
      console.log('Finished gotFileWriter');
  }
  </code></pre>
  
  <p>The line:</p>
  
  <pre><code>Signaturebase64 = cb_canvas.toDataURL();
  </code></pre>
  
  <p>Works as expected and gives me back my base64 string. </p>
  
  <p>What I would like to do now is to convert it to an image file on the phone's persistent storage. </p>
  
  <p>The following line is writing the base64 string to the storage but what I want it to do is save it as a PNG file instead:</p>
  
  <pre><code>writer.write(filedata);
  </code></pre>