node-base64 icon indicating copy to clipboard operation
node-base64 copied to clipboard

Replacement for newer Node versions

Open marklagendijk opened this issue 9 years ago • 1 comments

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.

marklagendijk avatar Oct 06 '15 11:10 marklagendijk

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.

simkuns avatar Oct 28 '15 09:10 simkuns