Merge pull request from paulkaplan/fix-b64-encoding

Use base64 package instead of toString('base64')
This commit is contained in:
Paul Kaplan 2017-09-11 15:13:27 -04:00 committed by GitHub
commit 4e7ceff816
2 changed files with 3 additions and 1 deletions

View file

@ -27,6 +27,7 @@
"babel-loader": "6.2.10",
"babel-polyfill": "6.22.0",
"babel-preset-es2015": "6.22.0",
"base64-js": "1.2.1",
"binary-loader": "0.0.1",
"cz-conventional-changelog": "^2.0.0",
"debug": "2.6.0",

View file

@ -1,10 +1,11 @@
const TextDecoder = require('text-encoding').TextDecoder;
const base64js = require('base64-js');
const memoizedToString = (function () {
const strings = {};
return (assetId, data) => {
if (!strings.hasOwnProperty(assetId)) {
strings[assetId] = data.toString('base64');
strings[assetId] = base64js.fromByteArray(data);
}
return strings[assetId];
};