After migrating from AWS SDK for JavaScript v2 to v3, GetObjectCommand response handling breaks: in v2 response.Body had a toString() method returning the file text, but in v3 Body is a stream-like object, so data.Body.toString('utf-8') prints [object Object] or fails. This is the single most asked v2-to-v3 migration question on the repo (109 comments).
AWS SDK v3: GetObject Body is no longer a string
In SDK v3, convert the Body with the stream helpers instead of calling toString directly: await response.Body.transformToString() for text, transformToByteArray() for bytes, or transformToWebStream() to keep streaming. To save to disk without buffering the whole object, pipe the stream with node:stream pipeline into a write stream, as the maintainers recommend on the thread.
Source: https://github.com/aws/aws-sdk-js-v3/issues/1877
Source: https://github.com/aws/aws-sdk-js-v3/issues/1877