feat: zip reader

This commit is contained in:
TrèsAbhi committed 2025-11-29 14:34:06 -06:00
1 parent 2101dba7c6
commit f33a73e1bb
9 files changed
+59 -5

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
import { HTTPRangeReader, unzip, ZipEntry } from "unzipit";
import { AbstractVFS } from "./abstract";
export class ZipVFS extends AbstractVFS {
entries: Record<string, ZipEntry> = {};
constructor(private url: string, private root = "app/") {
super();
}
async init() {
const reader = new HTTPRangeReader(this.url);
const { entries } = await unzip(reader);
for (const entry of Object.values(entries)) {
this.entries[entry.name.slice(this.root.length)] = entry;
}
return this;
}
}