How to extract .gz file

Hi ,

How to unzip .gz file i tried zip/unzip activitites and invoke method with extractToDirectory , Nothing is working ,
Could you please

Thanks

@Krishna_547

Have you tried BalaReva.Externals.Activities package ?

1 Like

Hi @lakshman ,

I am not supposed to use any external packages other than UiPath , any alternative

@Krishna_547

Use invoke code activity

Public Function DecompressGZip(bytesToDecompress As Byte()) As Byte()
** Using stream As New GZipStream(New MemoryStream(bytesToDecompress), CompressionMode.Decompress)**
** Const size As Integer = 4096**
** Dim buffer As Byte() = New Byte(size - 1) {}**
** Using memoryStream As New MemoryStream()**
** Dim count As Integer**
** Do**
** count = stream.Read(buffer, 0, size)**
** If count > 0 Then**
** memoryStream.Write(buffer, 0, count)**
** End If**
** Loop While count > 0**
** Return memoryStream.ToArray()**
** End Using**
** End Using**
End Function


Public Function CompressGZip(input As String, Optional encoding As Encoding = Nothing) As Byte()
** encoding = If(encoding, Encoding.Unicode)**
** Dim bytes As Byte() = encoding.GetBytes(input)**
** Using stream As New MemoryStream()**
** Using zipStream As New GZipStream(stream, CompressionMode.Compress)**
** zipStream.Write(bytes, 0, bytes.Length)**
** Return stream.ToArray()**
** End Using**
** End Using**
End Function

Hope this will help you

Thanks,
suresh J

Hi @sureshj

how can i send the input file path to the code