简体   繁体   English

使用nodejs knox从s3存储桶中删除所有文件?

[英]Remove all files from s3 bucket using nodejs knox?

I am using knox npm module to upload files to a bucket on S3. 我正在使用knox npm模块将文件上传到S3上的存储桶。 It works great. 效果很好。 What I am not sure how to do is how to remove all the files from a bucket in one call instead of deleting one file at the time? 我不确定该怎么做,如何一次调用一次从存储桶中删除所有文件,而不是一次删除一个文件?

any idea would help... 任何想法都会有所帮助...

This has not been possible in the past, however, Amazon has finally introduced Amazon S3 - Multi-Object Delete in December 2011: 过去这是不可能的,但是,Amazon终于在2011年12月推出了Amazon S3-多对象删除

Amazon S3's new Multi-Object Delete gives you the ability to delete up to 1000 objects from an S3 bucket with a single request. Amazon S3的新多对象删除功能使您能够通过一个请求从S3存储桶中删除多达1000个对象。

Obviously client libraries like knox must add dedicated support for this API now in turn, and a respective issue does indeed exist already in knox' issue tracker (still pending as of today), see Multi-Object Delete . 显然,像knox这样的客户端库现在必须依次添加对此API的专用支持,并且knox的问题跟踪器中确实已经存在相应的问题(直到今天仍在悬而未决),请参阅“ 多对象删除”

Accordingly you should monitor this issue and/or participate in the implementation :) 因此,您应该监视此问题和/或参与实施:)


My AwsSum library can already do multi object delete. 我的AwsSum库已经可以执行多对象删除。 The operation in the library is called 'DeleteMultipleObjects': 库中的操作称为“ DeleteMultipleObjects”:

You can install AwsSum via npm doing: 您可以通过npm安装AwsSum:

$ npm install awssum $ npm安装awssum

There is an example here: 这里有一个例子:

Hope it goes well and give me a shout if you need any assistance. 希望一切顺利,如果您需要任何帮助,请给我大喊。 :) :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM