title: How to end a node.js http request early
body: <p>I'm requesting a remote file using an <code>https.request</code> in node.js. I'm not interested in receiving the whole file, I just want what's in the first chunk.</p>
  
  <pre><code>var req = https.request(options, function (res) {
      res.setEncoding('utf8');
  
      res.on('data', function (d) {
           console.log(d);
           res.pause(); // I want this to end instead of pausing
      });
  });
  </code></pre>
  
  <p>I want to stop receiving the response altogether after the first chunk, but I don't see any close or end methods, only pause and resume. My worry using pause is that a reference to this response will be hanging around indefinitely.</p>
  
  <p>Any ideas?</p>