88 * [API Reference]: https://github.com/a179346/nextjs-chunk-upload-action/blob/main/docs/api-reference.md
99 */
1010
11+ export interface FileLike {
12+ readonly size : number ;
13+ slice ( start ?: number , end ?: number , contentType ?: string ) : Blob ;
14+ }
15+
1116export type Primitive = string | boolean | number | undefined | null ;
1217
1318export type Metadata = Record < string , Primitive > ;
@@ -27,7 +32,7 @@ export type ChunkUploadHandler<TMetadata extends Metadata = Metadata> = (
2732) => Promise < void > ;
2833
2934export interface ChunkUploaderOptions < TMetadata extends Metadata > {
30- file : File ;
35+ file : FileLike ;
3136 /**
3237 * The function that defines how the chunk is uploaded to the server.
3338 */
@@ -200,7 +205,7 @@ export class ChunkUploader<TMetadata extends Metadata> {
200205 protected _position : number ;
201206 protected _error ?: unknown ;
202207
203- protected readonly _file : File ;
208+ protected readonly _file : FileLike ;
204209 protected readonly _onChunkUpload : ChunkUploadHandler < TMetadata > ;
205210 protected readonly _chunkBytes : number ;
206211 protected readonly _metadata : Readonly < TMetadata > ;
@@ -271,7 +276,6 @@ export class ChunkUploader<TMetadata extends Metadata> {
271276
272277 protected _validateOptions ( options : ChunkUploaderOptions < TMetadata > ) {
273278 if ( ! options . file ) throw new Error ( 'File is required' ) ;
274- if ( ! ( options . file instanceof File ) ) throw new Error ( 'File must be an instance of File' ) ;
275279
276280 if ( typeof options . onChunkUpload !== 'function' )
277281 throw new Error ( 'onChunkUpload must be a function' ) ;
0 commit comments