Skip to content

armgit / Filee

Public Imported from GitHub
0

Free, open-source file converter. Convert 263 formats offline by drag & drop — images, PDF, Word, Excel, PowerPoint, HWP/HWPX, video, audio, e-books and archives. No upload, no Office needed.

feat(archives): unpack split multi-part archives (.001) (#653)

Armone7894f008e67c
diff --git a/docs/ENGINES.md b/docs/ENGINES.md
index c76957ad..96e74862 100644
--- a/docs/ENGINES.md
+++ b/docs/ENGINES.md
@@ -29,7 +29,7 @@ Filee chooses engines automatically. Settings → *Engines* shows their status,
| 3D models (SharpGLTF for glTF) | built in (library) | **GLB, glTF, STL, OBJ (+ MTL), 3MF, PLY ↔ each other**; FBX → each of them; → PNG, JPG, … (an isometric preview) |
| **Geospatial vector data** | built in | **GeoJSON, KML, KMZ, GPX, Shapefile ↔ each other and CSV** (longitude / latitude or WKT); Garmin FIT (activities, read only) → each of them and CSV; projected Shapefiles (UTM, Web Mercator, Lambert, Albers) are converted to WGS 84; through CSV to XLSX, JSON, … (see below) |
| rhwp | bundled with the installer (`engines/rhwp`, with the Microsoft C++ runtime, see below) | HWP/HWPX → PDF, **HWP → HWPX, HWPX → HWP** |
-| Archives (7-Zip) | bundled with the installer (`engines/7zip`, ~2.5 MB) + built-in readers | ZIP (including ANSYS Workbench WBPZ), 7Z, RAR, TAR (+ GZ/BZ2/XZ/Z/7Z/LZ), CAB, ISO, DMG, … **→ folder, ZIP, 7Z, TAR, TAR.GZ/BZ2/XZ**; ALZ, EGG, lzip read in-process; "Compress into one archive" for any files |
+| Archives (7-Zip) | bundled with the installer (`engines/7zip`, ~2.5 MB) + built-in readers | ZIP (including ANSYS Workbench WBPZ), 7Z, RAR, TAR (+ GZ/BZ2/XZ/Z/7Z/LZ), CAB, ISO, DMG, split (.001), … **→ folder, ZIP, 7Z, TAR, TAR.GZ/BZ2/XZ**; ALZ, EGG, lzip read in-process; "Compress into one archive" for any files |
| LibreOffice + H2Orestart + Java | **optional download** (~420 MB, 1.3 GB on disk) | older and rare formats only: DOC, XLS, PPT, RTF and OpenDocument → PDF and to each other, output as DOCX/ODT/ODS/ODP; HWP/HWPX → DOCX/ODT; read-only formats (see below) → PDF and their kind's editable formats; FODT, OpenDocument templates (OTT, OTS, OTP) and XLT out; SVG → EMF/WMF/ODG, a PDF page → SVG |
| Pandoc | **optional download** (~42 MB, 240 MB on disk) | Markdown ↔ DOCX/ODT/RTF, DOCX/ODT/HTML/RTF → Markdown, HTML ↔ DOCX/ODT, markup languages (reStructuredText, LaTeX, Org, AsciiDoc, Typst, MediaWiki, DocBook, Jupyter, Textile, man, OPML) ↔ Markdown/HTML/DOCX/ODT and each other (and → RTF, EPUB, TXT), Markdown and markup → PPTX slides |
| Ghostscript | **optional download** (~20 MB, 31 MB on disk) | EPS/PS → PDF, PDF → EPS/PS, PostScript-based AI → PDF (images through PDF and PDFium); smaller PDFs when a preset asks for it |
@@ -1326,6 +1326,7 @@ bundled with the installer), never a 7-Zip installed on the PC. It runs as a sep
| GZ, BZ2, XZ | 7-Zip | 7-Zip; one file only (from another single-file format, or "Compress into one archive" with one file) |
| LZMA, Z | 7-Zip | — |
| RAR 4/5, CAB, CPIO, DEB, RPM, DMG, ISO, IMG, LHA/LZH, ARJ | 7-Zip (an RPM's payload is unpacked until the files appear) | — |
+| Split archives (.001, .7z.001, .zip.001, .tar.001) | 7-Zip (combining .002, .003 … automatically) | — |
| ALZ (ALZip) | Filee: store, deflate and ALZip's bzip2 variant | — |
| EGG (ALZip) | Filee: store, deflate, bzip2, LZMA (decoded by 7-Zip); several blocks per file | — |
diff --git a/src/Filee.Core/Formats/FormatRegistry.cs b/src/Filee.Core/Formats/FormatRegistry.cs
index ad752f1c..3774a7ed 100644
--- a/src/Filee.Core/Formats/FormatRegistry.cs
+++ b/src/Filee.Core/Formats/FormatRegistry.cs
@@ -299,6 +299,7 @@ public static class FormatRegistry
new("arj", "ARJ", FormatCategory.Archive, ["arj"], Writable: false),
new("alz", "ALZ", FormatCategory.Archive, ["alz"], Writable: false),
new("egg", "EGG", FormatCategory.Archive, ["egg"], Writable: false),
+ new("split", "Split Archive", FormatCategory.Archive, ["001", "7z.001", "zip.001", "tar.001"], Writable: false),
new(Folder, "Folder", FormatCategory.Archive, [""]),
// CAD
diff --git a/src/Filee.Engines/Archives/ArchiveExtractor.cs b/src/Filee.Engines/Archives/ArchiveExtractor.cs
index 69add2d0..60a8aa7e 100644
--- a/src/Filee.Engines/Archives/ArchiveExtractor.cs
+++ b/src/Filee.Engines/Archives/ArchiveExtractor.cs
@@ -13,7 +13,7 @@ internal sealed class ArchiveExtractor(SevenZip? sevenZip)
public static readonly IReadOnlyList<string> SevenZipFormats =
[
"zip", "jar", "7z", "rar", "tar", "tgz", "tbz2", "txz", "tar7z", "tz", "gz", "bz2", "xz", "lzma", "z",
- "cab", "cpio", "deb", "rpm", "dmg", "iso", "img", "lha", "arj",
+ "cab", "cpio", "deb", "rpm", "dmg", "iso", "img", "lha", "arj", "split",
];
/// <summary>Formats read by Filee's own code (lzip still needs 7-Zip's LZMA decoder).</summary>
diff --git a/tests/Filee.Core.Tests/OutputPathResolverTests.cs b/tests/Filee.Core.Tests/OutputPathResolverTests.cs
index 178c8b8a..0e52b646 100644
--- a/tests/Filee.Core.Tests/OutputPathResolverTests.cs
+++ b/tests/Filee.Core.Tests/OutputPathResolverTests.cs
@@ -33,6 +33,12 @@ public class OutputPathResolverTests
Assert.Equal("tar.gz", FormatRegistry.ExtensionOf(source));
Assert.Equal("gz", FormatRegistry.ExtensionOf("notes.txt.gz"));
Assert.Equal("notes.txt", FormatRegistry.NameWithoutExtension("notes.txt.gz"));
+ Assert.Equal("split", FormatRegistry.Detect("archive.7z.001")!.Id);
+ Assert.Equal("7z.001", FormatRegistry.ExtensionOf("archive.7z.001"));
+ Assert.Equal("archive", FormatRegistry.NameWithoutExtension("archive.7z.001"));
+ Assert.Equal("split", FormatRegistry.Detect("archive.001")!.Id);
+ Assert.Equal("001", FormatRegistry.ExtensionOf("archive.001"));
+ Assert.Equal("archive", FormatRegistry.NameWithoutExtension("archive.001"));
Assert.Equal("mp4", FormatRegistry.Detect("clip.MP4")!.Id);
Assert.Null(FormatRegistry.Detect("README"));
}
diff --git a/tests/Filee.Core.Tests/SmallParsersTests.cs b/tests/Filee.Core.Tests/SmallParsersTests.cs
index a4bec326..395bd0b6 100644
--- a/tests/Filee.Core.Tests/SmallParsersTests.cs
+++ b/tests/Filee.Core.Tests/SmallParsersTests.cs
@@ -31,6 +31,10 @@ public class FormatRegistryTests
[InlineData("anim.apng", "apng")]
[InlineData("scan.dicom", "dcm")]
[InlineData("texture.rgb", "sgi")]
+ [InlineData("archive.001", "split")]
+ [InlineData("archive.7z.001", "split")]
+ [InlineData("archive.zip.001", "split")]
+ [InlineData("archive.tar.001", "split")]
public void Detects_formats(string path, string id) => Assert.Equal(id, FormatRegistry.Detect(path)?.Id);
[Fact]
diff --git a/tests/Filee.Engines.Tests/ArchiveTests.cs b/tests/Filee.Engines.Tests/ArchiveTests.cs
index 2bbdb187..4dd7678a 100644
--- a/tests/Filee.Engines.Tests/ArchiveTests.cs
+++ b/tests/Filee.Engines.Tests/ArchiveTests.cs
@@ -56,6 +56,7 @@ public class ArchiveTests(EngineFixture fx) : IClassFixture<EngineFixture>
[InlineData("egg")]
[InlineData("lz")]
[InlineData("tlz")]
+ [InlineData("split")]
public void Every_readable_archive_converts_in_one_step(string from)
{
var planner = fx.Catalog.CreatePlanner(["archive"]);
@@ -192,6 +193,26 @@ public class ArchiveTests(EngineFixture fx) : IClassFixture<EngineFixture>
Assert.Equal(Snapshot(tree), Snapshot(folder)); // files, not a lone backup.tar
}
+ [Fact]
+ public async Task Split_archive_001_extracts_all_volumes()
+ {
+ SkipWithout7Zip();
+ var dir = fx.NewFolder();
+ var content = "This is a split multi-part archive test payload."u8.ToArray();
+ var file = Path.Combine(dir, "document.txt");
+ await File.WriteAllBytesAsync(file, content, Ct);
+ var split7z = Path.Combine(dir, "split_archive.7z");
+ await Run7zAsync("a", "-t7z", "-v20b", split7z, file);
+ File.Delete(file);
+
+ var firstPart = Path.Combine(dir, "split_archive.7z.001");
+ Assert.True(File.Exists(firstPart));
+ Assert.True(File.Exists(Path.Combine(dir, "split_archive.7z.002")));
+
+ var folder = (await ConvertOkAsync(firstPart, Extract)).Outputs.Single();
+ Assert.Equal(content, await File.ReadAllBytesAsync(Path.Combine(folder, "document.txt"), Ct));
+ }
+
[Fact]
public async Task Extract_with_overwrite_merges_into_the_existing_folder_and_skip_leaves_it_alone()
{