Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

256
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda