17 lines
320 B
Lua
17 lines
320 B
Lua
|
local tA = {...}
|
||
|
local url = tA[1]
|
||
|
local path = tA[2]
|
||
|
local R=component.internet.request(url)
|
||
|
if not R then return false end
|
||
|
local f=io.open(path,"wb")
|
||
|
if not f then return false end
|
||
|
repeat
|
||
|
coroutine.yield()
|
||
|
until R.finishConnect()
|
||
|
repeat
|
||
|
coroutine.yield()
|
||
|
ns = R.read(2048)
|
||
|
f:write(ns or "")
|
||
|
until not ns
|
||
|
f:close()
|