1
I’m using the Luasocket and wanted to download files with it, but I don’t know how, I managed to download text file like this:
local file = io.open("Blabla.txt", "w")
file:write(tostring(http.request("Http://pokestage.ddns.net/patch/News.txt")))
file:close()
io.write("Downloaded!\n")
io.read()
How could I download files of other formats? (exe, rar...)
@Edit: I tried to:
arq = http.request("http://pokestage.ddns.net/patch/1.7z")
for ind, val in pairs(arq) do
print(ind)
end
Returned: Table expected, got string.
. But when I try to write, it still doesn’t work.
Did you try and failed? What’s the problem. I never used Luasocket but in theory it is for her to be able to download anything.
– Maniero
Try, he "downloaded" the file, but it’s corrupted. I tried this file: http://pokestage.ddns.net/patch/1.7z
– Gabriel Sales
I’m not here to test. Maybe your problem is in the recording. Anyway this way does not compile. http://answall.com/help/mcve. You have read the documentation, there is probably an HTTP header before the file, you would need to separate this part. Check the contents of the files you downloaded header.
– Maniero
Edit on the question what I tried.
– Gabriel Sales
This second code doesn’t seem to make any sense to me. Anyway, I’ve already hinted what the problem might be.
– Maniero
I don’t understand what you meant in your explanation '-'
– Gabriel Sales
You can put the first lines of the file here
Blabla.txt
?– Maniero
There is nothing but archive content. -> 30/10/2014 <-
– Gabriel Sales