Downloading a JPEG

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Downloading a JPEG

Sean P. DeNigris
Administrator
Is there a way to save a JPEG from the web to a file in Pharo? I can open it as a Form, but I also want a copy of the original saved.

Thanks.
Sean
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Downloading a JPEG

Sean P. DeNigris
Administrator
Sean P. DeNigris wrote
Is there a way to save a JPEG from the web to a file in Pharo?
FileStream forceNewFileNamed: savePath do: [ :str |
        str binary.
        str nextPutAll: (httpPathString asUrl retrieveContents contents) ].

I was looking in the Url classes, forget about FileStream (and then forgot about binary). Should this be added to Zinc? I didn't see any save methods there (like Ruby's Mechanize library). I'm going to add it to MIMEDocument and open an issue.

Thanks.
Sean
Cheers,
Sean