Hi Mariano,
(I can't access the file you gave as an example, probably an extra #username:password: is needed)
You are making it more difficult than it has to be: this gives you the bytes you want
ZnClient new
� � � � get: 'http://zn.stfx.eu/zn/string.fuel'.
With some better system parameters this becomes
ZnClient new
� � � � systemPolicy;
� � � � beOneShot;
� � � � accept: ZnMimeType applicationOctetStream;
� � � � url: 'http://zn.stfx.eu/zn/string.fuel';
� � � � get.
But what you really want is something like:
ZnClient new
� � � � systemPolicy;
� � � � beOneShot;
� � � � accept: ZnMimeType applicationOctetStream;
� � � � url: 'http://zn.stfx.eu/zn/string.fuel';
� � � � contentReader: [ :entity | FLMaterializer materializeFromByteArray: entity contents ];
� � � � get.
You can experiment with #streaming: true but that is only worth it for large (MB) files. IMHO.
HTH,
Sven
On 24 Jul 2012, at 23:06, Mariano Martinez Peck wrote:
> Hi Sven. How can I download a binary file to a bytearray ?
>
> I tried to download it locally doing:
>
> � � � ZnClient new
> � � � � systemPolicy;
> � � � � accept: ZnMimeType applicationOctetStream;
> � � � � url: 'https://ci.lille.inria.fr/pharo/view/Pharo%202.0/job/pharo-2.0-tests/Architecture=32,OS=mac/ws/Pharo-2.0-AfterRunningTests/ClassHierarchyTest-testMethodDuplication.fuel';
> � � � � downloadTo: '/Users/mariano/Desktop'.
>
>
> but I cannot even do that. Notice that my final go is not to download it to a file, but rather directly get the binary contents.
>
> How can I do that?
>
> Thanks,
>
> --
> Mariano
> http://marianopeck.wordpress.com