Skip to content

Instantly share code, notes, and snippets.

@imesut
Created April 11, 2025 14:15
Show Gist options
  • Select an option

  • Save imesut/b413b6fb802bcf3cca0dcc297a1d24a6 to your computer and use it in GitHub Desktop.

Select an option

Save imesut/b413b6fb802bcf3cca0dcc297a1d24a6 to your computer and use it in GitHub Desktop.
Base64 to File convert with Node
// import * as fs from 'fs';
const fs = require('fs');
const merged = fs.readFileSync("pdf.b64", "utf-8");
const decoded = Buffer.from(merged, "base64");
console.log("original: " + merged.length);
console.log("decoded: " + decoded.length);
fs.writeFileSync("pdf.pdf", decoded);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment