qmwts 1.2.10 → 1.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -10,13 +10,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.sha256Hex = void 0;
|
|
13
|
+
const hash_wasm_1 = require("hash-wasm");
|
|
13
14
|
const sha256Hex = (file) => __awaiter(void 0, void 0, void 0, function* () {
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
const hasher = yield (0, hash_wasm_1.createSHA256)();
|
|
16
|
+
const chunkSize = 2 * 1024 * 1024; // 2MB
|
|
17
|
+
let offset = 0;
|
|
18
|
+
while (offset < file.size) {
|
|
19
|
+
const chunk = file.slice(offset, offset + chunkSize);
|
|
20
|
+
const buffer = yield chunk.arrayBuffer();
|
|
21
|
+
hasher.update(new Uint8Array(buffer));
|
|
22
|
+
offset += chunkSize;
|
|
23
|
+
}
|
|
24
|
+
return hasher.digest('hex');
|
|
21
25
|
});
|
|
22
26
|
exports.sha256Hex = sha256Hex;
|
|
@@ -6,12 +6,9 @@ exports.default = {
|
|
|
6
6
|
if (Array.isArray(value))
|
|
7
7
|
for (const i of value)
|
|
8
8
|
params.append(key, i);
|
|
9
|
-
else if (
|
|
9
|
+
else if (value != null)
|
|
10
10
|
params.append(key, value);
|
|
11
11
|
}
|
|
12
12
|
return params;
|
|
13
13
|
}
|
|
14
14
|
};
|
|
15
|
-
function isValidValue(value) {
|
|
16
|
-
return value !== null && value !== void 0;
|
|
17
|
-
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = {
|
|
4
|
+
uuid: function () {
|
|
5
|
+
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
6
|
+
var r = (Math.random() * 16) | 0;
|
|
7
|
+
var v = c === 'x' ? r : (r & 0x3) | 0x8;
|
|
8
|
+
return v.toString(16);
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qmwts",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.11",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"dist"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
+
"hash-wasm": "^4.12.0",
|
|
24
25
|
"jszip": "^3.10.1",
|
|
25
26
|
"lodash-es": "^4.17.22",
|
|
26
27
|
"luxon": "^3.7.2"
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var axios_1 = require("axios");
|
|
4
|
-
axios_1.default.interceptors.request.use(function (request) {
|
|
5
|
-
console.log('request');
|
|
6
|
-
return request;
|
|
7
|
-
}, function (error) {
|
|
8
|
-
console.log('request error');
|
|
9
|
-
return Promise.reject(error);
|
|
10
|
-
});
|
|
11
|
-
axios_1.default.interceptors.response.use(function (response) {
|
|
12
|
-
console.log('response');
|
|
13
|
-
return response;
|
|
14
|
-
}, function (error) {
|
|
15
|
-
console.log('response error');
|
|
16
|
-
return Promise.reject(error);
|
|
17
|
-
});
|
|
18
|
-
exports.default = axios_1.default;
|