feat: broken highway

This commit is contained in:
pk5ls20 committed 2024-10-16 11:58:47 +08:00
1 parent f9e44820c1
commit d30d467a21
17 files changed
+1352 -144

No files matched your search

+16
View File
@@ -0,0 +1,16 @@
// love from https://github.com/LagrangeDev/lagrangejs & https://github.com/takayama-lily/oicq
import * as crypto from 'crypto';
import * as stream from 'stream';
import * as fs from 'fs';
function sha1Stream(readable: stream.Readable) {
return new Promise((resolve, reject) => {
readable.on('error', reject);
readable.pipe(crypto.createHash('sha1').on('error', reject).on('data', resolve));
}) as Promise<Buffer>;
}
export function calculateSha1(filePath: string): Promise<Buffer> {
const readable = fs.createReadStream(filePath);
return sha1Stream(readable);
}