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

179
Vistas
NPM global package: How to store data?

I am maintaining a global npm package, the package is an CLI

enter image description here

What i want to do is, for example when the user choose 'Iphone 11' option, the next time user run the package again, 'iPhone 11' should be on top, and from that I think I need to save data to do this

Should I doing this by writing using file system module? and where to save that? or is there another way to do this?

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

0

there are few way, i would recommend to store the configuration in a file that has a common format (json, yaml, etc.) in appropriate path, such as $HOME/.my-pkg.json, ~/.my-pkg/conf.json, $HOME/.cache/my-pkg/, etc.

about 4 years ago · Juan Pablo Isaza Denunciar

0

I solved this by writing file using fs-extra and save it to __dirname + '/some-file.json'

when I need to read it again, just using require(__dirname + '/some-file.json')

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