|
@ -33,7 +33,7 @@ function placeHoldersCount (b64) { |
|
|
|
|
|
|
|
|
function byteLength (b64) { |
|
|
function byteLength (b64) { |
|
|
// base64 is 4/3 + up to two characters of the original data
|
|
|
// base64 is 4/3 + up to two characters of the original data
|
|
|
return b64.length * 3 / 4 - placeHoldersCount(b64) |
|
|
return (b64.length * 3 / 4) - placeHoldersCount(b64) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function toByteArray (b64) { |
|
|
function toByteArray (b64) { |
|
@ -41,7 +41,7 @@ function toByteArray (b64) { |
|
|
var len = b64.length |
|
|
var len = b64.length |
|
|
placeHolders = placeHoldersCount(b64) |
|
|
placeHolders = placeHoldersCount(b64) |
|
|
|
|
|
|
|
|
arr = new Arr(len * 3 / 4 - placeHolders) |
|
|
arr = new Arr((len * 3 / 4) - placeHolders) |
|
|
|
|
|
|
|
|
// if there are placeholders, only get up to the last complete 4 chars
|
|
|
// if there are placeholders, only get up to the last complete 4 chars
|
|
|
l = placeHolders > 0 ? len - 4 : len |
|
|
l = placeHolders > 0 ? len - 4 : len |
|
|