<p dir="ltr">On Sep 4, 2016 5:29 PM, "Marcos Douglas" <<a href="mailto:md@delfire.net">md@delfire.net</a>> wrote:<br>
><br>
> Ok, it works now.</p>
<p dir="ltr">Great!</p>
<p dir="ltr">> For the records, I've used the lib <a href="http://www.gocher.me/GZIP">http://www.gocher.me/GZIP</a> (Silvio's<br>
> tip) and the function Base64Decode from WST framework<br>
> <a href="http://svn.code.sf.net/p/lazarus-ccr/svn/wst/trunk/">http://svn.code.sf.net/p/lazarus-ccr/svn/wst/trunk/</a><br>
><br>
> For some reason the function DecodeBase64 from Synapse doesn't work.<br>
> It receives an AnsiString. Instead, the Base64Decode function receives<br>
> a TByteDynArray.<br>
><br>
> The TDataStream class doesn't matter...<br>
><br>
> So, the code below is ugly, but shows how it works now (before the refactoring).<br>
><br>
> Thank you all for the help.<br>
><br>
> === begin ===<br>
><br>
> procedure TMainForm.Button2Click(Sender: TObject);<br>
> var<br>
> Buf,Buf2: TMemoryStream;<br>
> B: TByteDynArray;<br>
> begin<br>
> Buf := TMemoryStream.Create;<br>
> Buf2 := TMemoryStream.Create;<br>
> try<br>
> Buf.LoadFromFile('result.txt');<br>
> B := Base64Decode(TDataStream.New(Buf).AsString,<br>
> [xoDecodeIgnoreIllegalChar]);<br>
> Buf.SaveToFile('bytes.txt');<br>
> Buf.Clear;<br>
> Buf.WriteBuffer(Pointer(B)^, Length(B));</p>
<p dir="ltr">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...</p>
<p dir="ltr">> if ZUncompressStream(Buf, Buf2) then<br>
> Buf2.SaveToFile('content.txt');<br>
> finally<br>
> Buf.Free;<br>
> Buf2.Free;<br>
> end;<br>
> end;<br>
><br>
> === end ===<br>
><br>
> Best regards,<br>
> Marcos Douglas</p>
<p dir="ltr">--<br>
Silvio Clecio</p>