Skip to content

Commit 37f47d1

Browse files
committed
fix(uploads): update hash worker import to inline module
Signed-off-by: MadDogOwner <xiaoran@xrgzs.top>
1 parent 91004bd commit 37f47d1

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/pages/home/uploads/util.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { UploadFileProps } from "./types"
22
import type { WorkerMessage } from "./hash-worker"
3+
import HashWorker from "./hash-worker?worker&inline"
34

45
export const traverseFileTree = async (entry: FileSystemEntry) => {
56
const res: File[] = []
@@ -70,9 +71,7 @@ export const calculateHash = async (
7071
) => {
7172
return new Promise<{ md5: string; sha1: string; sha256: string }>(
7273
(resolve, reject) => {
73-
const worker = new Worker(new URL("./hash-worker.ts", import.meta.url), {
74-
type: "module",
75-
})
74+
const worker = new HashWorker()
7675

7776
const terminate = (fn: () => void) => {
7877
worker.terminate()

0 commit comments

Comments
 (0)