s3_list.js
1 2 3 4 5 6 7 8 9 10 11 | var AWS = require( 'aws-sdk' ); AWS.config.region = 'ap-northeast-2' ; var s3 = new AWS.S3(); s3.listObjects({Bucket: 'codingeverybody2' }).on( 'success' , function handlePage(response) { for ( var name in response.data.Contents){ console.log(response.data.Contents[name].Key); } if (response.hasNextPage()) { response.nextPage().on( 'success' , handlePage).send(); } }).send(); |