mirror of
https://github.com/xlmnxp/extractify.zip.git
synced 2025-04-02 07:44:55 +03:00
add(#10): support tar.gz format by workaround
This commit is contained in:
parent
ffc453f93a
commit
25554d7fe8
@ -20,6 +20,7 @@ export class SevenZipManager {
|
||||
sevenZip?: SevenZipModule;
|
||||
consoleOutputBuffer: string[] = [];
|
||||
archiveName: string = "";
|
||||
originalName: string = "";
|
||||
|
||||
constructor() {
|
||||
this.init();
|
||||
@ -47,7 +48,8 @@ export class SevenZipManager {
|
||||
async loadArchive(file: File) {
|
||||
if (!this.sevenZip) return;
|
||||
|
||||
this.archiveName = file.name;
|
||||
this.originalName = file.name;
|
||||
this.archiveName = file.name.toLocaleLowerCase();
|
||||
|
||||
const stream = this.sevenZip.FS.open(this.archiveName, "w+");
|
||||
let archiveData = new Uint8Array(await file.arrayBuffer());
|
||||
@ -55,6 +57,12 @@ export class SevenZipManager {
|
||||
this.sevenZip.FS.write(stream, archiveData, 0, archiveData.byteLength);
|
||||
this.sevenZip.FS.close(stream);
|
||||
|
||||
// workaround to support tar.gz formats
|
||||
if (this.archiveName.endsWith(".tar.gz")) {
|
||||
this.execute(["x", "-y", this.archiveName, `-o${this.archiveName.replace(".tar.gz", ".tar")}`]);
|
||||
this.archiveName = this.archiveName.replace(".tar.gz", ".tar");
|
||||
}
|
||||
|
||||
// 7zip get files list
|
||||
let filesString = this.execute(["l", "-ba", this.archiveName]);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user