@zwa73/utils 1.0.290 → 1.0.292
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.
- package/dist/UtilFileTools.d.ts +1 -1
- package/dist/UtilFileTools.js +2 -2
- package/dist/UtilFunctions.d.ts +1 -1
- package/dist/UtilFunctions.js +1 -1
- package/dist/UtilHttp.d.ts +0 -2
- package/dist/UtilHttp.js +0 -10
- package/package.json +1 -3
package/dist/UtilFileTools.d.ts
CHANGED
|
@@ -213,7 +213,7 @@ export declare namespace UtilFT {
|
|
|
213
213
|
* @param opt.chunkSize - 抽取的块大小 默认1024
|
|
214
214
|
* @param opt.chunkCount - 抽取的块的数量 默认10
|
|
215
215
|
*/
|
|
216
|
-
function
|
|
216
|
+
function computeHash(filePath: string, opt?: {
|
|
217
217
|
/**hash算法 默认md5 */
|
|
218
218
|
algorithm?: HashAlgorithm;
|
|
219
219
|
/**抽取部分计算 默认false */
|
package/dist/UtilFileTools.js
CHANGED
|
@@ -412,7 +412,7 @@ var UtilFT;
|
|
|
412
412
|
* @param opt.chunkSize - 抽取的块大小 默认1024
|
|
413
413
|
* @param opt.chunkCount - 抽取的块的数量 默认10
|
|
414
414
|
*/
|
|
415
|
-
async function
|
|
415
|
+
async function computeHash(filePath, opt) {
|
|
416
416
|
const { algorithm = "md5", chunkSize = 1024, chunkCount = 10, sampled = false } = opt ?? {};
|
|
417
417
|
const chash = async (filePath) => new Promise((resolve, reject) => {
|
|
418
418
|
const hash = crypto_1.default.createHash(algorithm);
|
|
@@ -446,5 +446,5 @@ var UtilFT;
|
|
|
446
446
|
}
|
|
447
447
|
return hash.digest("hex");
|
|
448
448
|
}
|
|
449
|
-
UtilFT.
|
|
449
|
+
UtilFT.computeHash = computeHash;
|
|
450
450
|
})(UtilFT || (exports.UtilFT = UtilFT = {}));
|
package/dist/UtilFunctions.d.ts
CHANGED
package/dist/UtilFunctions.js
CHANGED
package/dist/UtilHttp.d.ts
CHANGED
|
@@ -113,8 +113,6 @@ export declare class UtilHttp<D extends Partial<RequestOption> & Required<Pick<R
|
|
|
113
113
|
header<HAD extends http.OutgoingHttpHeaders>(headers: HAD): UtilHttp<D & {
|
|
114
114
|
headers: HAD;
|
|
115
115
|
}, S, A>;
|
|
116
|
-
/**设置agent */
|
|
117
|
-
proxyAgent(url: string): this;
|
|
118
116
|
/**添加一段query */
|
|
119
117
|
query(data: QueryRequestData): this;
|
|
120
118
|
/**克隆 */
|
package/dist/UtilHttp.js
CHANGED
|
@@ -11,8 +11,6 @@ const querystring_1 = __importDefault(require("querystring"));
|
|
|
11
11
|
const url_1 = require("url");
|
|
12
12
|
const js_utils_1 = require("@zwa73/js-utils");
|
|
13
13
|
const form_data_1 = __importDefault(require("form-data"));
|
|
14
|
-
const http_proxy_agent_1 = require("http-proxy-agent");
|
|
15
|
-
const https_proxy_agent_1 = require("https-proxy-agent");
|
|
16
14
|
const pathe_1 = __importDefault(require("pathe"));
|
|
17
15
|
const UtilFunctions_1 = require("./UtilFunctions");
|
|
18
16
|
const UtilLogger_1 = require("./UtilLogger");
|
|
@@ -101,14 +99,6 @@ class UtilHttp {
|
|
|
101
99
|
};
|
|
102
100
|
return this;
|
|
103
101
|
}
|
|
104
|
-
/**设置agent */
|
|
105
|
-
proxyAgent(url) {
|
|
106
|
-
this._data.agent = UtilFunctions_1.UtilFunc.match(this._data['protocol'], {
|
|
107
|
-
'http:': () => new http_proxy_agent_1.HttpProxyAgent(url),
|
|
108
|
-
'https:': () => new https_proxy_agent_1.HttpsProxyAgent(url),
|
|
109
|
-
});
|
|
110
|
-
return this;
|
|
111
|
-
}
|
|
112
102
|
/**添加一段query */
|
|
113
103
|
query(data) {
|
|
114
104
|
this._data.path = UtilHttp.buildQuery(this._data.path ?? '', data);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zwa73/utils",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.292",
|
|
4
4
|
"description": "my utils",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -21,8 +21,6 @@
|
|
|
21
21
|
"form-data": "^4.0.2",
|
|
22
22
|
"glob": "^13.0.0",
|
|
23
23
|
"html-entities": "^2.3.3",
|
|
24
|
-
"http-proxy-agent": "^7.0.2",
|
|
25
|
-
"https-proxy-agent": "^7.0.6",
|
|
26
24
|
"pathe": "^1.1.2",
|
|
27
25
|
"querystring": "^0.2.1",
|
|
28
26
|
"winston": "^3.10.0",
|