mardi 23 décembre 2014

S3 Add header when copying files

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:



  1. list all files in the folder

  2. make a HEAD call to know the Content-Type of each file in the folder


  3. 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