docs: function copyMedia (path, to, cert, callback) {
    var hookPath = __dirname + '/../data/buffer/hook.sh'
    debug('copyMedia', path, to, cert)
  
    if (/^http/.test(to)) {
      debug('using http')
      var parsed = url.parse(to)
      debug('parsed', parsed)
  
      var domain = url.parse(to).domain
      var file = url.parse(to).path
      debug(domain, file)
  
      var a = parsed.pathname.split('/')
      var uri = parsed.protocol + '//' + parsed.host
      for (var i = 0; i < a.length - 1; i++) {
        uri += a[i] + '/'
      }
      uri += urlencode(a[i])
      debug('uri', uri)
  
      // uri = 'https://phone.servehttp.com:8000/data/buffer/image/'  + urlencode('file%3A%2F%2F%2Fmedia%2Fmelvin%2FElements%2Fpichunter.com%2F2443342_15_o.jpg')
  
      var options = {
        method: 'PUT',
        url: uri,
        key: fs.readFileSync(cert),
        cert: fs.readFileSync(cert),
        headers: { // We can define headers too
          'Content-Type': 'image/jpg'
        }
      }
  
      debug(options)
      fs.createReadStream(path).pipe(request.put(options, function (err, response, body) {
        if (err) {
          debug(err)
          callback(err)
        } else {
          debug('success')
          callback(null)
          setTimeout(function () {
            exec(hookPath)
          }, 0)
        }
      }))
    } else {
      fs.copy(path, to, function (err) {
        if (err) {
          callback(err)
        } else {
          callback(null, null)
          setTimeout(function () {
            exec(hookPath)
          }, 0)
        }
      })
    }
  }