I am new to Lava, but working on an application that works on specific files with the given path is. Now, I want to work on the files I download. Is there a LiA library or line of code that I can use to download and store on my computer?
Using the LuaSocket library and its function to download the URL you use for HTTP You can.
Function has two flavors:
- Simple call:
http.request ('http://stackoverflow.com')
- Advanced call:
http.request {url = 'http://stackoverflow.com', ...}
Simple call 4 values Completes - the contents of the URL, the HTTP response code, the header and the response line, in the entire string. You can save content in the file using the library.
An advanced call allows you to set several parameters such as the HTTP method and the header is an important parameter
sync . To store the file it represents one, you can use it:
local file = ltn12.sink.file (io.open ('stackoverflow', 'w' )) Http.request {url = 'http: //stackoverflow.com', sink = file,}
- Advanced call:
Comments
Post a Comment