SharpCompress.Archives.ArchiveFactory.IsArchive(Stream, out ArchiveType?) is private #570

Closed
opened 2026-01-29 22:13:55 +00:00 by claunia · 0 comments
Owner

Originally created by @AlissaSabre on GitHub (May 10, 2023).

Issue description

We sometimes need to know whether a particular file is an archive of some kind or not an archive. If it is a plain file on the filesystem, SharpCompress provides SharpCompress.Archives.ArchiveFactory.IsArchive(string, out ArchiveType?) for the purpose. If it is not a file on the filesystem, e.g., it is an in-memory data or a part of a file on the filesystem embedded in a larger file format, the IsArchive(string, out ArchiveType?) doesn't work, unless we first write the data into a single temporary file.

The SharpCompress.Archives.ArchiveFactory class has another method IsArchive(Stream, out ArchiveType?), whch just fits the purpose. However, the IsArchive(Stream, out ArchiveType?) method is private and not available for user programs.

I consider it is a bug (or a design flaw.)

Proposed solution

Make SharpCompress.Archives.ArchiveFactory.IsArchive(Stream, out ArchiveType?) public.

Originally created by @AlissaSabre on GitHub (May 10, 2023). ## Issue description We sometimes need to know whether a particular file is an archive of some kind or not an archive. If it is a plain file on the filesystem, SharpCompress provides `SharpCompress.Archives.ArchiveFactory.IsArchive(string, out ArchiveType?)` for the purpose. If it is _not_ a file on the filesystem, e.g., it is an in-memory data or a _part_ of a file on the filesystem embedded in a larger file format, the `IsArchive(string, out ArchiveType?)` doesn't work, unless we first write the data into a single temporary file. The `SharpCompress.Archives.ArchiveFactory` class has another method `IsArchive(Stream, out ArchiveType?)`, whch just fits the purpose. However, the `IsArchive(Stream, out ArchiveType?)` method is private and not available for user programs. I consider it is a bug (or a design flaw.) ## Proposed solution Make `SharpCompress.Archives.ArchiveFactory.IsArchive(Stream, out ArchiveType?)` public.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#570