title: Is it possible base64 png converted into array buffer and write in a pdf format
body: <p>i have a random data like pdf, png, jpg and excel and got its Base64 formated string representation and i want to write these files in pdf format.</p>
  
  <p>actually  i am using this node module "base64-arraybuffer" for converting into arraybuffer and then i write into pdf format but i works for only base64 pdf string </p>
  
  <p>is there anyway to convert these files into pdf format</p>
  
  <pre><code>const base64 = require("base64-arraybuffer")
  var fs = require("fs")
  var path = require("path")
  var Buffer = require('buffer').Buffer;
  fs.readFile(path.join(__dirname, "./png_base64.txt"), "utf8", (fileError, data) =&gt;
  {
      const arrayData = base64.decode(data)
  
      function createPDFFile(orderId, arrData) {
          fs.writeFile(path.join(__dirname,`./${orderId}.png`), Buffer.from(arrData) , function (err) {
              if (err) {
                  console.log(err);
              } else {
                  console.log("The file was saved!");
              }
          }); 
      }
  
      createPDFFile("base64pdf", arrayData)
  })
  
  </code></pre>
  
  <p>Error
  Failed to load PDF document</p>