I am Hack Sparrow
Captain of the Internets.

Base64 Encoding / Decoding in Node.js

So how do you encode a string to base64 is Node.js? Is there something easy like base64_encode() of PHP's? Node.js 'being' JavaScript, has a more logical approach to encoding strings, instead of having thousands of inconsistently defined global functions. Here is how you encode normal text to base64 in Node.js: [code] var b = new Buffer('JavaScript'); var s = b.toString('base64'); // SmF2YVNjcmlwdA== [/code] And here is how you decode base64 encoded strings: [code ...

Get ASCII value of Character, Convert ASCII to Character in JavaScript

To get the ASCII value of a character, use the charCodeAt instance method of the String JavaScript object. Example: [js] var s = 'A'; console.log(s.charCodeAt(0)); [/js] To convert an ASCII value to its corresponding character use the fromCharCode static method of the String JavaScript object. Example: [js] console.log(String.fromCharCode(65)); [/js] ...