1 | btoa
|
2 | ===
|
3 |
|
4 | A port of the browser's `btoa` function.
|
5 |
|
6 | Uses `Buffer` to emulate the exact functionality of the browser's btoa (except that it supports unicode and the browser may not).
|
7 |
|
8 | It turns **b**inary data **to** base64-encoded **a**scii.
|
9 |
|
10 | (function () {
|
11 | "use strict";
|
12 |
|
13 | var btoa = require('btoa')
|
14 | , bin = "Hello, 世界"
|
15 | , b64 = btoa(bin)
|
16 | ;
|
17 |
|
18 | console.log(b64); // "SGVsbG8sIBZM"
|
19 | }());
|
20 |
|
21 | Note: Unicode may or may not be handled incorrectly.
|
22 |
|
23 | Copyright and license
|
24 | ===
|
25 |
|
26 | Code and documentation copyright 2012-2014 AJ ONeal Tech, LLC.
|
27 |
|
28 | Code released under the [Apache license](https://github.com/node-browser-compat/btoa/blob/master/LICENSE).
|
29 |
|
30 | Docs released under [Creative Commons](https://github.com/node-browser-compat/btoa/blob/master/LICENSE.DOCS).
|