Replace pako with gzip-js

This commit is contained in:
MattIPv4 2020-06-05 20:54:44 +01:00
parent 35962bd05e
commit e8a5b2c6b5
3 changed files with 23 additions and 4 deletions

19
package-lock.json generated
View file

@ -3577,6 +3577,11 @@
"parse-json": "^4.0.0"
}
},
"crc32": {
"version": "0.2.2",
"resolved": "https://registry.npmjs.org/crc32/-/crc32-0.2.2.tgz",
"integrity": "sha1-etIg1v/c0Rn5/BJ6d3LKzqOQpLo="
},
"create-ecdh": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.3.tgz",
@ -4217,6 +4222,11 @@
}
}
},
"deflate-js": {
"version": "0.2.3",
"resolved": "https://registry.npmjs.org/deflate-js/-/deflate-js-0.2.3.tgz",
"integrity": "sha1-+Fq7WOvFFRowYUdHPVfD5PfkQms="
},
"del": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/del/-/del-4.1.1.tgz",
@ -5944,6 +5954,15 @@
"unicode-trie": "^0.3.1"
}
},
"gzip-js": {
"version": "0.3.2",
"resolved": "https://registry.npmjs.org/gzip-js/-/gzip-js-0.3.2.tgz",
"integrity": "sha1-IxF+/usozzhSSN7/Df+tiUg22Ws=",
"requires": {
"crc32": ">= 0.2.2",
"deflate-js": ">= 0.2.2"
}
},
"gzip-size": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/gzip-size/-/gzip-size-5.1.1.tgz",

View file

@ -44,7 +44,7 @@
"do-bulma": "git+https://github.com/do-community/do-bulma.git",
"do-vue": "git+https://github.com/do-community/do-vue.git",
"escape-html": "^1.0.3",
"pako": "^1.0.11",
"gzip-js": "^0.3.2",
"pretty-checkbox-vue": "^1.1.9",
"prismjs": "^1.20.0",
"qs": "^6.9.4",

View file

@ -62,7 +62,7 @@ THE SOFTWARE.
<script>
import tar from 'tarts';
import { gzip } from 'pako';
import { zip as gzip } from 'gzip-js';
import ClipboardJS from 'clipboard';
import i18n from '../i18n';
import * as Sections from './setup_sections';
@ -130,14 +130,14 @@ THE SOFTWARE.
});
}
return gzip(tar(data));
return gzip(tar(data), { level: 9 });
},
downloadTar() {
// Get the config files as a compressed tar
const contents = this.tarContents();
// Convert it to a blob and download
const blob = new Blob([ contents ], { type: 'application/tar+gzip' });
const blob = new Blob([ Uint8Array.from(contents) ], { type: 'application/tar+gzip' });
const link = document.createElement('a');
link.href = window.URL.createObjectURL(blob);
link.download = this.tarName;