File tree 1 file changed +4
-19
lines changed
1 file changed +4
-19
lines changed Original file line number Diff line number Diff line change @@ -75,26 +75,11 @@ <h1>Package File Browser</h1>
7575
7676async function extractFiles ( arrayBuffer , url ) {
7777 const files = [ ] ;
78-
79- if ( url . endsWith ( '.zip' ) ) {
80- const zip = await JSZip . loadAsync ( arrayBuffer ) ;
81- for ( const [ name , file ] of Object . entries ( zip . files ) ) {
82- const content = await file . async ( 'text' ) ;
83- files . push ( { name, content } ) ;
84- }
85- } else if ( url . endsWith ( '.tar.gz' ) ) {
86- alert ( 'tar not supported yet' ) ;
87- } else if ( url . endsWith ( '.whl' ) ) {
88- // Wheel files are zip files with a specific structure
89- const zip = await JSZip . loadAsync ( arrayBuffer ) ;
90- for ( const [ name , file ] of Object . entries ( zip . files ) ) {
91- const content = await file . async ( 'text' ) ;
92- files . push ( { name, content } ) ;
93- }
94- } else {
95- throw new Error ( 'Unsupported file type' ) ;
78+ const zip = await JSZip . loadAsync ( arrayBuffer ) ;
79+ for ( const [ name , file ] of Object . entries ( zip . files ) ) {
80+ const content = await file . async ( 'text' ) ;
81+ files . push ( { name, content } ) ;
9682 }
97-
9883 return files ;
9984}
10085</ script >
You can’t perform that action at this time.
0 commit comments