Created
December 5, 2020 16:43
-
-
Save martin-mok/7d7e3b69edda86d70e4500ff0a060257 to your computer and use it in GitHub Desktop.
buffer - base64 in nodejs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//base64 to buffer | |
const b64string = /* whatever */; | |
const buff = Buffer.from(b64string, 'base64'); | |
//buffer to base64 | |
let data = "Hello World"; | |
let buff = new Buffer(data); | |
let base64data = buff.toString('base64'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment