Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

175
Visualizações
Uploading an MP3 to S3 from the Buffer

I'm attempting to render an MP3 file on the front-end and send it to AWS S3. I can upload a given file to AWS S3 easily enough, but not from the buffer, which is where the file is generated.

The textToSpeech call in the code sample below is coming from the IBM Watson Text-to-Speech API.

Here is an example code, the app is a Next.JS app that is calling S3 via an API:

module.exports = requireAuth(async (req, res) => {
  textToSpeech
    .synthesize(synthesizeParams)
    .then(buffer => {
     
      const s3Params = {
        Bucket: 'waveforms/audioform',
        Key: 'CONTENT.mp3',
        Body: buffer,
        ContentType: 'audio/mpeg',
        ACL: 'public/read'
      }

      s3.upload(s3Params, function (s3Err, data) {
        if (s3Err) throw s3Err
        console.log(`File uploaded successfully at ${data.Location}`)
      })
    })
    .catch(err => {
      console.log('error:', err)
    })
}

The error is Error: Unsupported body payload object, so it appears that the buffer is not being accessed correctly, but I'm not sure how to extract the relevant data.

How can I pass a file from the Node buffer to S3?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda