commit 24dae1a04e9e4086e2d7a920061c4e3ab28e6252 Author: hkc Date: Tue Oct 3 18:19:15 2023 +0300 tapeget beta diff --git a/tapeget.lua b/tapeget.lua new file mode 100644 index 0000000..67d08ab --- /dev/null +++ b/tapeget.lua @@ -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 +