[英]How to provide public read access to a all files in folder by s3fs in node.js?
[英]How to provide public read access to a file in s3fs in node.js
我想提供对在s3亚马逊服务器上的文件夹中上传的文件的公共读取访问权限。我的代码示例是
var s3Options = {
accessKeyId: config.bucket_access_key,
secretAccessKey: config.bucket_secret_access_key
};
var fsImpl = new S3FS(config.bucket_name, s3Options);
fsImpl.writeFile(fileName, stream).then(function (err,data) {
//code
});
可以通过添加“ ACL”键来完成-
fsImpl.writeFile(fileName, stream,{ACL: 'public-read'}).then(function (err,data) {
// code
})
希望能有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.