我正在尝试使用AWS SDK for NodeJS将字符串保存到AWS S3 bucket中的文件中。PUT请求成功了,但是文件没有在S3 bucket中创建。以下是我的代码片段:
const s3 = new S3({ apiVersion: '2006-03-01' });
const JS_code = `
let x = 'Hello World';
`;
// I'm using the following method inside an async function.
await s3.putObject({
Bucket: 'my-bucket-gayashan',
Key: 'myFile.js',
ContentType:'binary',
Body: Buffer.from(JS_code, 'binary')
});
能否有人帮助我解决这个问题?