andrewrk / node-s3-client

high level amazon s3 client for node.js
MIT License
1k stars 303 forks source link

support for s3.putObjectAcl ? #93

Open hems opened 8 years ago

hems commented 8 years ago

I just noticed this method isn't implemented, is there any way of setting ACL permissions to private using this library?

Thank you

ChristianRich commented 8 years ago

+1

hems commented 8 years ago

@ChristianRich i end up with something more less like this:

  params = 
    Bucket: s.s3.bucket
    Key   : object_id
    ACL   : 'private'

  s3.putObjectAcl params, ( error, data ) ->

    if error then return callback? error

    if callback?
      callback null, data
faceleg commented 8 years ago

It'd be awesome if you submitted a PR with this addition

peter-mouland commented 8 years ago

hey, this is available already..

var client = s3.createClient({
    s3Options: {
        accessKeyId: process.env.S3_ACCESS_KEY,
        secretAccessKey: process.env.S3_SECRET
    }
});
var params = {
    localFile: `dist/${file}`,
    s3Params: {
        ACL:'public-read',
        Bucket: process.env.S3_BUCKET,
        Key: `${argv.version}/${file}`
    }
};

    var uploader = client.uploadFile(params);
    uploader.on('error', function(err) {
        console.error("unable to upload:", err.stack);
    });
    uploader.on('progress', function() {
        console.log("progress", uploader.progressMd5Amount,
            uploader.progressAmount, uploader.progressTotal);
    });
    uploader.on('end', function() {
        console.log("done uploading");
    });