Compare commits

...

8 Commits

Author SHA1 Message Date
AJ ONeal
19e0da6568 v1.2.1 2018-03-27 22:53:48 -06:00
AJ ONeal
aedf7281e7 v1.2.0 2018-03-27 22:44:53 -06:00
AJ ONeal
625d3f256f
Merge pull request #4 from pdehaan/patch-1
Update license attribute
2018-03-27 22:34:58 -06:00
AJ ONeal
541f141d47
Merge pull request #5 from chrisjlee/patch-1
Remove dangling semi-colon
2018-03-27 22:33:15 -06:00
Chris J. Lee
91a98dee8f Remove dangling semi-colon
remove dangling semi-colon.
2016-05-10 11:01:01 -05:00
Peter deHaan
d8a75802a9 Update license attribute
specifying the type and URL is deprecated:

https://docs.npmjs.com/files/package.json#license
http://npm1k.org/
2015-05-20 22:48:25 -07:00
AJ ONeal
e588305f24 Update README.md 2014-05-20 09:58:09 -05:00
AJ ONeal
fcb608ae56 Update README.md 2014-05-20 09:57:15 -05:00
4 changed files with 34 additions and 27 deletions

View File

@ -1,30 +1,40 @@
btoa
===
| [atob](https://git.coolaj86.com/coolaj86/atob.js)
| **btoa**
| [unibabel.js](https://git.coolaj86.com/coolaj86/unibabel.js)
| Sponsored by [ppl](https://ppl.family)
A port of the browser's `btoa` function.
Uses `Buffer` to emulate the exact functionality of the browser's btoa (except that it supports unicode and the browser may not).
Uses `Buffer` to emulate the exact functionality of the browser's btoa
(except that it supports some unicode that the browser may not).
It turns **b**inary data **to** base64-encoded **a**scii.
It turns <strong>b</strong>inary data __to__ base64-encoded <strong>a</strong>scii.
(function () {
"use strict";
var btoa = require('btoa')
, bin = "Hello, 世界"
, b64 = btoa(bin)
;
```js
(function () {
"use strict";
console.log(b64); // "SGVsbG8sIBZM"
}());
var btoa = require('btoa');
var bin = "Hello, 世界";
var b64 = btoa(bin);
Note: Unicode may or may not be handled incorrectly.
console.log(b64); // "SGVsbG8sIBZM"
}());
```
Copyright and license
**Note**: Unicode may or may not be handled incorrectly.
This module is intended to provide exact compatibility with the browser.
Copyright and License
===
Code and documentation copyright 2012-2014 AJ ONeal Tech, LLC.
Code copyright 2012-2018 AJ ONeal
Code released under the [Apache license](https://github.com/node-browser-compat/btoa/blob/master/LICENSE).
Dual-licensed MIT and Apache-2.0
Docs released under [Creative Commons](https://github.com/node-browser-compat/btoa/blob/master/LICENSE.DOCS).
Docs copyright 2012-2018 AJ ONeal
Docs released under [Creative Commons](https://git.coolaj86.com/coolaj86/btoa.js/blob/master/LICENSE.DOCS).

View File

@ -1,10 +1,8 @@
#!/usr/bin/env node
/*jshint strict:true node:true es5:true onevar:true laxcomma:true laxbreak:true eqeqeq:true immed:true latedef:true*/
(function () {
"use strict";
var btoa = require('../index')
;
var btoa = require('../index');
console.log(btoa(process.argv[2]));
}());

View File

@ -2,13 +2,12 @@
"use strict";
function btoa(str) {
var buffer
;
var buffer;
if (str instanceof Buffer) {
buffer = str;
} else {
buffer = new Buffer(str.toString(), 'binary');
buffer = Buffer.from(str.toString(), 'binary');
}
return buffer.toString('base64');

View File

@ -1,16 +1,16 @@
{
"name": "btoa",
"homepage": "https://github.com/coolaj86/node-browser-compat",
"homepage": "https://git.coolaj86.com/coolaj86/btoa.js.git",
"description": "btoa for Node.JS (it's a one-liner)",
"repository": {
"type": "git",
"url": "git://github.com/coolaj86/node-browser-compat.git"
"url": "git://git.coolaj86.com/coolaj86/btoa.js.git"
},
"keywords": [
"btoa",
"browser"
],
"author": "AJ ONeal <coolaj86@gmail.com> (http://coolaj86.info)",
"author": "AJ ONeal <coolaj86@gmail.com> (https://coolaj86.com)",
"engines": {
"node": ">= 0.4.0"
},
@ -18,6 +18,6 @@
"btoa": "bin/btoa.js"
},
"main": "index",
"license": "Apache2",
"version": "1.1.2"
"license": "(MIT OR Apache-2.0)",
"version": "1.2.1"
}