An open API service indexing awesome lists of open source software.

https://github.com/picrap/lzmastream

Trying to get LZMA mainstream
https://github.com/picrap/lzmastream

csharp lzma stream

Last synced: 11 months ago
JSON representation

Trying to get LZMA mainstream

Awesome Lists containing this project

README

          

# LzmaStream
Trying to get LZMA mainstream :stuck_out_tongue_winking_eye:

Available as a [![NuGet package](http://img.shields.io/nuget/v/LzmaStream.svg?style=flat-square)](https://www.nuget.org/packages/LzmaStream) package.

## What is it?

A `Stream` that works exactly as you would expect: read from it and unpack or write to it and pack (the same way you would do with `GZipStream`)

## How to use it

To decompress data:
```csharp
// packedStream is the LZMA packed source stream
using (var lzmaStream = new LzmaStream(packedStream, CompressionMode.Decompress))
{
lzmaStream.CopyTo(unpackTarget);
// or
// lzmaStream.Read(unpackData, 0, unpackData.Length);
}
```

… And to compress it:
```csharp
// packedStream is a stream receiving packed data
using (var lzmaStream = new LzmaStream(packedStream, CompressionMode.Compress))
// or
// using (var lzmaStream = new LzmaStream(rawStream, LzmaCompressionParameters.Defaut /* or .Optimal or .Fast or custom… */))
{
// copy from an unpacked stream to LZMA output
rawStream.CopyTo(lzmaStream);
// or
// lzmaStream.Write(rawData, 0, rawData.Length);
}
```

## Credits

This library uses unmodified source code from https://www.7-zip.org/sdk.html ([from another repository](https://github.com/picrap/lzma-sdk))