lib/getData.js
function downloadFromUrl(page, ph, url, callback) {
    async.waterfall([
        function (callback) {
            page.getCookies(function (cookie) {
                callback(null, page, ph, cookie);
            });
        },
        function (page, ph, cookies, callback) {
            var cookieString = helpers.cookieToHeader(cookies);
            var headers = { Cookie: cookieString };
            request.get({
                url: url,
                headers: headers,
                encoding: null
            }, function (error, response, downloadedBytes) {
                callback(error, page, ph, downloadedBytes);
            });
        }
    ], callback);
}
function downloadFromUrl(page, ph, url, callback) {
    async.waterfall([
        function (callback) {
            page.getCookies(function (cookie) {
                callback(null, page, ph, cookie);
            });
        },
        function (page, ph, cookies, callback) {
            var cookieString = helpers.cookieToHeader(cookies);
            var headers = { Cookie: cookieString };
            request.get({
                url: url,
                headers: headers,
                encoding: null
            }, function (error, response, downloadedBytes) {
                callback(error, page, ph, downloadedBytes);
            });
        }
    ], callback);
}
function downloadFromUrl ( page , ph , url , callback ) { async . waterfall ( [ function ( callback ) { page . getCookies ( function ( cookie ) { callback ( null , page , ph , cookie ) ; } ) ; } , function ( page , ph , cookies , callback ) { var cookieString = helpers . cookieToHeader ( cookies ) ; var headers = { Cookie : cookieString } ; request . get ( { url : url , headers : headers , encoding : null } , function ( error , response , downloadedBytes ) { callback ( error , page , ph , downloadedBytes ) ; } ) ; } ] , callback ) ; }
Downloads a file from a url
@param page
@param ph
@param {string} url
@param {pageResultCallback} callback
Downloads a file from a url