node-base64
node-base64 copied to clipboard
Replacement for newer Node versions
I was using this problem, but then got problems as soon as I started to use a newer version of Node. The following code can replace this module:
module.exports = {
encode(string){
return new Buffer(string).toString('base64');
},
decode(encodedString){
return new Buffer(encodedString, 'base64').toString('ascii');
}
};
Does this work for all versions of Node? If so I think this module should just use the above code.
They added base64 for Buffers in 2010.07.25, so it should work for all versions of Node.
Thank you for the replacement code, it works perfectly.