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

159
Vistas
How to store value into json file from Nodejs
let data= {
        timestamp:time,
        OSName:osname,
        IP:userdata.IPv4,
        country:userdata.country_name,
        browser:broname
    }

I want to store these values into a JSON file or js file, so that I can fetch them later on. Please help me with this, how can I store them? Also, these value update every time when page reload; then a new object should be made.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

NodeJS has his own lib for this, fs (Docs).

You need to import it (I used Vanilla JS, for more general solution)
const fs = require('fs');

And then you can use writeFileSync to save it (Docs)
In your case, you would need to do something like this:
fs.writeFileSync(<filename>, JSON.stringify(<yourObject>));

about 4 years ago · Juan Pablo Isaza 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