从S3下载大型zip文件时损坏的文件

时间:2016-08-25 10:03:48

标签: amazon-s3 zip s3cmd

我在S3存储桶上有一个大小为1 GB的zip文件。下载后,我似乎无法解压缩它。它总是说

End-of-central-directory signature not found.  Either this file is not
a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.

稍后,我再次使用s3cmd下载它。它说

WARNING: MD5 signatures do not match: computed=384c9a702c2730a6b46d21606137265d, received="b42099447c7a1a390d8e7e06a988804b-18"

我是否需要了解s3限制或这是一个错误?

2 个答案:

答案 0 :(得分:1)

这个问题似乎已经死了,但我会问任何人来这里:

Amazon S3的分段上传(适用于大文件)会产生不再与文件MD5匹配的ETag值,因此如果您将其用作校验和(因为它看起来像是您收到的MD5),它将无效。 / p>

您可以做的最好的验证是确保将ContentMD5标头添加到您的分段上传的每个部分的标题中,确保文件在上传过程中不会被破坏,并添加您自己的MD5元数据字段以便在下载后检查数据。

答案 1 :(得分:0)

感谢@ergoithz提醒我有这个问题:)

问题已经修复,使用AWS SDK for nodejs就是问题所在。显然它无法使用流数据fs.createReadStream()上传大文件,所以我切换到使用Knox完美运行的地方

相关问题