title: Check if a folder exists on S3 using node js aws-sdk
body: <p>First of all, I know that there is no such thing as a folder, however, I am using the term just for simplicity. Now I have a lot of objects in my bucket. 
  For some folders, I can use getObject to find if they exist or not, but for most of them, I get an error No such key when I clearly see that they are present. I would also like to say that I have tried headObject, listObjectV2 even but with no luck. </p>
  
  <pre><code>this is my params object
  {
       Bucket: bucket //bucket is defined in the program
       Key: folder // defined in the program above
                   //example key - abc-1-1/00000N/30/2018.10.7.8/
                   //inside this folder are multiple files 
  }
  </code></pre>
  
  <p>The goal is to find if the folder exists or not and based on that I do some processing. I saw a lot of answers to this question suggesting headObject, getObjects, etc. but none of them seem to work</p>
  
  <p>This is my getObjects code snippet</p>
  
  <pre><code>params = {
              Bucket: bucket,
              Key: folder
          }
          s3.getObject(params, function (err, found) {
  
              if (err){ 
                  console.log('bucket is'+bucket);
                  ..........
                  .....
              }
              else{
                  ....
              }
              ..
              });
  </code></pre>