title: Electron - How to save base64 dataUrl to file
body: <p>I'm working with an existing Electron project (convert web app to desktop app), which has a task that is to export content on screen to pdf/png/jpg.</p>
  
  <p>Here is the situation:</p>
  
  <ol>
  <li>The desktop app is purely client-side code, it doesn't connect to any API or server (just in case you suggest a solution using Nodejs server-side code)</li>
  <li>I got the dataUrl from canvas object already (it's a base64 string of the file)</li>
  </ol>
  
  <p>How can I save that dataUrl into a file (pdf/png/jpg)?</p>
  
  <p>Here are some ways that I tried:</p>
  
  <ol>
  <li>The good old window.location = dataUrl (nothing happens)</li>
  <li>Create a form inside the div, action = dataUrl, then submit the form</li>
  </ol>
  
  <p>Both ways are not working!</p>
  
  <p>Thank you very much</p>