Skip to content

Commit

Permalink
Remove node-only code
Browse files Browse the repository at this point in the history
  • Loading branch information
raphinesse committed Jun 20, 2019
1 parent 9a27275 commit dce1463
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/common/base64.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ base64.fromArrayBuffer = function (arrayBuffer) {
};

base64.toArrayBuffer = function (str) {
var decodedStr = typeof atob !== 'undefined' ? atob(str) : Buffer.from(str, 'base64').toString('binary');
var decodedStr = atob(str);
var arrayBuffer = new ArrayBuffer(decodedStr.length);
var array = new Uint8Array(arrayBuffer);
for (var i = 0, len = decodedStr.length; i < len; i++) {
Expand Down
4 changes: 2 additions & 2 deletions test/test.base64.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe('base64', function () {

it('Test#003 : can base64 encode an text string in an ArrayBuffer', function () {
var orig = 'Some Awesome Test This Is!';
var base64string = typeof btoa !== 'undefined' ? btoa(orig) : Buffer.from('Some Awesome Test This Is!', 'binary').toString('base64');
var base64string = btoa(orig);
var arrayBuffer = new ArrayBuffer(orig.length);
var view = new Uint8Array(arrayBuffer);

Expand All @@ -68,7 +68,7 @@ describe('base64', function () {

it('Test#004 : can decode a base64-encoded text string into an ArrayBuffer', function () {
var orig = 'Some Awesome Test This Is!';
var base64string = typeof btoa !== 'undefined' ? btoa(orig) : Buffer.from(orig, 'binary').toString('base64');
var base64string = btoa(orig);

var arrayBuffer = base64.toArrayBuffer(base64string);

Expand Down

0 comments on commit dce1463

Please sign in to comment.