I am using knox to copy files between two folders of the same bucket and I need to maintain the same source headers and add a Cache-Control header in the destination file. The only way I found is:
- list all files in the folder
- make a HEAD call to know the Content-Type of each file in the folder
make a copy operation with these parameter:
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)?
Aucun commentaire:
Enregistrer un commentaire