add sync download
This commit is contained in:
11
src/uitls/hash.ts
Normal file
11
src/uitls/hash.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import MD5 from 'crypto-js/md5.js';
|
||||
import fs from 'node:fs';
|
||||
|
||||
export const getHash = (file: string) => {
|
||||
const content = fs.readFileSync(file, 'utf-8');
|
||||
return MD5(content).toString();
|
||||
};
|
||||
|
||||
export const getBufferHash = (buffer: Buffer) => {
|
||||
return MD5(buffer.toString()).toString();
|
||||
};
|
||||
Reference in New Issue
Block a user