File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -476,13 +476,26 @@ export class File extends Inode {
476476 readonly : boolean ;
477477
478478 constructor (
479- data : ArrayBuffer | SharedArrayBuffer | Uint8Array | Array < number > ,
479+ data : ArrayBufferLike | ArrayLike < number > ,
480480 options ?: Partial < {
481481 readonly : boolean ;
482482 } > ,
483483 ) {
484484 super ( ) ;
485- this . data = new Uint8Array ( data ) ;
485+ this . data = ( ( ) => {
486+ if ( data instanceof ArrayBuffer ) {
487+ return new Uint8Array ( data ) ;
488+ }
489+
490+ if (
491+ typeof SharedArrayBuffer !== "undefined" &&
492+ data instanceof SharedArrayBuffer
493+ ) {
494+ return new Uint8Array ( new Uint8Array ( data ) ) ;
495+ }
496+
497+ return new Uint8Array ( data as ArrayLike < number > ) ;
498+ } ) ( ) ;
486499 this . readonly = ! ! options ?. readonly ;
487500 }
488501
You can’t perform that action at this time.
0 commit comments