Well the first node.js takes input in binary string, what you want is for it take input in base-16 or base-64. Since you already have nice base-64 implementations and base16 decoder is dead simple to do, I think you're set.
https://github.com/agnoster/base32-js/blob/master/lib/base32.js Also works for browsers out of the box.
So you'd use it like this in browser:
var result = base32.encode(base64decode(base64input));
var result2 = base32.encode(base16decode(base16input));
var result3 = base32.encode(binaryInput);
Where base16decode
:
function base16decode( str ) {
return str.replace( /([A-fa-f0-9]{2})/g, function( m, g1 ) {
return String.fromCharCode( parseInt( g1, 16 ));
});
}