Skip to content

Instantly share code, notes, and snippets.

@faceless2
Created August 18, 2025 10:02
Show Gist options
  • Save faceless2/ee30d76e223bdc2de51e8c54d7d9a4b9 to your computer and use it in GitHub Desktop.
Save faceless2/ee30d76e223bdc2de51e8c54d7d9a4b9 to your computer and use it in GitHub Desktop.
Base64 encode buffers when they are serialized in JSON
It's a simple one-liner - add this to your code, just be aware it impacts ALL buffers
Buffer.prototype.toJSON = function() { return this.toString("base64"); }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment