Skip to content

Using client.putFile

Shridhar Gupta edited this page Jun 13, 2016 · 2 revisions
client.putFile(filePath, newFileName, headers, function(err, res) {
    if (err) return;
    else if (200 == res.statusCode) {
      var awsData = res.socket._httpMessage;
      console.log('Uploaded to S3: ', awsData.url);
    }
});

Sample headers, x-amz-acl is the aws view permissions for this file.

var headers = {
    'Content-Type': 'application/pdf',
    'x-amz-acl': 'public-read'
  };
Clone this wiki locally