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

200
Views
¿Cómo puedo recuperarme del error de flujo de nodo?

¿Es posible recuperarse de un error de flujo de nodo? Por ejemplo, con promesas puedes hacer algo como

 async function getThumbnail(id, width, height) { try { const thumbnail = await readThumbnail(id, width, height); return thumbnail; } catch { // The thumbnail doesn't exist, so we will create and cache it const thumbnail = await createThumbnail(id, width, height); return thumbnail; } }

Si readThumbnail() devuelve una transmisión en lugar de una promesa, ¿es posible recuperarse de un error de transmisión si la miniatura no existe? El objetivo es que el método getThumbnail() siempre devuelva un flujo de trabajo, independientemente de si la miniatura existe o no.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Encontré una manera de hacerlo usando una tercera secuencia.

 function getThumbnail(id, width, height) { const readable = new PassThrough(); readThumbnail(id, width, height) // It is important that this error handler is above the pipe .on('error', error => { createThumbnail(id, width, height).pipe(readable); }) .pipe(readable); return readable; }
about 4 years ago · Juan Pablo Isaza 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!