feat(front): enhance file hash calculation by introducing engine selection for large files using native or wasm methods

This commit is contained in:
keven1024
2026-04-08 23:45:34 +08:00
parent f1dc65b1d0
commit ae2fbcc216
3 changed files with 27 additions and 37 deletions

View File

@@ -1,8 +1,8 @@
import calcFileHash from './calcFileHash'
// 监听主线程消息
self.onmessage = async (e: MessageEvent<{ file: File }>) => {
const { file } = e.data || {}
const hash = await calcFileHash({ file })
self.onmessage = async (e: MessageEvent<{ file: File; engine?: 'native' | 'wasm' }>) => {
const { file, engine } = e.data || {}
const hash = await calcFileHash({ file, engine })
self.postMessage({ hash })
}