We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 23ca585 commit 7713260Copy full SHA for 7713260
src/ts/file-reader.ts
@@ -1,9 +1,11 @@
1
import { Har } from "har-format";
2
3
-declare const zip: any;
4
-
5
// use zip
6
-zip.useWebWorkers = false;
+const getConfiguredZipJs = () => {
+ const zip = window["zip"] || {};
+ zip.useWebWorkers = false;
7
+ return zip;
8
+};
9
10
/** handle client side file upload */
11
export function readFile(file: File,
@@ -25,6 +27,8 @@ export function readFile(file: File,
25
27
26
28
/** start reading the file */
29
const extension = (fileName.match(/\.[0-9a-z]+$/i) || [])[0];
30
+ const zip = getConfiguredZipJs();
31
+
32
if ([".zhar", ".zip"].indexOf(extension) !== -1) {
33
/** zhar */
34
zip.createReader(new zip.BlobReader(file), (zipReader) => {
0 commit comments