Automattic / knox

S3 Lib
MIT License
1.74k stars 285 forks source link

Add header when copying files #266

Closed claudiopetrini closed 9 years ago

claudiopetrini commented 9 years ago

Hi, I need to copy files between two folders of the same bucket maintaining the same source headers and adding a Cache-Control header in the destination file. The only way I found is:

var headers = {
   'x-amz-metadata-directive': 'REPLACE',
   'Cache-Control': 'max-age=2592000000',
   'Content-Type' : variable
} ;
aws.copyFile(source, dest, headers, callback)

The x-amz-metadata-directive is needed because of the default copy just keeps the source metadata. Is there an easier way to add a metadata (even after a standard copy)?

domenic commented 9 years ago

I don't believe so, but you might want to try asking on StackOverflow.

claudiopetrini commented 9 years ago

Thank you, I'll give it a try