-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
help wantedExtra attention is neededExtra attention is needed
Description
allow decompressing, as this serves both to load game roms and fonts from other sites.
I'm trying to use DecompressionStream
but I still don't understand how to use the API.
export function isDeflate(fileContent: string): boolean {
return fileContent.slice(0, 2) == 'PK'
}
export async function fileFromDeflate(fileContent: string): Promise<string> {
const zipData = Uint8Array.from(fileContent, (c) => c.charCodeAt(0));
console.log(zipData)
// @ts-ignore
const decompressionStream = new DecompressionStream('deflate');
const response = new Response(zipData);
console.log(response)
// @ts-ignore
const unzippedStream = response.body.pipeThrough(decompressionStream);
const unzippedText = await new Response(unzippedStream).blob();
return unzippedText.text();
}
Metadata
Metadata
Assignees
Labels
help wantedExtra attention is neededExtra attention is needed