# Class CompressionHelper
Namespace: [CapyKit.Helpers](CapyKit.Helpers.md)
Assembly: CapyKit.dll
A class that contains methods for managing data compression.
```csharp
public static class CompressionHelper
```
#### Inheritance
[object](https://learn.microsoft.com/dotnet/api/system.object) ←
[CompressionHelper](CapyKit.Helpers.CompressionHelper.md)
#### Inherited Members
[object.Equals\(object?\)](https://learn.microsoft.com/dotnet/api/system.object.equals\#system\-object\-equals\(system\-object\)),
[object.Equals\(object?, object?\)](https://learn.microsoft.com/dotnet/api/system.object.equals\#system\-object\-equals\(system\-object\-system\-object\)),
[object.GetHashCode\(\)](https://learn.microsoft.com/dotnet/api/system.object.gethashcode),
[object.GetType\(\)](https://learn.microsoft.com/dotnet/api/system.object.gettype),
[object.MemberwiseClone\(\)](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone),
[object.ReferenceEquals\(object?, object?\)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals),
[object.ToString\(\)](https://learn.microsoft.com/dotnet/api/system.object.tostring)
#### Extension Methods
[ObjectExtensions.UpdateProperties\(object, object\)](CapyKit.Extensions.ObjectExtensions.md\#CapyKit\_Extensions\_ObjectExtensions\_UpdateProperties\_System\_Object\_System\_Object\_)
## Methods
### Compress\(object\)
Compresses a given object using the gzip algorithm.
```csharp
public static byte[] Compress(object obj)
```
#### Parameters
`obj` [object](https://learn.microsoft.com/dotnet/api/system.object)
The object.
#### Returns
[byte](https://learn.microsoft.com/dotnet/api/system.byte)\[\]
A byte array representing the compressed object in gzip format.
### CompressToString\(object\)
Compresses a given object to a string using base64 encoding of gzip format.
```csharp
public static string CompressToString(object obj)
```
#### Parameters
`obj` [object](https://learn.microsoft.com/dotnet/api/system.object)
The object.
#### Returns
[string](https://learn.microsoft.com/dotnet/api/system.string)
A string in base64 encoding.
### Decompress\(string\)
Decompresses a given base64 encoded string of gzip format.
```csharp
public static T Decompress(string encodedString)
```
#### Parameters
`encodedString` [string](https://learn.microsoft.com/dotnet/api/system.string)
The base64 encoded gzip string.
#### Returns
T
A T typed object.
#### Type Parameters
`T`
Generic type parameter.
### Decompress\(byte\[\]\)
Decompresses a given compressed gzip byte stream.
```csharp
public static T Decompress(byte[] byteStream)
```
#### Parameters
`byteStream` [byte](https://learn.microsoft.com/dotnet/api/system.byte)\[\]
The compressed byte stream.
#### Returns
T
A T typed object.
#### Type Parameters
`T`
Generic type parameter.
### DecompressToString\(string\)
Decompresses the given base64 string in gzip format.
```csharp
public static string DecompressToString(string compressed)
```
#### Parameters
`compressed` [string](https://learn.microsoft.com/dotnet/api/system.string)
The compressed string.
#### Returns
[string](https://learn.microsoft.com/dotnet/api/system.string)
A decomressed string.