Hello,
what kind of compression is CompressString(String$)? Help says: "Compress the specified string and returns a new compressed buffer. "
How can I unpack it again when I send the compressed text to a PB CGI tool?
Info about CompressString(String$) needed
-
- Posts: 330
- Joined: Fri Sep 22, 2017 7:02 am
-
- Posts: 330
- Joined: Fri Sep 22, 2017 7:02 am
Re: Info about CompressString(String$) needed
Seems #PB_PackerPlugin_Zip

Code: Select all
; Purebasic Code
UseBriefLZPacker ()
UseJCALG1Packer()
UseLZMAPacker()
UseTARPacker()
UseZipPacker()
Restore Packed
*mem = AllocateMemory(20)
*out = AllocateMemory(26)
For n = *mem To *mem + 19
Read.b b
PokeB(n, b)
Next
DecompressedLength = UncompressMemory(*mem, 20, *out, 26, #PB_PackerPlugin_BriefLZ)
Debug "#PB_PackerPlugin_BriefLZ"
Debug DecompressedLength
Debug PeekS(*out, DecompressedLength, #PB_Ascii)
DecompressedLength = UncompressMemory(*mem, 20, *out, 26, #PB_PackerPlugin_Zip)
Debug "#PB_PackerPlugin_Zip"
Debug DecompressedLength
Debug PeekS(*out, DecompressedLength, #PB_Ascii)
DecompressedLength = UncompressMemory(*mem, 20, *out, 26, #PB_PackerPlugin_Lzma)
Debug "#PB_PackerPlugin_Lzma"
Debug DecompressedLength
Debug PeekS(*out, DecompressedLength, #PB_Ascii)
DecompressedLength = UncompressMemory(*mem, 20, *out, 26, #PB_PackerPlugin_JCALG1)
Debug "#PB_PackerPlugin_JCALG1"
Debug DecompressedLength
Debug PeekS(*out, DecompressedLength, #PB_Ascii)
DataSection
Packed:
Data.b 120, -100, 115, 116, 114, 70, 3, 46, -82, 110, -18, 30, -98, 94, -34, 0, 92, 34, 6, -16, 0, 0, 0
EndDataSection
CompilerIf 0
; SpiderBasic Code
String$ = "ABCCCCCCCCCCCCCCCCDEFGHIJK"
*Compressed = CompressString(String$)
Debug "Compressed size (from " + Len(String$) + " bytes): "+MemorySize(*Compressed)
For n = 0 To MemorySize(*Compressed) - 1
Debug PeekB(*Compressed, n)
Next
CompilerEndIf
Re: Info about CompressString(String$) needed
Yes, it's zlib compression
Re: Info about CompressString(String$) needed
Would you consider putting this in the docs by chance? Could be useful info