javascript – Nodejs aws-sdk v2 read AVRO file

I’m using aws-sdk v2 precisely "aws-sdk": "2.1032.0". I have avro files in a AWS S3. To read them I use the following:

const response = await s3.getObject({
      Bucket: 'bucketname',
      Key: 'key'
    }).promise();

const data = response.Body.toString()

The problem is that the data not decoded correctly check this result for example: Objavro.schema�{"type":"record","name". I tried toString('binary'), toString('utf-8')
but basically we get the same result.

Any idea how to read properly the content of the Avro file from S3?

Thank you

Read more here: Source link