mirror of
https://github.com/scratchfoundation/scratch-storage.git
synced 2025-07-03 18:10:33 -04:00
Merge pull request #17 from paulkaplan/fix-b64-encoding
Use base64 package instead of toString('base64')
This commit is contained in:
commit
4e7ceff816
2 changed files with 3 additions and 1 deletions
|
@ -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",
|
||||
|
|
|
@ -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];
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue