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

198
Views
"drain" event on Express.js Response stream

I'm pretty new to streams in node. I'm trying to listen to the "drain" event when writing to Express.js res stream. The res stream has backpressure and res.write() is returning false as expected. It never emits the 'drain' event. Is Express.js capturing the event and not letting it bubble up?

Example:

function someController(req, res) {
  for (let i = 0; i < 1000; i++) {
    const flushed = res.write('some text\n')
    if (!flushed) {
      res.once('drain', () => console.log('drained'))
    }
  }
  res.end()
}
about 4 years ago · Juan Pablo Isaza
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!