feat(archive): add rar extraction support

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-01 12:55:10 +02:00
co-authored by Claude Sonnet 5
parent a66143d312
commit ceddeddf3e
6 changed files with 60 additions and 0 deletions
+29
View File
@@ -228,3 +228,32 @@ describe('archive converters — 7z and tar.7z', () => {
20000
);
});
describe('archive converters — rar (extraction only)', () => {
it('lists rar as a source with the other 6 archive formats as targets, and never lists rar as a target for anything', () => {
const targets = listTargetFormats('rar');
expect(targets.sort()).toEqual(['7z', 'tar', 'tar.7z', 'tar.bz2', 'tar.gz', 'zip'].sort());
expect(listTargetFormats('zip')).not.toContain('rar');
});
it('converts the sample.rar fixture to zip', async () => {
const rarPath = path.join(import.meta.dirname, '..', 'fixtures', 'sample.rar');
const outputPath = path.join(tmpDir, 'from-rar.zip');
const entry = resolve('rar', 'zip');
await entry.convert(rarPath, outputPath);
const outZip = new AdmZip(outputPath);
expect(outZip.getEntries().length).toBeGreaterThan(0);
});
});
describe('archive converters — full registration matrix', () => {
it('registers all 42 source/target pairs (7 sources x 6 targets)', () => {
const sources = ['zip', 'tar', 'tar.gz', 'tar.bz2', '7z', 'tar.7z', 'rar'];
const targets = ['zip', 'tar', 'tar.gz', 'tar.bz2', '7z', 'tar.7z'];
for (const source of sources) {
expect(listTargetFormats(source).sort()).toEqual(targets.sort());
}
});
});