The problem with this is that “binary” appears to be deprecated and slated for removal:
http://nodejs.org/api/buffer.html 'binary' - A way of encoding raw binary data into strings by using only the first 8 bits of each character. This encoding method is deprecated and should be avoided in favor of Buffer objects where possible. This encoding will be removed in future versions of Node. This is what I’ve ended up doing, but it seems like there ought to be an easier way? + global.atob = function(text) { + var buf = new Buffer(text, "base64"); + var bytes = []; + for ( var i = buf.length; i >= 0; i-- ) { + bytes[i] = String.fromCharCode(buf[i]); + } + + return bytes.join(""); + }; -FG Quoth Isaac Schlueter on 10/13/2012 7:33 PM... > Ha, it looks like the atob module just does exactly that :) > > > On Sat, Oct 13, 2012 at 5:31 PM, Rick Waldron <[email protected]> wrote: >> >> >> On Saturday, October 13, 2012 at 6:20 PM, Isaac Schlueter wrote: >> >> Or: >> >> new Buffer(b64string, 'base64').toString('binary') >> >> >> Quality of Life Index +1 >> >> >> >> On Sat, Oct 13, 2012 at 2:28 PM, Rick Waldron <[email protected]> >> wrote: >> >> >> >> On Sat, Oct 13, 2012 at 5:13 PM, Felipe Gasper <[email protected]> >> wrote: >> >> >> Hi all, >> >> What’s the best way to emulate atob() as modern browsers implement >> it? (At least, I am fairly sure the Mozilla implementation is a de facto >> “standard”?) >> >> >> >> https://npmjs.org/package/atob >> >> >> >> >> -Felipe Gasper >> Houston, TX >> >> -- >> Job Board: http://jobs.nodejs.org/ >> Posting guidelines: >> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines >> You received this message because you are subscribed to the Google >> Groups "nodejs" group. >> To post to this group, send email to [email protected] >> To unsubscribe from this group, send email to >> [email protected] >> For more options, visit this group at >> http://groups.google.com/group/nodejs?hl=en?hl=en >> >> >> >> -- >> Job Board: http://jobs.nodejs.org/ >> Posting guidelines: >> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines >> You received this message because you are subscribed to the Google >> Groups "nodejs" group. >> To post to this group, send email to [email protected] >> To unsubscribe from this group, send email to >> [email protected] >> For more options, visit this group at >> http://groups.google.com/group/nodejs?hl=en?hl=en >> >> >> -- >> Job Board: http://jobs.nodejs.org/ >> Posting guidelines: >> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines >> You received this message because you are subscribed to the Google >> Groups "nodejs" group. >> To post to this group, send email to [email protected] >> To unsubscribe from this group, send email to >> [email protected] >> For more options, visit this group at >> http://groups.google.com/group/nodejs?hl=en?hl=en >> >> >> -- >> Job Board: http://jobs.nodejs.org/ >> Posting guidelines: >> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines >> You received this message because you are subscribed to the Google >> Groups "nodejs" group. >> To post to this group, send email to [email protected] >> To unsubscribe from this group, send email to >> [email protected] >> For more options, visit this group at >> http://groups.google.com/group/nodejs?hl=en?hl=en > -- Felipe M. L. Gasper http://felipegasper.com “Wisdom can never learn enough. Ignorance is sufficient unto itself.” -Mechtild of Magdeburg “Dad always thought laughter was the best medicine, which I guess is why several of us died of tuberculosis.” -Jack Handey -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
