Source: apc-static/lib/fetch/fetch_html.js

/**
 * Fetch html
 * @function lib.fetch.fetchHtml
 * @param {string} url - URL to fetch.
 * @param {function} callback - Callback when done.
 * @author Taka Okunishi
 */
module.exports = function (url, callback) {
    require('request').get({
        url: url,
        encoding: null
    }, function (err, res, data) {
        var statusCode = res && res.statusCode,
            isOK = statusCode === 200;
        if (!isOK) {
            err = new Error('Status ' + statusCode);
        }
        callback(err, data);
    });
};