starts function and little change on download_to_file
This commit is contained in:
parent
737738a330
commit
d012c26fa6
@ -42,8 +42,7 @@ function download_to_file( url , noremove )
|
|||||||
local respbody = {}
|
local respbody = {}
|
||||||
one, c, h = http.request{url=url, sink=ltn12.sink.table(respbody), redirect=true}
|
one, c, h = http.request{url=url, sink=ltn12.sink.table(respbody), redirect=true}
|
||||||
htype = h["content-type"]
|
htype = h["content-type"]
|
||||||
vardump(c)
|
|
||||||
print("content-type: "..htype)
|
|
||||||
if htype == "image/jpeg" then
|
if htype == "image/jpeg" then
|
||||||
file_name = string.random(5)..".jpg"
|
file_name = string.random(5)..".jpg"
|
||||||
file_path = "/tmp/"..file_name
|
file_path = "/tmp/"..file_name
|
||||||
@ -190,4 +189,9 @@ end
|
|||||||
-- Retruns true if the string is empty
|
-- Retruns true if the string is empty
|
||||||
function string:isempty()
|
function string:isempty()
|
||||||
return self == nil or self == ''
|
return self == nil or self == ''
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function string.starts(String, Start)
|
||||||
|
return Start == string.sub(String,1,string.len(Start))
|
||||||
end
|
end
|
Reference in New Issue
Block a user