Skip to content

Commit 6025f62

Browse files
authored
Simplified
1 parent 429eb88 commit 6025f62

File tree

1 file changed

+4
-19
lines changed

1 file changed

+4
-19
lines changed

zip-wheel-explorer.html

+4-19
Original file line numberDiff line numberDiff line change
@@ -75,26 +75,11 @@ <h1>Package File Browser</h1>
7575

7676
async 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>

0 commit comments

Comments
 (0)