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

169
Vistas
Is it possible to persist/serialize/deserialize a JS Generator? (in node.js, or any other engine)

Let's assume I run one JS file with the following code:

function* naturalsGenerator(){
  let num = 0;
  while(true){
    yield num++;
  }
}
const naturals = naturalsGenerator();
console.log(naturals.next().value); // prints 0
writeInAFile(naturals,"file.bin");

And then I run the following script:

const deserializedGenerator = readFromFile("file.bin");
console.log(deserializedGenerator.next().value); //prints 1

Is there any way to implement writeInFile and readFromFile functions, in node.js or any other js engine?

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