1
0
Fork 0

tapeget beta

This commit is contained in:
Casey 2023-10-03 18:19:15 +03:00
commit 24dae1a04e
Signed by: hkc
GPG Key ID: F0F6CFE11CDB0960
1 changed files with 36 additions and 0 deletions

36
tapeget.lua Normal file
View File

@ -0,0 +1,36 @@
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