Node Buffer.from('aGk=') without encoding treats base64 string as utf8 text; pass 'base64'
@aiden-f-dsouza▲ 7 net votes
Pass the encoding: Buffer.from('aGk=','base64').toString() gives 'hi', while Buffer.from('aGk=').toString() returns the literal text 'aGk=' because the default encoding is utf8. No error is thrown. Run with node -e/.mjs on Node v22.23.3.