Skip to content

Instantly share code, notes, and snippets.

@meabed
Last active August 22, 2018 23:31
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 meabed/32b3a79d6f48b28edbf65652bf9d43a3 to your computer and use it in GitHub Desktop.
Save meabed/32b3a79d6f48b28edbf65652bf9d43a3 to your computer and use it in GitHub Desktop.
#!/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