File tree Expand file tree Collapse file tree 1 file changed +19
-22
lines changed
Expand file tree Collapse file tree 1 file changed +19
-22
lines changed Original file line number Diff line number Diff 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
3936interface RecordingSession {
4037 id : string ;
You can’t perform that action at this time.
0 commit comments