From 24dae1a04e9e4086e2d7a920061c4e3ab28e6252 Mon Sep 17 00:00:00 2001 From: hkc Date: Tue, 3 Oct 2023 18:19:15 +0300 Subject: [PATCH] tapeget beta --- tapeget.lua | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 tapeget.lua 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 +