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

216
Views
El trozo de búfer no se obtiene más de una vez

Estoy tratando de obtener texto de gran tamaño a través del campo de entrada. cuando trato de consolar los fragmentos de datos como búfer. Obtengo solo la primera parte del búfer. No puedo entender lo que me estoy perdiendo.

 const http = require('http'); const server = http.createServer((req, res) => { if (req.url === '/') { res.write('<html><head><title>Form</title></head>'); res.write( '<body><form method="post" action="/process"><input name="message" /></form></body>' ); res.end(); } else if (req.url === '/process' && req.method === 'POST') { req.on('data', (chunk) => { console.log(chunk); }); res.write('Thank you for submitting'); res.end(); } else { res.write('Not found'); res.end(); } }); server.listen(3000); console.log('listening on port 3000');

consola de resultados

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

0

Debe esperar el evento end antes de enviar su respuesta:

 req.on('data', (chunk) => { console.log(chunk); }); req.on('end', () => { res.write('Thank you for submitting'); res.end(); });
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!