AWS s3 getObject Command covert UTF-8 to CP932

14 views Asked by At

Hello everyone I am trying to read a file consiting of Japanses characrers, my file buffer is using the Iconv-lite plugin. I still see that it keeps missing some character denoted with questions marks

Plugin i am using : https://www.npmjs.com/package/iconv-lite

Does anyone have any alternate approach ??

import {GetObjectCommand, S3Client} from "@aws-sdk/client-s3";
import iconv from 'iconv-lite'

const client = new S3Client({});
const response2 = await client.send(new GetObjectCommand({
    Bucket: "bucket",
    Key: "key"
}));
const buffer = Buffer.from(await response2.Body.transformToString('UTF-8')

const covertedFile = iconv.decode(buffer,'CP932')

0

There are 0 answers