1 |
3a515b92
|
cagy
|
atob
|
2 |
|
|
===
|
3 |
|
|
|
4 |
|
|
| **atob**
|
5 |
|
|
| [btoa](https://git.coolaj86.com/coolaj86/btoa.js)
|
6 |
|
|
| [unibabel.js](https://git.coolaj86.com/coolaj86/unibabel.js)
|
7 |
|
|
| Sponsored by [ppl](https://ppl.family)
|
8 |
|
|
|
9 |
|
|
Uses `Buffer` to emulate the exact functionality of the browser's atob.
|
10 |
|
|
|
11 |
|
|
Note: Unicode may be handled incorrectly (like the browser).
|
12 |
|
|
|
13 |
|
|
It turns base64-encoded <strong>a</strong>scii data back **to** <strong>b</strong>inary.
|
14 |
|
|
|
15 |
|
|
```javascript
|
16 |
|
|
(function () {
|
17 |
|
|
"use strict";
|
18 |
|
|
|
19 |
|
|
var atob = require('atob');
|
20 |
|
|
var b64 = "SGVsbG8sIFdvcmxkIQ==";
|
21 |
|
|
var bin = atob(b64);
|
22 |
|
|
|
23 |
|
|
console.log(bin); // "Hello, World!"
|
24 |
|
|
}());
|
25 |
|
|
```
|
26 |
|
|
|
27 |
|
|
### Need Unicode and Binary Support in the Browser?
|
28 |
|
|
|
29 |
|
|
Check out [unibabel.js](https://git.coolaj86.com/coolaj86/unibabel.js)
|
30 |
|
|
|
31 |
|
|
Changelog
|
32 |
|
|
=======
|
33 |
|
|
|
34 |
|
|
* v2.1.0 address a few issues and PRs, update URLs
|
35 |
|
|
* v2.0.0 provide browser version for ios web workers
|
36 |
|
|
* v1.2.0 provide (empty) browser version
|
37 |
|
|
* v1.1.3 add MIT license
|
38 |
|
|
* v1.1.2 node only
|
39 |
|
|
|
40 |
|
|
LICENSE
|
41 |
|
|
=======
|
42 |
|
|
|
43 |
|
|
Code copyright 2012-2018 AJ ONeal
|
44 |
|
|
|
45 |
|
|
Dual-licensed MIT and Apache-2.0
|
46 |
|
|
|
47 |
|
|
Docs copyright 2012-2018 AJ ONeal
|
48 |
|
|
|
49 |
|
|
Docs released under [Creative Commons](https://git.coolaj86.com/coolaj86/atob.js/blob/master/LICENSE.DOCS).
|