Skip to content

Instantly share code, notes, and snippets.

@IronistM
Forked from igrigorik/pagespeed.js
Created June 1, 2013 10:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IronistM/5689907 to your computer and use it in GitHub Desktop.
Save IronistM/5689907 to your computer and use it in GitHub Desktop.
var https = require('https'),
key = 'key',
url = 'http://www.igvita.com/',
strategy = 'desktop';
https.get({
host: 'www.googleapis.com',
path: '/pagespeedonline/v1/runPagespeed?url=' + encodeURIComponent(url) +
'&key='+key+'&strategy='+strategy
}, function(res) {
console.log("statusCode: ", res.statusCode);
console.log("headers: ", res.headers);
res.on('data', function(d) {
process.stdout.write(d);
});
}).on('error', function(e) {
console.error(e);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment