Eric Bergman-Terrell's Blog

Node.js Programming Tip: How to Encode and Decode Base64 Text
August 21, 2015

Encoding and decoding Base64 text, in Node.js, is as easy as:

function base64Encode(text) {
    return new Buffer(text).toString('base64');
}

function base64Decode(text) {
    return new Buffer(text, 'base64').toString('utf8');
}

This code is used by my new online Base64 decoder/encoder utility.

For more details about manipulating base 64 data in Node.js, see Hack Sparrow's post.

encoding
What messages are encoded here?

Keywords: Node.js, node, Express, Javascript, Base64, Base 64, Encode, Decode

Reader Comments

Comment on this Blog Post

Recent Posts

TitleDate
Java Programming Tip: SWT Photo Frame ProgramOctober 31, 2016
Vault 3 (Desktop) Version 1.63 ReleasedSeptember 9, 2016
"Compliance with Court Orders Act of 2016"April 9, 2016
Disable "Visual Voicemail" on Android / T-MobileJanuary 17, 2016
IPv6 HumorDecember 10, 2015
Java Programming Tip: Specify the JVM time zoneDecember 7, 2015
Node.js / Express Programming Tip: Detect and Fix Memory LeaksOctober 27, 2015