SnappyLib 1.1.7

.NET Standard 2.0
Install-Package SnappyLib -Version 1.1.7
dotnet add package SnappyLib --version 1.1.7
<PackageReference Include="SnappyLib" Version="1.1.7" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SnappyLib --version 1.1.7
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: SnappyLib, 1.1.7"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install SnappyLib as a Cake Addin
#addin nuget:?package=SnappyLib&version=1.1.7

// Install SnappyLib as a Cake Tool
#tool nuget:?package=SnappyLib&version=1.1.7
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Snappy, a fast compressor/decompressor.

This is the PInvoke wrapper over the implementation of the compression / decompression algorithm in the c ++ library from Google (https://github.com/google/snappy version 1.1.7).

Basic usage

var source = "У попа была собака он её любил, она съела кусок мяса он её убил.";
var sourceData = System.Text.Encoding.UTF8.GetBytes(source);
var compressData = new byte[1024];
var uncompressData = new byte[1024];

var compressedSize = SnappyLib.Snappy.Compress(sourceData, 0, sourceData.Length, compressData, 0, compressData.Length);
Assert.AreEqual(100, compressedSize);

var uncompressedSize = SnappyLib.Snappy.Uncompress(compressData, 0, compressedSize, uncompressData, 0, uncompressData.Length);
Assert.AreEqual(sourceData.Length, uncompressedSize);
Assert.IsTrue(new Span<byte>(sourceData).SequenceEqual(new Span<byte>(uncompressData, 0, uncompressedSize)));

var maxCompressedSize = SnappyLib.Snappy.MaxCompressedLength(sourceData.Length);
Assert.IsTrue(maxCompressedSize >= compressedSize);

var calculatedUncompressedSize = SnappyLib.Snappy.UncompressedLength(compressData, 0, compressedSize);
Assert.AreEqual(sourceData.Length, calculatedUncompressedSize);

var dcompressedDataValidationStatus = SnappyLib.Snappy.ValidateCompressedBuffer(compressData, 0, compressedSize);
Assert.AreEqual(dcompressedDataValidationStatus, SnappyLib.SnappyStatusEnum.SNAPPY_OK);
Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on SnappyLib:

Package Downloads
CappedLog.loki

Extension for fixed size tagged log located in memory with Grafana Loki API

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.7 2,753 10/8/2019