Skip to content

Commit 8834f82

Browse files
committed
undo hackfix
1 parent 6e595cb commit 8834f82

File tree

1 file changed

+19
-22
lines changed

1 file changed

+19
-22
lines changed

src/main/services/recording.ts

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,26 @@ import {
1212
TASK_EXTRACTION_PROMPT,
1313
} from "./transcription-prompts.js";
1414

15-
const fallbackFile = class File extends Blob {
16-
name: string;
17-
lastModified: number;
18-
19-
constructor(bits: BlobPart[], name: string, options?: FilePropertyBag) {
20-
super(bits, options);
21-
this.name = name;
22-
this.lastModified = options?.lastModified ?? Date.now();
23-
}
24-
} as typeof File;
25-
26-
(async () => {
27-
let FileConstructor: typeof File;
28-
try {
29-
FileConstructor = (await import("node:buffer")).File as typeof File;
30-
} catch {
31-
FileConstructor = fallbackFile;
32-
}
15+
let FileConstructor: typeof File;
16+
try {
17+
const { File: NodeFile } = await import("node:buffer");
18+
FileConstructor = NodeFile as typeof File;
19+
} catch {
20+
FileConstructor = class File extends Blob {
21+
name: string;
22+
lastModified: number;
23+
24+
constructor(bits: BlobPart[], name: string, options?: FilePropertyBag) {
25+
super(bits, options);
26+
this.name = name;
27+
this.lastModified = options?.lastModified ?? Date.now();
28+
}
29+
} as typeof File;
30+
}
3331

34-
if (!globalThis.File) {
35-
globalThis.File = FileConstructor;
36-
}
37-
})();
32+
if (!globalThis.File) {
33+
globalThis.File = FileConstructor;
34+
}
3835

3936
interface RecordingSession {
4037
id: string;

0 commit comments

Comments
 (0)