简体   繁体   中英

aws javascript sdk function to modify existing tags on a file in s3

is there any way of adding a tag to existing TagSet to a file in s3 bucket using javascript SDK? This method:

putObjectTagging(params = {}, callback) ⇒ AWS.Request 

overwrites existing ones and sets new TagSet. Is there any better way than getting current TagSet, adding a new tag to the array and pushing them all together once again?

I believe there is no way for now to just add a new tag to the existing set of tags. see this bug report which talks about this being a S3 API Issue and even the S3 Rest API doesnt seem to support the patch operation of the tags.

So you are left with first fetching the existing tag set adding your tags to it. And then setting the complete tag set back on the S3 bucket .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM