title: Pass the cookie file into the curl request nodejs
body: <p>I use cookies.txt extension of chrome to get cookies.txt after login to google.
  The cookie file format is netscape cookie. Now I want pass this cookie file to http request by nodejs.</p>
  
  <p>Command line I used:</p>
  
  <pre><code>curl -L -b cookie.txt https://myaccount.google.com/
  </code></pre>
  
  <p>But I couldn't find any documents that tell me about how to pass cookie file to curl function of nodejs.
  How to convert the above command line to nodejs?</p>
  
  <p>Update:
   cookie.txt format like this:</p>
  
  <pre><code># HTTP Cookie File for mozilla.org by Genuinous @genuinous.
  # To download cookies for this tab click here, or download all cookies.
  # Usage Examples:
  #   1) wget -x --load-cookies cookies.txt "https://developer.mozilla.org/vi/docs/Web/JavaScript/Reference/Functions/Arrow_functions"
  #   2) curl --cookie cookies.txt "https://developer.mozilla.org/vi/docs/Web/JavaScript/Reference/Functions/Arrow_functions"
  #   3) aria2c --load-cookies cookies.txt "https://developer.mozilla.org/vi/docs/Web/JavaScript/Reference/Functions/Arrow_functions"
  #
  .mozilla.org    TRUE    /   FALSE   1643553591  _ga GA1.2.176633766.1564724252
  .developer.mozilla.org  TRUE    /   TRUE    1583073592  dwf_sg_task_completion  False
  .mozilla.org    TRUE    /   FALSE   1580567991  _gid    GA1.2.1169610322.1580463999
  developer.mozilla.org   FALSE   /   FALSE   1580483392  lux_uid 158048125271715522
  .mozilla.org    TRUE    /   FALSE   1580481652  _gat    1
  </code></pre>
  
  <p>Nodejs code:</p>
  
  <pre><code>var http = require('http');
  
  var options = {
      hostname: 'www.myaccount.google.com',
      path: '/',
      headers: {
          'User-Agent': 'whatever',
          'Referer': 'https://google.com/',
          'Cookie': ????
      }
  };
  
  http.get(options, callback);
  </code></pre>