     # if netrc
     #   req.auth(netrc.login, netrc.password)
 
-    req.on 'error', (err) ->
-      return done(err)
-
+    req.on 'error', done
     req.end()
 
-module.exports = request
+# Freeze the object so it can't be modified later.
+module.exports = Object.freeze(new Request())

{parse} = require 'url'
#netrc = require 'netrc'

request =
  get: (url, dst, done) ->
    {hostname, path} = parse(url)
    options = {hostname, path, headers: {'Accept-Encoding': 'gzip'}}

    if dst
      # Save file to disk
      onEnd = (res) ->
        stream = fs.createWriteStream(dst)
        if res.headers['content-encoding'] in ['gzip', 'deflate']
          unzip = zlib.createUnzip()
          res.pipe(unzip).pipe(stream)

# A simple utility to download files from HTTP or HTTPS.
# Supports transparent gzip decompression.

fs = require 'fs-extra'
http = require 'http'
