@Arthur Gabhart Well Base64 and compression can work together. You can compress data with a few Declares to ZLib and use EncodeBase64 so you can store the result easily.
When you need the data, use DecodeBase64 then decompress the result and you get the original text.
Here is my implementation of compression/decompression with ZLib on macOS:
[code]Function GZip(extends data as string, level as integer = 6) As string
//# Compress a string with GZip and returns the compressed string.
soft declare function compress2 lib “libz.dylib” (outBuf as Ptr, byref outBufLen as UInt32, inBuf as Ptr, inBufLen as UInt32, level as Integer) as integer
dim outBuffer, inBuffer as MemoryBlock
dim bufferLen as UInt32
inBuffer = data
outBuffer = New MemoryBlock( lenB( data ) * 1.001 + 12 )
bufferLen = outBuffer.Size
dim err as integer = compress2( outBuffer, bufferLen, inBuffer, inBuffer.Size, level )
if err=0 then
return outBuffer.StringValue( 0, bufferLen )
else
return “”
end if
End Function
[/code]
And for decompressing:
[code]Function GUnzip(extends data as string, expectedMaxSize as integer = 0) As string
//# Decompress a string compressed with GZip and returns the decompressed string.
// By default, the max expected size is 10 times the data size
soft declare function uncompress lib “libz.dylib” (outBuf as Ptr, byref outLen as UInt32, inBuf as Ptr, inLen as UInt32) as integer
dim inBuffer, outBuffer as MemoryBlock
dim err as integer
dim bufferLength as UInt32
dim maxSize as integer
if expectedMaxSize>LenB( data ) then
maxSize = expectedMaxSize //Use expectedMaxSize if it has a sensible value
else
maxSize = 10 * LenB( data ) //By default, we use 10 times the size of the compressed data
end if
inBuffer = data
outBuffer = New MemoryBlock( expectedMaxSize )
bufferLength = outBuffer.Size
err = uncompress( outBuffer, bufferLength, inBuffer, inBuffer.Size)
if err=0 then
return outBuffer.StringValue( 0, bufferLength )
else
return “”
end if
End Function
[/code]