gpt4 book ai didi

amazon-s3 - 如何将字符串写入 Amazon S3 存储桶?

转载 作者:行者123 更新时间:2023-12-01 23:00:50 28 4
gpt4 key购买 nike

如何在 amazon s3 上添加字符串作为文件?从我搜索的内容中,我知道我们可以将文件上传到 s3。在不创建文件的情况下上传数据的最佳方式是什么?

最佳答案

有一个overload for the AmazonS3.putObject method它接受存储桶字符串、 key 字符串和文本内容字符串。我没有在堆栈溢出中看到提到它,所以我把它放在这里。这将与 @Jonik 的答案类似,但没有额外的依赖。

AmazonS3 s3client = AmazonS3ClientBuilder.standard().withRegion(Regions.US_EAST_1).build();
s3client.putObject(bucket, key, contents);

关于amazon-s3 - 如何将字符串写入 Amazon S3 存储桶?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2499132/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com