node.js - How to perform exact match for folder name with prefix using ListObjectsV2 AWS S3 node js sdk?
问题描述
Consider the below scenario in which I have faced the problem.
Let there be documents and documentscopy folder in S3 bucket.
var params = {
Bucket: BucketName,
MaxKeys: 500,
Prefix: 'documents'
}
s3.listObjectsV2(params, function (err, data) {
});
Above code provides all files in both documents and documentscopy.
What code change I have to do in order to get documents only?
解决方案
只需添加/
到您的Prefix
.
var params = {
Bucket: BucketName,
MaxKeys: 500,
Prefix: 'documents/'
}
推荐阅读
- angular - 为什么路线数据显示为空白?
- r - 如何计算与 S4 类关联的对象的数量
- verilog - Verilog DUT System Verilog 测试台:输出到线分配 1s 替换为 Xs
- java - 如何正确检查两个锯齿状数组的大小是否相同?
- javascript - 访问数据库正在创建问题
- docker - 在 Docker 客户端上配置代理后,Docker 容器内没有 http/https 连接
- graphql - 如何为 apollo 客户端生成片段类型?
- javascript - 如何在一定数量后结束我的图像网格并添加额外的页面以滚动浏览?
- javascript - 如何在前端和后端验证必填字段
- sql - 如何在 SQL 中混合两个结果(包括示例)