shadowkat1010

[ShadOS] SDownloader

May 30th, 2012
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.47 KB | None | 0 0
  1. --ShadOS Download
  2. local url
  3. local filename
  4. local tArgs = { ... }
  5. url = tArgs[1]
  6. filelocation = tArgs[2]
  7. local response = http.get(
  8.   "http://pastebin.com/raw.php?i="..textutils.urlEncode(url)
  9.   )
  10.  
  11. if response then
  12.  print( "Connected, downloading." )
  13.  
  14.  local sResponse = response.readAll()
  15.  response.close()
  16.  
  17.  local file = fs.open(filelocation, "w" )
  18.  file.write( sResponse )
  19.  file.close()
  20.  
  21.  print( "Downloaded as "..filelocation )
  22. else
  23.   print( "Failed." )
  24. end
Add Comment
Please, Sign In to add comment