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
- Host: GitHub
- URL: https://github.com/picrap/lzmastream
- Owner: picrap
- License: mit
- Created: 2020-05-10T15:52:40.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-10-02T13:57:18.000Z (over 5 years ago)
- Last Synced: 2025-01-21T20:48:40.660Z (over 1 year ago)
- Topics: csharp, lzma, stream
- Language: C#
- Size: 1.87 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# LzmaStream
Trying to get LZMA mainstream :stuck_out_tongue_winking_eye:
Available as a [](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))