|
|
@ -1,5 +1,8 @@ |
|
|
|
'use strict' |
|
|
|
|
|
|
|
exports.toByteArray = toByteArray |
|
|
|
exports.fromByteArray = fromByteArray |
|
|
|
|
|
|
|
var i |
|
|
|
var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' |
|
|
|
var lookup = [] |
|
|
@ -23,7 +26,7 @@ function decode (elt) { |
|
|
|
return v !== undefined ? v : -1 |
|
|
|
} |
|
|
|
|
|
|
|
function b64ToByteArray (b64) { |
|
|
|
function toByteArray (b64) { |
|
|
|
var i, j, l, tmp, placeHolders, arr |
|
|
|
|
|
|
|
if (b64.length % 4 > 0) { |
|
|
@ -87,7 +90,7 @@ function encodeChunk (uint8, start, end) { |
|
|
|
return output.join('') |
|
|
|
} |
|
|
|
|
|
|
|
function uint8ToBase64 (uint8) { |
|
|
|
function fromByteArray (uint8) { |
|
|
|
var i |
|
|
|
var extraBytes = uint8.length % 3 // if we have 1 byte left, pad 2 bytes
|
|
|
|
var output = '' |
|
|
@ -124,6 +127,3 @@ function uint8ToBase64 (uint8) { |
|
|
|
|
|
|
|
return parts.join('') |
|
|
|
} |
|
|
|
|
|
|
|
exports.toByteArray = b64ToByteArray |
|
|
|
exports.fromByteArray = uint8ToBase64 |
|
|
|