UNPKG

806 BMarkdownView Raw
1btoa
2===
3
4A port of the browser's `btoa` function.
5
6Uses `Buffer` to emulate the exact functionality of the browser's btoa (except that it supports unicode and the browser may not).
7
8It 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
21Note: Unicode may or may not be handled incorrectly.
22
23Copyright and license
24===
25
26Code and documentation copyright 2012-2014 AJ ONeal Tech, LLC.
27
28Code released under the [Apache license](https://github.com/node-browser-compat/btoa/blob/master/LICENSE).
29
30Docs released under [Creative Commons](https://github.com/node-browser-compat/btoa/blob/master/LICENSE.DOCS).