Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow head requests for S3 buckets #309

Open
radiovisual opened this issue Aug 2, 2016 · 0 comments
Open

Allow head requests for S3 buckets #309

radiovisual opened this issue Aug 2, 2016 · 0 comments

Comments

@radiovisual
Copy link

radiovisual commented Aug 2, 2016

I am simply trying to do a head request to check the existence of an S3 Bucket.

If I were using the aws-sdk, I would use the aws-sdk's headObject method and do this:

var AWS = require('aws-sdk');
var s3 = new AWS.S3();

s3.headObject({Bucket: 'someBucket'}, function(err, data) {
    if (err) {
        console.log(err, err.stack);
    } else {
        console.log('The bucket exists!');
    }
});

I see that knox has a client.head() method, which seems to need a path to a file, like this:

 client.head('path/to/file').on('response', function (res) {
    // ...     
 });

But is there a way to use knox to just grab the HEAD of a bucket?

Something like:

 client.head('bucketName').on('response', function (res) {
    // ...     
 });

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant