lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


it works!
thanks,
wes

On Wed, Apr 29, 2009 at 6:19 PM, Diego Nehab <diego@tecgraf.puc-rio.br> wrote:
> Hi,
>
>> ok, I've got Lua socket up and running.  Is it possible to download a
>> jpeg through a url like http://www.images.com/random.jpg through the
>> http interface?  I'm not sure how to setup a sink for this kind of
>> case.  Any pointers appreciated.
>
> It certainly is.  You can save the data you receive to disk
> or do anything else you may want to with it. Something like
> this
>
>    local s = http.request("http://www.images.com/random.jpg";)
>    local f = io.open("random.jpg", "wb")
>    f:write(s)
>    f:close()
>
> Can you try it?
>
> []s,
> Diego
>