File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,7 +10,8 @@ import type { Config } from '../../config/schema';
1010import type { GlobalFlags } from '../../types/flags' ;
1111import type { FileUploadResponse } from '../../types/api' ;
1212import { existsSync } from 'fs' ;
13- import { resolve } from 'path' ;
13+ import { readFile } from 'fs/promises' ;
14+ import { resolve , basename } from 'path' ;
1415
1516export default defineCommand ( {
1617 name : 'file upload' ,
@@ -53,9 +54,9 @@ export default defineCommand({
5354 }
5455
5556 const formData = new FormData ( ) ;
56- // Read file as a Blob-like File object for fetch compatibility
57- const fileData = await Bun . file ( fullPath ) . arrayBuffer ( ) ;
58- const fileName = fullPath . split ( '/' ) . pop ( ) || 'file' ;
57+ // Read file using Node.js fs/promises (compatible with both Node and Bun)
58+ const fileData = await readFile ( fullPath ) ;
59+ const fileName = basename ( fullPath ) ;
5960 const fileBlob = new Blob ( [ fileData ] ) ;
6061 formData . append ( 'file' , fileBlob , fileName ) ;
6162 formData . append ( 'purpose' , purpose ) ;
Original file line number Diff line number Diff line change @@ -4,6 +4,10 @@ import { maskToken } from '../utils/token';
44
55let printed = false ;
66
7+ export function resetStatusBar ( ) : void {
8+ printed = false ;
9+ }
10+
711const reset = '\x1b[0m' ;
812const dim = '\x1b[2m' ;
913const bold = '\x1b[1m' ;
You can’t perform that action at this time.
0 commit comments