main.js
function downloadString(url, {userAgent}) {
	let deferred  = Q.defer()
	let startTime = Date.now()
	let data = ''
	request({
		method: 'GET',
		url: url,
		headers: {
			'User-Agent': userAgent
		}
	}, function(error, response, body) {
		if(error) {
			deferred.reject(new Error(error))
			return;
		}
		deferred.resolve({
			time: Date.now() - startTime,
			result: body,
			statusCode: response.statusCode
		})
	})
	return deferred.promise
}
function downloadString(url, {userAgent}) {
	let deferred  = Q.defer()
	let startTime = Date.now()
	let data = ''
	request({
		method: 'GET',
		url: url,
		headers: {
			'User-Agent': userAgent
		}
	}, function(error, response, body) {
		if(error) {
			deferred.reject(new Error(error))
			return;
		}
		deferred.resolve({
			time: Date.now() - startTime,
			result: body,
			statusCode: response.statusCode
		})
	})
	return deferred.promise
}
function downloadString ( url , { userAgent } ) { let deferred = Q . defer ( ) let startTime = Date . now ( ) let data = '' request ( { method : 'GET' , url : url , headers : { 'User-Agent' : userAgent } } , function ( error , response , body ) { if ( error ) { deferred . reject ( new Error ( error ) ) return ; } deferred . resolve ( { time : Date . now ( ) - startTime , result : body , statusCode : response . statusCode } ) } ) return deferred . promise }
Download given url to string
@param  {String}  url
@return {Promise}
Download given url to string