Last active
August 21, 2017 09:47
-
-
Save posquit0/8188c52d0ba03ad4419278a936163134 to your computer and use it in GitHub Desktop.
Node.js base64
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.js | |
*/ | |
const base64 = { | |
encode: (plain) => { | |
return Buffer.from(plain || '').toString('base64'); | |
}, | |
decode: (encoded) => { | |
return Buffer.from(encoded || '', 'base64').toString('ascii'); | |
} | |
}; | |
module.exports = base64 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment