Short truncated decompress by BZip2Stream #15

Closed
opened 2026-01-29 22:03:30 +00:00 by claunia · 2 comments
Owner

Originally created by @kekyo on GitHub (May 8, 2014).

Hi, I'm tested very large bzip2'ed stream decompress by BZip2Stream.

using (var fs = new FileStream(@"D:\planet-latest.osm.bz2", FileMode.Open, FileAccess.Read, FileShare.Read))
{
    using (var cs = new BZip2Stream(fs, CompressionMode.Decompress))
    {
        using (var ts = new FileStream(@"D:\pp.osm", FileMode.Create, FileAccess.ReadWrite, FileShare.Read))
        {
            cs.CopyTo(ts);
            ts.Close();
        }
    }
}

Data is OpenStreetMap's Planet.osm.bz2. (size=36GB)
Outputted pp.osm size is just 900000 bytes, of course may result 500GB over.

How can I decompress this file?
Thanks.

Originally created by @kekyo on GitHub (May 8, 2014). Hi, I'm tested very large bzip2'ed stream decompress by BZip2Stream. ``` using (var fs = new FileStream(@"D:\planet-latest.osm.bz2", FileMode.Open, FileAccess.Read, FileShare.Read)) { using (var cs = new BZip2Stream(fs, CompressionMode.Decompress)) { using (var ts = new FileStream(@"D:\pp.osm", FileMode.Create, FileAccess.ReadWrite, FileShare.Read)) { cs.CopyTo(ts); ts.Close(); } } } ``` Data is OpenStreetMap's Planet.osm.bz2. (size=36GB) Outputted pp.osm size is just 900000 bytes, of course may result 500GB over. How can I decompress this file? Thanks.
Author
Owner

@adamhathcock commented on GitHub (Nov 4, 2014):

It could be as simple as I didn't use Longs. Try that.

@adamhathcock commented on GitHub (Nov 4, 2014): It could be as simple as I didn't use Longs. Try that.
Author
Owner

@adamhathcock commented on GitHub (May 31, 2018):

I think this is the same as https://github.com/adamhathcock/sharpcompress/issues/166 closing this

@adamhathcock commented on GitHub (May 31, 2018): I think this is the same as https://github.com/adamhathcock/sharpcompress/issues/166 closing this
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#15