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

178
Vistas
Is there a way to put Express.Multer.File into a FormData object?

I'm need help on finding how to put a file with a type Express.Multer.File into a FormData object.

Context: I'm receiving a file with a type Express.Multer.File (I'm using nestjs, so I used this part of the documentation : https://docs.nestjs.com/techniques/file-upload) that I need to put in a FormData, to send it to another API.

I tried form.append('randomword', file); but I get the following error :

TypeError: source.on is not a function
    at Function.DelayedStream.create (xxx/delayed-stream/lib/delayed_stream.js:33:10)
    at FormData.CombinedStream.append (xxx/combined-stream/lib/combined_stream.js:45:37)
...

I clearly sense that I'm doing it the wrong way, but I'm kinda lost on how to achieve something like this.

Could someone help me please ?

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

0

I found out a "workaround" for this method.

  • First, I get the file with the type Express.Multer.File.
  • Then I save it using createWriteStream from fs.
  • Finally, I pass it into the FormData object using createReadStream.

And done ! It isn't the best way to do this, but kind of a workaround, though.

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