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

Corrupted files when downloading large zip file from S3

我在 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 限制或者这是一个错误?

这个问题似乎已经死了,但我会为登陆这里的任何人问这个问题:

Amazon S3 的分段上传(适用于大文件的上传)产生的 ETag 值不再匹配文件的 MD5,因此如果您将其用作校验和(看起来是在查看您收到的 MD5),它将不起作用.

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

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

问题已经解决,问题是 AWS SDK for nodejs。显然它不能使用流数据 fs.createReadStream() 上传大文件,所以我转而使用 Knox,它工作得很好