Note that there are some explanatory texts on larger screens.

plurals
  1. POData chunks in node-curl (node.js)
    primarykey
    data
    text
    <p>I am using node-curl as a HTTPS client to make requests to resources on the web and the code runs on a machine behind a proxy facing the internet. </p> <p>The code I am using to co:</p> <pre><code>var curl = require('node-curl'); //Call the curl function. Make a curl call to the url in the first argument. //Make a mental note that the callback to be invoked when the call is complete //the 2nd argument. Then go ahead. curl('https://encrypted.google.com/', {}, function(err) { //I have no idea about the difference between console.info and console.log. console.info(this.body); }); //This will get printed immediately. console.log('Got here'); </code></pre> <p>node-curl detects the proxy settings from the environment and gives back the expected results. </p> <p>The challenge is: the callback gets fired after the entire https-response gets downloaded, and as far as I can tell there are no parallels for the <a href="http://nodejs.org/api/http.html#http_event_data_1" rel="nofollow">'data' and 'end' events</a> from the http(s) modules.</p> <p>Further, after going through the source code, I found that indeed the node-curl library receives the data in chunks: reference line 58 in <a href="https://github.com/jiangmiao/node-curl/blob/master/lib/CurlBuilder.js" rel="nofollow">https://github.com/jiangmiao/node-curl/blob/master/lib/CurlBuilder.js</a> . It seems that no events are emitted presently in this case.</p> <p>I need to forward the possibly-sizable-response back to the another computer on my LAN for processing, so this is a clear concern for me. </p> <p>Is using node-curl recommended for this purpose in node? </p> <p>If yes, how can I handle this? </p> <p>If no, then what would be a suitable alternative? </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload