{"_id":"base-64","_rev":"3759176","name":"base-64","description":"A robust base64 encoder/decoder that is fully compatible with `atob()` and `btoa()`, written in JavaScript.","dist-tags":{"latest":"1.0.0"},"maintainers":[{"name":"mathias","email":""}],"time":{"modified":"2025-03-27T07:14:03.000Z","created":"2014-05-13T14:16:57.833Z","1.0.0":"2020-10-17T16:45:05.428Z","0.1.0":"2014-05-13T14:16:57.833Z"},"users":{"oncletom":true,"thierrymarianne":true,"xrush":true,"godoshian":true,"sean9999":true,"code_monk":true,"jeserodz":true,"cysean":true,"dillonace":true,"mik1986":true,"toszter":true,"oboochin":true,"psbolden":true,"kktam":true,"koulmomo":true,"codeinpixel":true,"yinone":true,"edge5":true,"madeo":true,"linger":true},"author":{"name":"Mathias Bynens","url":"https://mathiasbynens.be/"},"repository":{"type":"git","url":"git+https://github.com/mathiasbynens/base64.git"},"versions":{"1.0.0":{"name":"base-64","version":"1.0.0","description":"A robust base64 encoder/decoder that is fully compatible with `atob()` and `btoa()`, written in JavaScript.","homepage":"https://mths.be/base64","main":"base64.js","keywords":["codec","decoder","encoder","base64","atob","btoa"],"license":"MIT","author":{"name":"Mathias Bynens","url":"https://mathiasbynens.be/"},"repository":{"type":"git","url":"git+https://github.com/mathiasbynens/base64.git"},"bugs":{"url":"https://github.com/mathiasbynens/base64/issues"},"scripts":{"test":"mocha tests/tests.js","build":"grunt build"},"devDependencies":{"coveralls":"^2.11.4","grunt":"^0.4.5","grunt-cli":"^1.3.2","grunt-shell":"^1.1.2","grunt-template":"^0.2.3","istanbul":"^0.4.0","mocha":"^6.2.0","regenerate":"^1.2.1"},"gitHead":"913b89753d99362855c71c02d04384d1d1a9c2fd","_id":"base-64@1.0.0","_nodeVersion":"12.17.0","_npmVersion":"6.14.4","dist":{"shasum":"09d0f2084e32a3fd08c2475b973788eee6ae8f4a","size":4491,"noattachment":false,"key":"/base-64/-/base-64-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/base-64/download/base-64-1.0.0.tgz"},"maintainers":[{"name":"mathias","email":""}],"_npmUser":{"name":"mathias","email":"mathias@qiwi.be"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/base-64_1.0.0_1602953105295_0.6881033708887716"},"_hasShrinkwrap":false,"publish_time":1602953105428,"_cnpm_publish_time":1602953105428,"_cnpmcore_publish_time":"2021-12-16T14:06:42.929Z"},"0.1.0":{"name":"base-64","version":"0.1.0","description":"A robust base64 encoder/decoder that is fully compatible with `atob()` and `btoa()`, written in JavaScript.","homepage":"http://mths.be/base64","main":"base64.js","keywords":["codec","decoder","encoder","base64","atob","btoa"],"licenses":[{"type":"MIT","url":"http://mths.be/mit"}],"author":{"name":"Mathias Bynens","url":"http://mathiasbynens.be/"},"repository":{"type":"git","url":"https://github.com/mathiasbynens/base64.git"},"bugs":{"url":"https://github.com/mathiasbynens/base64/issues"},"files":["LICENSE-MIT.txt","base64.js"],"directories":{"test":"tests"},"scripts":{"test":"node tests/tests.js"},"devDependencies":{"grunt":"~0.4.4","grunt-shell":"~0.7.0","grunt-template":"~0.2.3","istanbul":"~0.2.7","qunit-extras":"~1.1.0","qunitjs":"~1.11.0","requirejs":"~2.1.11"},"_id":"base-64@0.1.0","_shasum":"780a99c84e7d600260361511c4877613bf24f6bb","_from":".","_npmVersion":"1.4.10","_npmUser":{"name":"mathias","email":"mathias@qiwi.be"},"maintainers":[{"name":"mathias","email":""}],"dist":{"shasum":"780a99c84e7d600260361511c4877613bf24f6bb","size":4575,"noattachment":false,"key":"/base-64/-/base-64-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/base-64/download/base-64-0.1.0.tgz"},"publish_time":1399990617833,"_hasShrinkwrap":false,"_cnpm_publish_time":1399990617833,"_cnpmcore_publish_time":"2021-12-16T14:06:43.173Z"}},"readme":"# base64 [![Build status](https://travis-ci.org/mathiasbynens/base64.svg?branch=master)](https://travis-ci.org/mathiasbynens/base64) [![Code coverage status](http://img.shields.io/coveralls/mathiasbynens/base64/master.svg)](https://coveralls.io/r/mathiasbynens/base64)\n\n_base64_ is a robust base64 encoder/decoder that is fully compatible with [`atob()` and `btoa()`](https://html.spec.whatwg.org/multipage/webappapis.html#atob), written in JavaScript. The base64-encoding and -decoding algorithms it uses are fully [RFC 4648](https://tools.ietf.org/html/rfc4648#section-4) compliant.\n\n## Installation\n\nVia [npm](https://www.npmjs.com/):\n\n```bash\nnpm install base-64\n```\n\nIn a browser:\n\n```html\n<script src=\"base64.js\"></script>\n```\n\nIn [Narwhal](http://narwhaljs.org/), [Node.js](https://nodejs.org/), and [RingoJS](http://ringojs.org/):\n\n```js\nvar base64 = require('base-64');\n```\n\nIn [Rhino](http://www.mozilla.org/rhino/):\n\n```js\nload('base64.js');\n```\n\nUsing an AMD loader like [RequireJS](http://requirejs.org/):\n\n```js\nrequire(\n  {\n    'paths': {\n      'base64': 'path/to/base64'\n    }\n  },\n  ['base64'],\n  function(base64) {\n    console.log(base64);\n  }\n);\n```\n\n## API\n\n### `base64.version`\n\nA string representing the semantic version number.\n\n### `base64.encode(input)`\n\nThis function takes a byte string (the `input` parameter) and encodes it according to base64. The input data must be in the form of a string containing only characters in the range from U+0000 to U+00FF, each representing a binary byte with values `0x00` to `0xFF`. The `base64.encode()` function is designed to be fully compatible with [`btoa()` as described in the HTML Standard](https://html.spec.whatwg.org/multipage/webappapis.html#dom-windowbase64-btoa).\n\n```js\nvar encodedData = base64.encode(input);\n```\n\nTo base64-encode any Unicode string, [encode it as UTF-8 first](https://github.com/mathiasbynens/utf8.js#utf8encodestring):\n\n```js\nvar base64 = require('base-64');\nvar utf8 = require('utf8');\n\nvar text = 'foo © bar ???? baz';\nvar bytes = utf8.encode(text);\nvar encoded = base64.encode(bytes);\nconsole.log(encoded);\n// → 'Zm9vIMKpIGJhciDwnYyGIGJheg=='\n```\n\n### `base64.decode(input)`\n\nThis function takes a base64-encoded string (the `input` parameter) and decodes it. The return value is in the form of a string containing only characters in the range from U+0000 to U+00FF, each representing a binary byte with values `0x00` to `0xFF`. The `base64.decode()` function is designed to be fully compatible with [`atob()` as described in the HTML Standard](https://html.spec.whatwg.org/multipage/webappapis.html#dom-windowbase64-atob).\n\n```js\nvar decodedData = base64.decode(encodedData);\n```\n\nTo base64-decode UTF-8-encoded data back into a Unicode string, [UTF-8-decode it](https://github.com/mathiasbynens/utf8.js#utf8decodebytestring) after base64-decoding it:\n\n```js\nvar encoded = 'Zm9vIMKpIGJhciDwnYyGIGJheg==';\nvar bytes = base64.decode(encoded);\nvar text = utf8.decode(bytes);\nconsole.log(text);\n// → 'foo © bar ???? baz'\n```\n\n## Support\n\n_base64_ is designed to work in at least Node.js v0.10.0, Narwhal 0.3.2, RingoJS 0.8-0.9, PhantomJS 1.9.0, Rhino 1.7RC4, as well as old and modern versions of Chrome, Firefox, Safari, Opera, and Internet Explorer.\n\n## Unit tests & code coverage\n\nAfter cloning this repository, run `npm install` to install the dependencies needed for development and testing. You may want to install Istanbul _globally_ using `npm install istanbul -g`.\n\nOnce that’s done, you can run the unit tests in Node using `npm test` or `node tests/tests.js`. To run the tests in Rhino, Ringo, Narwhal, and web browsers as well, use `grunt test`.\n\nTo generate the code coverage report, use `grunt cover`.\n\n## Author\n\n| [![twitter/mathias](https://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias \"Follow @mathias on Twitter\") |\n|---|\n| [Mathias Bynens](https://mathiasbynens.be/) |\n\n## License\n\n_base64_ is available under the [MIT](https://mths.be/mit) license.\n","_attachments":{},"homepage":"https://mths.be/base64","bugs":{"url":"https://github.com/mathiasbynens/base64/issues"},"license":"MIT"}