rgrove/rawgithub — pull request #8 by kitcambridge (2013-02-24 20:36:13+00:00)
Title: Stream responses and generalize character encoding support.

This pull request contains two changes to the `proxyPath` function, but I can split them up if you'd like to merge only one.

The first commit replaces the `request` callback function with listeners for the `response` and `error` events. The `response` event provides access to the `gh` response object, which is a [readable stream](http://nodejs.org/api/stream.html#stream_readable_stream). As such, instead of having the `request` library buffer the response, it's possible to connect the `gh` stream directly to the `res` writable stream via [`Stream#pipe`](http://nodejs.org/api/stream.html#stream_stream_pipe_destination_options).

The second commit makes a minor change to the `charset` RegExp so that it proxies all character encodings from GitHub, instead of just UTF-8.