更新版本至 0.0.48,升级依赖项,优化哈希函数实现,新增 QueryMark 类及相关功能
This commit is contained in:
@@ -1,13 +1,12 @@
|
||||
import MD5 from 'crypto-js/md5';
|
||||
import SparkMD5 from 'spark-md5';
|
||||
|
||||
export const hashContent = (str: string | Blob | Buffer): Promise<string> | string => {
|
||||
if (typeof str === 'string') {
|
||||
return MD5(str).toString();
|
||||
return SparkMD5.hash(str);
|
||||
} else if (str instanceof Blob) {
|
||||
return hashBlob(str);
|
||||
} else if (Buffer.isBuffer(str)) {
|
||||
return MD5(str.toString()).toString();
|
||||
return SparkMD5.hash(str.toString());
|
||||
}
|
||||
console.error('hashContent error: input must be a string, Blob, or Buffer');
|
||||
return '';
|
||||
|
||||
Reference in New Issue
Block a user