text: 
  /**
   * S3 Bucket Downloader
   * Setup: npm install aws-sdk minimist
   * Configure: ~/.aws/credentials
   * With: [default]
   *       aws_access_key_id = __________
   *       aws_secret_access_key = _____________
   *
   * @author Wogan May <wogan.may@gmail.com>
   */
  
  var path = require('path');
  var argv = require('minimist')(process.argv.slice(2));
  var AWS = require('aws-sdk');
  var fs = require('fs');
  var fsex = require('fs-extra');
  var s3 = new AWS.S3();
  
  s3.config.loadFromPath(path.resolve('./config.json'));
  
  // Check for mandatory parameters
  if (argv.bucket == undefined) {
    console.log('Please define a --bucket!');
    return;
  }
  
  // Create a bucket subfolder
  fs.mkdirSync(argv.bucket);
  
  // Go!
  s3.listObjects({ Bucket: argv.bucket }, function (err, data) {
    if (err) console.log(err, err.stack); // an error occurred
    else {
  
      console.log(data.Contents.length + " files found in '" + argv.bucket + "' bucket");
  
      data.Contents.forEach(function (currentValue, index, array) {
  
        var filePath = path.resolve(argv.bucket + "/" + currentValue.Key);
        var fileBasePath = path.dirname(filePath);
  
        // Check if the file already exists?
        fs.exists(argv.bucket + "/" + currentValue.Key, function (exists) {
  
          if (exists) {
            console.log("Skipping: " + currentValue.Key);
          }
          else {
            console.log("Retrieving: " + currentValue.Key);
            s3.getObject({ Bucket: argv.bucket, Key: currentValue.Key }, function (err, data) {
              if (err) console.log(err, err.stack); // an error occurred
              else {
  
                fsex.ensureDir(fileBasePath);
  
                fs.writeFile(argv.bucket + "/" + currentValue.Key, data.Body, function () {
                  console.log("Finished: " + currentValue.Key);
                });
  
              }
            });
  
          }
  
        });
  
      });
  
    }
  });
  