AWS S3与JS/Node SDK同步

时间:2022-11-26 23:02:54

Amazon Web Services' (AWS) Command Line Interface (CLI) has a sync command. Unfortunately AWS CLI's sync method is a bit buggy. I'd like to sync to S3 using a gulp build process and Amazon's javascript/node SDK. Unfortunately, the SDK doesn't seem to have a sync method -- or does it?

Amazon Web Services (AWS)命令行接口(CLI)有一个同步命令。不幸的是,AWS CLI同步方法存在一些问题。我想使用gulp构建过程和Amazon的javascript/节点SDK同步到S3。不幸的是,SDK似乎没有同步方法——或者它没有?

What is the best way to sync whole directories in node with AWS S3?

用AWS S3同步节点中的整个目录的最佳方式是什么?

1 个解决方案

#1


1  

The AWS CLI is more stable now. So, my solution:

AWS CLI现在更加稳定。所以,我的解决方案:

gulp.task("sync-buckets", done => {
    let conf = loadConf();
    exec(`aws s3 sync --acl public-read bucket/www_static/ s3://${conf.BucketName}`, done);
});

#1


1  

The AWS CLI is more stable now. So, my solution:

AWS CLI现在更加稳定。所以,我的解决方案:

gulp.task("sync-buckets", done => {
    let conf = loadConf();
    exec(`aws s3 sync --acl public-read bucket/www_static/ s3://${conf.BucketName}`, done);
});