Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local handle = assert(http.get(..., nil, true))
- local tape = assert(peripheral.find("tape_drive"), "No tape drive found")
- tape.stop()
- tape.seek(-tape.getSize())
- tape.stop()
- if handle.getResponseHeaders()["Content-Length"] then print("Total size: " .. handle.getResponseHeaders()["Content-Length"]) end
- local y = select(2, term.getCursorPos())
- local n = 0
- repeat
- local data = handle.read(4096)
- if data then tape.write(data) n = n + #data end
- write(n)
- term.setCursorPos(1, y)
- until not data or #data < 4096
- handle.close()
- print("Wrote tape")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement