-
-
Save kriscooke/488599dbcef34099de8ab9998a51db01 to your computer and use it in GitHub Desktop.
Node.js ponyfill for atob and btoa encoding functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function atob(a) { | |
return new Buffer(a, 'base64').toString('binary'); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function btoa(b) { | |
return new Buffer(b).toString('base64'); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
atob: require('./atob'), | |
btoa: require('./btoa'), | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "atob-btoa.js", | |
"version": "1.0.0", | |
"description": "Node.js ponyfill for atob and btoa encoding functions" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment