Skip to content

Instantly share code, notes, and snippets.

@muthuspark
Created February 27, 2018 13:18
Show Gist options
  • Select an option

  • Save muthuspark/f43b08251cd0ec813dfd75823a644fff to your computer and use it in GitHub Desktop.

Select an option

Save muthuspark/f43b08251cd0ec813dfd75823a644fff to your computer and use it in GitHub Desktop.

Revisions

  1. muthuspark created this gist Feb 27, 2018.
    24 changes: 24 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@
    var AWS = require('aws-sdk');

    AWS.config.update({
    accessKeyId: "ACCESS_KEY",
    secretAccessKey: "SECRET_ACCESS_KEY"
    });

    // Create an S3 client
    var s3 = new AWS.S3();

    // Create a bucket and upload something into it
    var bucketName = 'BUCKET_NAME';
    var S3Url = "https://s3-us-west-2.amazonaws.com/BUCKET_NAME/";

    var params = {
    Bucket: bucketName,
    Delimiter: '/'
    }

    s3.listObjects(params, function (err, data) {
    if(err)throw err;
    data.Contents.forEach(function(k){
    console.log(k.Key);
    });