【问题标题】:How to delete a file from S3 using full path to the file instead of key for the file如何使用文件的完整路径而不是文件的密钥从 S3 中删除文件
【发布时间】:2021-04-05 10:40:42
【问题描述】:

我正在尝试从 AWS s3 中删除一个文件。我没有那个文件的密钥。相反,我有该文件的完整路径 URL。 喜欢:https://atlms.s3.ap-south-1.amazonaws.com/folder/606ae1d032b0e7asdfkjh.image

我可以这样删除文件吗:

const fileParams: S3.Types.PutObjectRequest = {
Bucket: bucketPath,
Key: key //here I have only the URL to the file 
}
s3.deleteObject(fileParams, function (error) {
console.log(error);
})

【问题讨论】:

    标签: javascript node.js amazon-s3 amazon-iam


    【解决方案1】:

    您可以从 URL 中提取 S3 密钥。在这种情况下,S3 密钥是folder/606ae1d032b0e7asdfkjh.image

    【讨论】:

      猜你喜欢
      • 2016-05-15
      • 2023-01-13
      • 2018-10-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多