[Question] Multi-volume rar streaming #598

Open
opened 2026-01-29 22:14:22 +00:00 by claunia · 3 comments
Owner

Originally created by @Xodaru on GitHub (Nov 1, 2023).

In a presentation you did at Dot Net Sheff back in 2018 you mentioned one of the use cases of SharpCompress was to mount ISOs as an image when they are spanned across multiple RAR files.

I am trying to wrap my head around this to do something similar but struggling to read a file that spans multiple rar files.
Do you have an example on how this was achieved?

Part of the problem I have is the stream is not seek'able as with my use case I know exactly what offset of the file I want to start extracting from. I can only send data when its requested, not in a continuous stream thus I have to work with offsets.
I'm guessing an ISO mount implementation of this would be somewhat similar.

Originally created by @Xodaru on GitHub (Nov 1, 2023). In a presentation you did at Dot Net Sheff back in 2018 you mentioned one of the use cases of SharpCompress was to mount ISOs as an image when they are spanned across multiple RAR files. I am trying to wrap my head around this to do something similar but struggling to read a file that spans multiple rar files. Do you have an example on how this was achieved? Part of the problem I have is the stream is not seek'able as with my use case I know exactly what offset of the file I want to start extracting from. I can only send data when its requested, not in a continuous stream thus I have to work with offsets. I'm guessing an ISO mount implementation of this would be somewhat similar.
claunia added the question label 2026-01-29 22:14:22 +00:00
Author
Owner

@adamhathcock commented on GitHub (Nov 2, 2023):

The RarReader tests do it: https://github.com/adamhathcock/sharpcompress/blob/master/tests/SharpCompress.Test/Rar/RarReaderTests.cs#L63

@adamhathcock commented on GitHub (Nov 2, 2023): The RarReader tests do it: https://github.com/adamhathcock/sharpcompress/blob/master/tests/SharpCompress.Test/Rar/RarReaderTests.cs#L63
Author
Owner

@Xodaru commented on GitHub (Nov 2, 2023):

Hi adamhathcock,
Thanks very much for that

Apologies for my stupid question, but I dont understand how this can achieve streaming part of the archive on request.
It seems to just extract the whole file and write it to disk? Basically like a normal extraction.

I want to be able to read a specific file in 1MB chunks (the offset and size to extract are parameters to the main processing method) as the data will be sent across a bus. Each time this method is called the offset to start at is updated as its the bus that decides what it needs to get.

@Xodaru commented on GitHub (Nov 2, 2023): Hi adamhathcock, Thanks very much for that Apologies for my stupid question, but I dont understand how this can achieve streaming part of the archive on request. It seems to just extract the whole file and write it to disk? Basically like a normal extraction. I want to be able to read a specific file in 1MB chunks (the offset and size to extract are parameters to the main processing method) as the data will be sent across a bus. Each time this method is called the offset to start at is updated as its the bus that decides what it needs to get.
Author
Owner

@adamhathcock commented on GitHub (Nov 2, 2023):

you have to read all bytes in a forward-only scenario. There is no seeking. Once you know the entry then you just deal with that stream

If you want to deal with seeking then use the Archive interface with your pieces: https://github.com/adamhathcock/sharpcompress/blob/master/tests/SharpCompress.Test/Rar/RarArchiveTests.cs#L253

@adamhathcock commented on GitHub (Nov 2, 2023): you have to read all bytes in a forward-only scenario. There is no seeking. Once you know the entry then you just deal with that stream If you want to deal with seeking then use the Archive interface with your pieces: https://github.com/adamhathcock/sharpcompress/blob/master/tests/SharpCompress.Test/Rar/RarArchiveTests.cs#L253
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#598