Created
February 8, 2011 00:41
-
-
Save Marak/815609 to your computer and use it in GitHub Desktop.
An extremely simple implementation of base64 encoding / decoding using node.js Buffers
This file contains 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: An extremely simple implementation of base64 encoding / decoding using node.js Buffers | |
* | |
* (C) 2010, Nodejitsu Inc. | |
* | |
*/ | |
var base64 = exports; | |
base64.encode = function (unencoded) { | |
return new Buffer(unencoded || '').toString('base64'); | |
}; | |
base64.decode = function (encoded) { | |
return new Buffer(encoded || '', 'base64').toString('utf8'); | |
}; |
Haha, nice fork of my gist :0D
https://gist.github.com/718390
I'm pretty sure you wrote this one too? I just copy pasted from broodmother.
What's "exports" at line 8?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Word, I know I have base64.js files kicking around from before the Buffer object could this do. Maybe we'll do a quick blog post.