-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: correct invalid extensions when raw-copying archives (#1128)
- Loading branch information
Showing
16 changed files
with
311 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import File, { FileProps } from '../file.js'; | ||
import Archive from './archive.js'; | ||
|
||
export default class ArchiveFile extends File { | ||
private readonly archive: Archive; | ||
|
||
public constructor(archive: Archive, fileProps: FileProps) { | ||
super(fileProps); | ||
this.archive = archive; | ||
} | ||
|
||
getArchive(): Archive { | ||
return this.archive; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import SevenZip from './sevenZip.js'; | ||
|
||
export default class Gzip extends SevenZip { | ||
// eslint-disable-next-line class-methods-use-this | ||
protected new(filePath: string): SevenZip { | ||
return new Gzip(filePath); | ||
} | ||
|
||
static getExtensions(): string[] { | ||
return ['.gz', '.gzip']; | ||
} | ||
|
||
// eslint-disable-next-line class-methods-use-this | ||
getExtension(): string { | ||
return Gzip.getExtensions()[0]; | ||
} | ||
|
||
static getFileSignatures(): Buffer[] { | ||
return [Buffer.from('1F8B', 'hex')]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import SevenZip from './sevenZip.js'; | ||
|
||
export default class Z extends SevenZip { | ||
// eslint-disable-next-line class-methods-use-this | ||
protected new(filePath: string): SevenZip { | ||
return new Z(filePath); | ||
} | ||
|
||
static getExtensions(): string[] { | ||
return ['.z']; | ||
} | ||
|
||
// eslint-disable-next-line class-methods-use-this | ||
getExtension(): string { | ||
return Z.getExtensions()[0]; | ||
} | ||
|
||
static getFileSignatures(): Buffer[] { | ||
return [ | ||
Buffer.from('1F9D', 'hex'), // LZW compression | ||
Buffer.from('1FA0', 'hex'), // LZH compression | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import SevenZip from './sevenZip.js'; | ||
|
||
export default class ZipSpanned extends SevenZip { | ||
// eslint-disable-next-line class-methods-use-this | ||
protected new(filePath: string): SevenZip { | ||
return new ZipSpanned(filePath); | ||
} | ||
|
||
static getExtensions(): string[] { | ||
return ['.zip.001', '.z01']; | ||
} | ||
|
||
// eslint-disable-next-line class-methods-use-this | ||
getExtension(): string { | ||
return ZipSpanned.getExtensions()[0]; | ||
} | ||
|
||
static getFileSignatures(): Buffer[] { | ||
return [Buffer.from('504B0708', 'hex')]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import path from 'node:path'; | ||
|
||
import SevenZip from './sevenZip.js'; | ||
|
||
export default class ZipX extends SevenZip { | ||
// eslint-disable-next-line class-methods-use-this | ||
protected new(filePath: string): SevenZip { | ||
return new ZipX(filePath); | ||
} | ||
|
||
static getExtensions(): string[] { | ||
return ['.zipx', '.zx01']; | ||
} | ||
|
||
// eslint-disable-next-line class-methods-use-this | ||
getExtension(): string { | ||
return path.parse(this.getFilePath()).ext; | ||
} | ||
|
||
static getFileSignatures(): Buffer[] { | ||
return []; | ||
} | ||
} |
Oops, something went wrong.