Sometimes, we want to set uploaded file and folder permissions with AWS S3 Node.js SDK.
In this article, we’ll look at how to set uploaded file and folder permissions with AWS S3 Node.js SDK.
How to set uploaded file and folder permissions with AWS S3 Node.js SDK?
To set uploaded file and folder permissions with AWS S3 Node.js SDK, we can set the ACL property of the object that we call putObject with.
For instance, we write
const params = {
Bucket: bucketName + path,
Key: key,
Body: buffer,
ContentEncoding: 'base64',
ContentType: 'image/jpeg',
ACL: 'public-read'
};
await s3.putObject(params).promise();
to call putObject with params that has ACL set to 'public-read' to let anyone read the uploaded file.
Conclusion
To set uploaded file and folder permissions with AWS S3 Node.js SDK, we can set the ACL property of the object that we call putObject with.