forked from hkc/cc-stuff
37 lines
531 B
Lua
37 lines
531 B
Lua
|
local args = { ... }
|
||
|
|
||
|
local tape = peripheral.find("tape_drive")
|
||
|
if not tape then
|
||
|
print("tape where")
|
||
|
return
|
||
|
end
|
||
|
|
||
|
if not http then
|
||
|
print("no http, check config")
|
||
|
return
|
||
|
end
|
||
|
|
||
|
local block_size = 8192
|
||
|
|
||
|
tape.stop()
|
||
|
tape.seek(-tape.getSize())
|
||
|
tape.stop()
|
||
|
|
||
|
|
||
|
local req = http.get(args[1], {}, true)
|
||
|
if not req then
|
||
|
print("oopsie")
|
||
|
return
|
||
|
end
|
||
|
|
||
|
while true do
|
||
|
local chunk = req.read(block_size)
|
||
|
if not chunk then
|
||
|
print("EOF")
|
||
|
end
|
||
|
for i = 1, #chunk do
|
||
|
tape.write(chunk[i])
|
||
|
end
|
||
|
end
|
||
|
|