const AWS = require('aws-sdk');
// Configure AWS credentials and region
AWS.config.update({
accessKeyId: 'xxxxxxxxx',
secretAccessKey: 'xxxxxxxx',
endpoint: 'https://s3.geovis.com',
s3ForcePathStyle: true, // Needed for local S3 implementation like minio
});
// Create S3 service object
const s3 = new AWS.S3();
// Define parameters for listing objects
const params = {
Bucket: 'gis'
};
// List objects in the bucket
s3.listObjects(params, function(err, data) {
if (err) {
console.log("Error", err);
} else {
console.log("Objects in the bucket:");
data.Contents.forEach(function(object) {
console.log(object.Key);
});
}
});
网友评论