11import assert from 'node:assert/strict'
2- import { Buffer } from 'node:buffer'
2+ import { Buffer , File } from 'node:buffer'
33import { createServer } from 'node:http'
44import { describe , it } from 'node:test'
55import { App } from '@tinyhttp/app'
@@ -355,7 +355,7 @@ describe('Multipart', () => {
355355 it ( 'should parse multipart with files' , async ( ) => {
356356 const fd = new FormData ( )
357357 const file = new File ( [ 'hello world' ] , 'hello.txt' , { type : 'text/plain' } )
358- fd . set ( 'file' , file )
358+ fd . set ( 'file' , file as globalThis . File )
359359 const server = createServer ( async ( req : ReqWithBody < { file : [ File ] } > , res ) => {
360360 await multipart ( ) ( req , res , ( err ) => err && console . log ( err ) )
361361
@@ -382,8 +382,8 @@ describe('Multipart', () => {
382382 new File ( [ 'bye world' ] , 'bye.txt' , { type : 'text/plain' } )
383383 ]
384384
385- fd . set ( 'file1' , files [ 0 ] as Blob )
386- fd . set ( 'file2' , files [ 1 ] as Blob )
385+ fd . set ( 'file1' , files [ 0 ] as globalThis . File )
386+ fd . set ( 'file2' , files [ 1 ] as globalThis . File )
387387
388388 const server = createServer ( async ( req : ReqWithBody < { file1 : [ File ] ; file2 : [ File ] } > , res ) => {
389389 await multipart ( ) ( req , res , ( err ) => err && console . log ( err ) )
@@ -407,7 +407,7 @@ describe('Multipart', () => {
407407 it ( 'should support binary files' , async ( ) => {
408408 const fd = new FormData ( )
409409 const file = new File ( [ new Uint8Array ( [ 1 , 2 , 3 ] ) ] , 'blob.bin' , { type : 'application/octet-stream' } )
410- fd . set ( 'file' , file as Blob )
410+ fd . set ( 'file' , file as globalThis . File )
411411
412412 const server = createServer ( async ( req : ReqWithBody < { file : [ File ] } > , res ) => {
413413 await multipart ( ) ( req , res , ( err ) => err && console . log ( err ) )
@@ -497,8 +497,8 @@ describe('Limits', () => {
497497
498498 const fd = new FormData ( )
499499
500- fd . set ( 'file1' , new File ( [ 'hello world' ] , 'hello.txt' , { type : 'text/plain' } ) as Blob )
501- fd . set ( 'file2' , new File ( [ 'bye world' ] , 'bye.txt' , { type : 'text/plain' } ) as Blob )
500+ fd . set ( 'file1' , new File ( [ 'hello world' ] , 'hello.txt' , { type : 'text/plain' } ) as globalThis . File )
501+ fd . set ( 'file2' , new File ( [ 'bye world' ] , 'bye.txt' , { type : 'text/plain' } ) as globalThis . File )
502502
503503 await makeFetch ( server ) ( '/' , {
504504 body : fd ,
@@ -516,7 +516,7 @@ describe('Limits', () => {
516516
517517 const fd = new FormData ( )
518518
519- fd . set ( 'file' , new File ( [ 'hello world' ] , 'hello.txt' , { type : 'text/plain' } ) as Blob )
519+ fd . set ( 'file' , new File ( [ 'hello world' ] , 'hello.txt' , { type : 'text/plain' } ) as globalThis . File )
520520
521521 await makeFetch ( server ) ( '/' , {
522522 body : fd ,
@@ -536,7 +536,7 @@ describe('Limits', () => {
536536
537537 const fd = new FormData ( )
538538
539- fd . set ( 'file' , new File ( [ 'hello world to everyone' ] , 'hello.txt' , { type : 'text/plain' } ) as Blob )
539+ fd . set ( 'file' , new File ( [ 'hello world to everyone' ] , 'hello.txt' , { type : 'text/plain' } ) as globalThis . File )
540540
541541 await makeFetch ( server ) ( '/' , {
542542 body : fd ,
0 commit comments