Read content of RAR files using C#
Asked Answered
C

6

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.

Chong answered 22/6, 2009 at 7:21 Comment(2)
Dupe #12237Russia
He just want to unpack i want to read the content like a stream....Chong
O
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

Orgel answered 22/6, 2009 at 7:42 Comment(0)
A
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);

                    }
Autoerotism answered 3/6, 2016 at 10:8 Comment(1)
OP explicitly said they did not want to write to diskUnswerving
K
1

Chilkat Rar library

More specific: link

Keos answered 22/6, 2009 at 7:30 Comment(2)
Nope. All the examples I looked at was extract to disk.Bader
That does not read it like a stream is just reads the content file names and puts them in a text boxChong
O
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.

Overcoat answered 4/2, 2011 at 9:46 Comment(1)
This is what i am using currently! thanks alot for a great product!Chong
M
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.

Makings answered 2/2, 2011 at 10:38 Comment(0)
O
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.

Owings answered 1/4, 2011 at 11:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.