lib/cf-resources/api-gateway-resource/s3-utility.js
function(bucket, key, version, localPath) {
        return S3.getObject({
            Bucket: bucket,
            Key: key,
            VersionId: version
        }).promise().then(function(data) {
            return new Promise(function(resolve, reject) {
                fs.writeFile(localPath, data.Body, function(err) {
                    if (err) return reject(err);
                    resolve(localPath);
                });
            });
        });
    }
function(bucket, key, version, localPath) {
        return S3.getObject({
            Bucket: bucket,
            Key: key,
            VersionId: version
        }).promise().then(function(data) {
            return new Promise(function(resolve, reject) {
                fs.writeFile(localPath, data.Body, function(err) {
                    if (err) return reject(err);
                    resolve(localPath);
                });
            });
        });
    }
function ( bucket , key , version , localPath ) { return S3 . getObject ( { Bucket : bucket , Key : key , VersionId : version } ) . promise ( ) . then ( function ( data ) { return new Promise ( function ( resolve , reject ) { fs . writeFile ( localPath , data . Body , function ( err ) { if ( err ) return reject ( err ) ; resolve ( localPath ) ; } ) ; } ) ; } ) ; }
Download a file from remote bucket to a local path

@return {Promise} which resolves to the local path the file was saved to
Download a file from remote bucket to a local path