0

我正在使用 Ruby 和 aws-sdk 从 S3 下载一个文件夹。如何检查每个文件是否下载成功?它只是检查本地机器上是否存在文件吗?

   File.open("#{meeting_dir}/#{o.key}","wb") do |f|
      f.write(o.read)
   end
4

1 回答 1

0

you can check the file size of the amazon key with S3Object#content_length method and compare it with the size of the downloaded file File.size 'downloaded_file'.

http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/S3/S3Object.html#content_length-instance_method

于 2013-08-20T17:08:46.020 回答