Alyssa

Tape Download

Oct 12th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.33 KB | None | 0 0
  1. print("Enter URL to download from")
  2. url = read()
  3. tape = peripheral.wrap("top")
  4. tape.seek(-tape.getPosition())
  5. req, err = http.get(url, nil, true)
  6. bytes = req.readAll()
  7. for i = 1, #bytes do
  8.     if i % 100000 == 0 then
  9.         os.queueEvent("dl_yield")
  10.         os.pullEvent("dl_yield")
  11.     end
  12.     tape.write(string.byte(string.sub(bytes, i, i+1)))
  13. end
Add Comment
Please, Sign In to add comment