S3
store image
import AWS from "aws-sdk";
const s3 = new AWS.S3({
credentials: {
accessKeyId: env.ACCESS_KEY_ID,
secretAccessKey: env.SECRET_ACCESS_KEY,
},
region: "ap-northeast-1",
});
// save the images to s3
await s3
.putObject({
Bucket: "chundev-icon-generator",
Body: Buffer.from(base64Image, "base64"),
Key: "my-image3",
ContentEncoding: "base64",
ContentType: "image/png",
})
.promise();
show base64 encoded images
<img src={`data:image/png;base64, ${imageUrl}`} alt="icon" />