local args={...}

if #args<2 then
  print("Usage: wget url file")
else
  local page = http.get(args[1])
  if not page then print("Cannot connect!") return end
  local contents=page.readAll()
  page.close()
  
  local f = fs.open(args[2],"w")
  if not f then print("Cannot open file for writing!") return end
  f.write(contents)
  f.close()
end
