Serge Nova
Member
Hello everyone, I need to compress the bytes either
1. Compress the bytes directly, either
2. By converting the bytes into text and then compressing this text.
I tried this code but the text obtained by encoding64 is not compressing.
Thanks in advance
1. Compress the bytes directly, either
2. By converting the bytes into text and then compressing this text.
I tried this code but the text obtained by encoding64 is not compressing.
Example:
Dim org As String
org = su.EncodeBase64(File_To_Bytes(File.DirRootExternal, "aaaa.png"))
Log($"OrgLength: ${org.Length}"$)
'
' Compression
'
Dim compressed() As Byte = GZip.compress(org)
Log($"CompressedBytesLength: ${compressed.Length}"$)
Dim base64 As String = su.EncodeBase64(compressed)
Log($"CompressedBytes converted to base64 Length: ${base64.Length}"$)
Log($"CompressedBytes converted to base64: ${base64}"$)
'Decompression
Dim decompressedbytes() As Byte = su.DecodeBase64(base64)
Log($"decompressedbytesLength: ${decompressedbytes.Length}"$)
Dim bc As ByteConverter
Dim uncompressed As String = bc.StringFromBytes(decompressedbytes,"UTF8")
Log($"uncompressedLength: ${uncompressed.Length}"$)
Log($"Decompressed String = ${uncompressed}"$)
Thanks in advance