Files: ca90b5ca0579ebdcc0635288bce4978e3fb200f5 / test / test-79-npm / node-libcurl / node-libcurl.js
490 bytesRaw
1 | ; |
2 | |
3 | // apt-get install libcurl4-openssl-dev |
4 | |
5 | // IF YOU USE 32-BIT NODEJS: |
6 | // patch /usr/include/curl/curlbuild.h |
7 | // #define CURL_SIZEOF_LONG 4 |
8 | // #define CURL_SIZEOF_CURL_OFF_T 4 |
9 | |
10 | var Curl = require('node-libcurl').Curl; |
11 | var curl = new Curl(); |
12 | curl.setOpt('URL', 'www.yandex.ru'); |
13 | curl.setOpt('FOLLOWLOCATION', true); |
14 | curl.on('end', function (status) { |
15 | if (status === 200) { |
16 | console.log('ok'); |
17 | } |
18 | this.close(); // eslint-disable-line no-invalid-this |
19 | }); |
20 | curl.perform(); |
21 |
Built with git-ssb-web