12

Is there any way to read the content of a RAR file (support for multi-file RAR is a must)?

I don't want to extract the content to the disk, just read it like a stream.

ThinkingStiff
  • 64,767
  • 30
  • 146
  • 239
Peter
  • 37,042
  • 39
  • 142
  • 198

6 Answers6

13

Low level lib to work with 7z.dll (supports rar archives, incliding multi-part, works with .net streams):

C# (.net) interface for 7-Zip archive dlls

And more high-level lib based on the first one:

SevenZipSharp

arbiter
  • 9,447
  • 1
  • 32
  • 43
2

Install NUnrar from nuget

RarArchive file = RarArchive.Open("rar file path");//@"C:\test.rar"
                    foreach (RarArchiveEntry rarFile in file.Entries)
                    {
                        string path = "extracted file path";//@"C:\"
                        rarFile.WriteToDirectory(path);

                    }
Syam Kumar
  • 343
  • 5
  • 16
1

Chilkat Rar library

More specific: link

RvdK
  • 19,580
  • 4
  • 64
  • 107
1

My unrar project, http://nunrar.codeplex.com/ aims to be very .NETty and has streaming support. If you need something else, please suggest or give me a patch.

adamhathcock
  • 313
  • 1
  • 7
0

Another possibility is using including the rar command-line executable as application ressource and call it via System.Diagnostics.Process.

You may want to redirect the input/output stream.

Stefan Steiger
  • 78,642
  • 66
  • 377
  • 442
0

If you want to directly access files stored in uncompressed rar files, then this answer might be of use.

ReScene is a project for recreating rar archives from the extracted files. You need a .srr file for this. The source code is available. You may want to take a look at RarStream.cs.

Community
  • 1
  • 1
Gfy
  • 8,173
  • 3
  • 26
  • 46