1
0
Fork 0
cc-stuff/tapeget.lua

37 lines
531 B
Lua
Raw Normal View History

2023-10-03 18:19:15 +03:00
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