@zwa73/utils 1.0.290 → 1.0.291

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.
@@ -213,7 +213,7 @@ export declare namespace UtilFT {
213
213
  * @param opt.chunkSize - 抽取的块大小 默认1024
214
214
  * @param opt.chunkCount - 抽取的块的数量 默认10
215
215
  */
216
- function calculateHash(filePath: string, opt?: {
216
+ function computeHash(filePath: string, opt?: {
217
217
  /**hash算法 默认md5 */
218
218
  algorithm?: HashAlgorithm;
219
219
  /**抽取部分计算 默认false */
@@ -412,7 +412,7 @@ var UtilFT;
412
412
  * @param opt.chunkSize - 抽取的块大小 默认1024
413
413
  * @param opt.chunkCount - 抽取的块的数量 默认10
414
414
  */
415
- async function calculateHash(filePath, opt) {
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.calculateHash = calculateHash;
449
+ UtilFT.computeHash = computeHash;
450
450
  })(UtilFT || (exports.UtilFT = UtilFT = {}));
@@ -26,7 +26,7 @@ declare class _UtilFunc {
26
26
  * @param method - hash算法
27
27
  * @returns hash
28
28
  */
29
- static calcHash(str: string, opt?: {
29
+ static computeHash(str: string, opt?: {
30
30
  /**hash算法 默认md5 */
31
31
  algorithm?: HashAlgorithm;
32
32
  }): string;
@@ -59,7 +59,7 @@ class _UtilFunc {
59
59
  * @param method - hash算法
60
60
  * @returns hash
61
61
  */
62
- static calcHash(str, opt) {
62
+ static computeHash(str, opt) {
63
63
  const { algorithm = "md5" } = opt ?? {};
64
64
  return crypto.createHash(algorithm).update(str).digest('hex');
65
65
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zwa73/utils",
3
- "version": "1.0.290",
3
+ "version": "1.0.291",
4
4
  "description": "my utils",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {