Last active
August 22, 2018 23:31
-
-
Save meabed/32b3a79d6f48b28edbf65652bf9d43a3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
curl -sL https://deb.nodesource.com/setup_10.x | bash - | |
apt-get install -y nodejs | |
mkdir node-curl && cd node-curl && rm -rf node_modules && npm i -f node-libcurl --build-from-source | |
echo " | |
var Curl = require('node-libcurl').Curl; | |
var curl = new Curl(); | |
curl.setOpt('URL', 'https://www.google.com'); | |
curl.setOpt('FOLLOWLOCATION', true); | |
curl.setOpt('VERBOSE', true); | |
curl.on('end', function(statusCode, body, headers) { | |
console.info(statusCode); | |
console.info('---'); | |
console.info(body.length); | |
console.info('---'); | |
console.info(this.getInfo( 'TOTAL_TIME')); | |
console.info(Curl.getVersion()); | |
this.close(); | |
}); | |
curl.on('error', curl.close.bind(curl)); | |
curl.perform(); | |
" > index.js | |
node index.js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment