Skip to content

Instantly share code, notes, and snippets.

@jmshal
Last active April 27, 2024 04:12

Revisions

  1. jmshal revised this gist Oct 12, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion atob.js
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,3 @@
    module.exports = function atob(a) {
    return new Buffer(a, 'base64').toString('utf8');
    return new Buffer(a, 'base64').toString('binary');
    };
  2. jmshal created this gist Oct 12, 2016.
    3 changes: 3 additions & 0 deletions atob.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    module.exports = function atob(a) {
    return new Buffer(a, 'base64').toString('utf8');
    };
    3 changes: 3 additions & 0 deletions btoa.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    module.exports = function btoa(b) {
    return new Buffer(b).toString('base64');
    };
    4 changes: 4 additions & 0 deletions index.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    module.exports = {
    atob: require('./atob'),
    btoa: require('./btoa'),
    };
    5 changes: 5 additions & 0 deletions package.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    {
    "name": "atob-btoa.js",
    "version": "1.0.0",
    "description": "Node.js ponyfill for atob and btoa encoding functions"
    }