adamhathcock / sharpcompress

SharpCompress is a fully managed C# library to deal with many compression types and formats.
MIT License
2.25k stars 479 forks source link

Question: Does this have 7zip reader? #867

Open 0x5bfa opened 3 weeks ago

0x5bfa commented 3 weeks ago

I'm finding a room to implement 7zip writer using managed-lzma and during walking through the code base I found 7zip reader while FORMATS.md says N/A

Code was added intially 11 years ago but the table of FORMATS.md updated 2 years ago.

https://github.com/adamhathcock/sharpcompress/blob/8de33f0db3ad09f85fe96e953418935d05186aa6/src/SharpCompress/Archives/SevenZip/SevenZipArchive.cs#L202-L254

https://github.com/adamhathcock/sharpcompress/blob/8de33f0db3ad09f85fe96e953418935d05186aa6/FORMATS.md?plain=1#L21

7zip reader exists or still missing?

adamhathcock commented 3 weeks ago

There is no 7ZipReader interface becase 7Zip doesn't support forward only. It requires random access to the stream which is against the reader interface. Internally, 7Zip is made of streams that are forward only

0x5bfa commented 2 weeks ago

Thanks for the reply and understood.

I have a couple of questions:

I have been looking for alternative to SevenZipSharp as it is slow to integrate in order to use files-community/Files. This looks great and I'd like to contribute 7zip parts.

managed-lzma reader and writer impl: https://github.com/weltkante/managed-lzma/tree/master/shared/SevenZip

adamhathcock commented 1 week ago

I believe we still use the managed LZMA internally. I don't want native dependencies.

I don't believe anything supports forward only always because it's against the 7Zip spec. Which is why it's il-suited, imo. 7Zip always wants random access which usually means a file.