feat(archive): add tar.bz2 converter via 7za

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-01 12:52:29 +02:00
co-authored by Claude Sonnet 5
parent c9251e66e2
commit a76b10a43f
4 changed files with 85 additions and 2 deletions
+28
View File
@@ -133,3 +133,31 @@ describe('archive converters — tar / tar.gz', () => {
await fs.rm(listDir, { recursive: true, force: true });
});
});
describe('archive converters — tar.bz2', () => {
it('registers tar.bz2 as a target for tar and vice versa', () => {
expect(listTargetFormats('tar')).toContain('tar.bz2');
expect(listTargetFormats('tar.bz2')).toContain('tar');
});
it(
'converts zip -> tar.bz2 -> tar, preserving content',
async () => {
const zipPath = path.join(tmpDir, 'for-bz2.zip');
buildZipFixture(zipPath);
const bz2Path = path.join(tmpDir, 'output.tar.bz2');
await resolve('zip', 'tar.bz2').convert(zipPath, bz2Path, { quality: 9 });
const backToTarPath = path.join(tmpDir, 'from-bz2.tar');
await resolve('tar.bz2', 'tar').convert(bz2Path, backToTarPath);
const listDir = await fs.mkdtemp(path.join(os.tmpdir(), 'bz2-check-'));
await tar.extract({ file: backToTarPath, cwd: listDir });
expect(await fs.readFile(path.join(listDir, 'hello.txt'), 'utf8')).toBe('hello world');
expect(await fs.readFile(path.join(listDir, 'nested', 'inner.txt'), 'utf8')).toBe('nested content');
await fs.rm(listDir, { recursive: true, force: true });
},
20000
);
});