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

422
Vistas
Send audio from Node backend to frontend

I have Node/Express server set up in which several thousand audio files are stored within the src folder. I currently have a route set up that sends JSON data in the response object. I wish to also send an mp3 audio file that can be parsed at the front end and be converted to an audio object. I cannot figure out how to encode the audio file such that it may be sent. I have looked into Blobs (these don't seem to be possible in Node) and converting the binary file into a string that may be sent as part of the response body.

Any ideas as to how this may be possible?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You can directly send the audio file with something like:

res.sendFile(__dirname, "/src/audioFile.mp3");

Or you could Base64 encode the audio file for your frontend to parse:

fs.readFile("./src/audioFile.mp3", function(err, result) {
  res.send(result.toString("base64"));
});
over 4 years ago · Santiago Trujillo 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