Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

247
Views
How do you get request to save cookies as JSON with tough-cookie-filestore?

I am using request with NodeJS and I'd like to save cookies as JSON. As per the docs, I am using tough-cookie-filestore and passing in the jar option.

I create the file on disk beforehand, and then make a request that I know returns cookies. But for some reason, the empty file I created to store the cookies in stays empty after the response has been received.

Should I explicitly tell request to commit the cookies to the file, or should it be automatic?

// using a promise-enabled version of promise
return request({
  url: url,
  jar: new FileCookieStore(myfile)
});
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

I found my error. I should use it this way:

// using a promise-enabled version of promise
return request({
  url: url,
  jar: request.jar(new FileCookieStore(myfile))
});
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!