main
Last change
on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
982 bytes
|
Rev | Line | |
---|
[79a0317] | 1 | btoa
|
---|
| 2 | ===
|
---|
| 3 |
|
---|
| 4 | | [atob](https://git.coolaj86.com/coolaj86/atob.js)
|
---|
| 5 | | **btoa**
|
---|
| 6 | | [unibabel.js](https://git.coolaj86.com/coolaj86/unibabel.js)
|
---|
| 7 | | Sponsored by [ppl](https://ppl.family)
|
---|
| 8 |
|
---|
| 9 | A port of the browser's `btoa` function.
|
---|
| 10 |
|
---|
| 11 | Uses `Buffer` to emulate the exact functionality of the browser's btoa
|
---|
| 12 | (except that it supports some unicode that the browser may not).
|
---|
| 13 |
|
---|
| 14 | It turns <strong>b</strong>inary data __to__ base64-encoded <strong>a</strong>scii.
|
---|
| 15 |
|
---|
| 16 | ```js
|
---|
| 17 | (function () {
|
---|
| 18 | "use strict";
|
---|
| 19 |
|
---|
| 20 | var btoa = require('btoa');
|
---|
| 21 | var bin = "Hello, 世界";
|
---|
| 22 | var b64 = btoa(bin);
|
---|
| 23 |
|
---|
| 24 | console.log(b64); // "SGVsbG8sIBZM"
|
---|
| 25 | }());
|
---|
| 26 | ```
|
---|
| 27 |
|
---|
| 28 | **Note**: Unicode may or may not be handled incorrectly.
|
---|
| 29 | This module is intended to provide exact compatibility with the browser.
|
---|
| 30 |
|
---|
| 31 | Copyright and License
|
---|
| 32 | ===
|
---|
| 33 |
|
---|
| 34 | Code copyright 2012-2018 AJ ONeal
|
---|
| 35 |
|
---|
| 36 | Dual-licensed MIT and Apache-2.0
|
---|
| 37 |
|
---|
| 38 | Docs copyright 2012-2018 AJ ONeal
|
---|
| 39 |
|
---|
| 40 | Docs released under [Creative Commons](https://git.coolaj86.com/coolaj86/btoa.js/blob/master/LICENSE.DOCS).
|
---|
Note:
See
TracBrowser
for help on using the repository browser.