var dl = require('./index.js')

var url = "i.imgur.com/G9bDaPH.jpg"

var opts = {
	directory: "./images/cats/",
	filename: "cat.gif"
}

dl(url, opts, function(err){
	if (err) hiss(err)
	meow("no protocol")
}) 

var url = "http://i.imgur.com/G9bDaPH.jpg"

var opts = {
  directory: "./images/cats/",
  filename: "cat.gif"
}

dl(url, opts, function(err){
  if (err) hiss(err)
  meow("http protocol")
})

var url = "http://i.imgur.com/G9bDaPH.jpg"

var opts = {
  directory: "./images/cats/",
  filename: "cat.gif"
}

dl(url, opts, function(err){
  if (err) hiss(err)
  meow("https protocol")
}) 

function meow(msg) {
  console.log("\033[32m", "meow: " + msg, "\033[91m")
}

function hiss(err) {
  console.log("\033[31m", "hiss", "\033[91m")
  throw err
}
