On Sep 4, 2016 5:29 PM, "Marcos Douglas" <m...@delfire.net> wrote: > > Ok, it works now.
Great! > For the records, I've used the lib http://www.gocher.me/GZIP (Silvio's > tip) and the function Base64Decode from WST framework > http://svn.code.sf.net/p/lazarus-ccr/svn/wst/trunk/ > > For some reason the function DecodeBase64 from Synapse doesn't work. > It receives an AnsiString. Instead, the Base64Decode function receives > a TByteDynArray. > > The TDataStream class doesn't matter... > > So, the code below is ugly, but shows how it works now (before the refactoring). > > Thank you all for the help. > > === begin === > > procedure TMainForm.Button2Click(Sender: TObject); > var > Buf,Buf2: TMemoryStream; > B: TByteDynArray; > begin > Buf := TMemoryStream.Create; > Buf2 := TMemoryStream.Create; > try > Buf.LoadFromFile('result.txt'); > B := Base64Decode(TDataStream.New(Buf).AsString, > [xoDecodeIgnoreIllegalChar]); > Buf.SaveToFile('bytes.txt'); > Buf.Clear; > Buf.WriteBuffer(Pointer(B)^, Length(B)); I'm on the phone, but looking this part it seems that base64 unconversion can be done directly in memory too. I can try it after... > if ZUncompressStream(Buf, Buf2) then > Buf2.SaveToFile('content.txt'); > finally > Buf.Free; > Buf2.Free; > end; > end; > > === end === > > Best regards, > Marcos Douglas -- Silvio Clecio
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal