Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'net/http'
- module Coggle
- def Coggle.download(url, path, name=nil)
- Net::HTTP.start(url.split('/').first) do |http|
- resp = http.get('/' + url.split('/', 2).last)
- if name == nil then; name = path + url.split('/').last; else; name = path + name; end
- open(name, "wb") do |file|
- file.write(resp.body)
- end
- end
- end
- end
Add Comment
Please, Sign In to add comment