Created
May 3, 2018 16:13
-
-
Save mbklein/75e124686346462dc4024a93c74cb151 to your computer and use it in GitHub Desktop.
AWS Fixity Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[1] pry(main)> require 'aws-sdk-s3' | |
=> true | |
[2] pry(main)> require 'digest/md5' | |
=> true | |
[3] pry(main)> | |
[4] pry(main)> obj = Aws::S3::Object.new(bucket_name: 'avr-masterfiles-staging-rd56wk8', key: 'preservation/b2/77/3w/17/b2773w177/1_Sec_audio.ogg') | |
=> #<Aws::S3::Object:0x00007fe902b147f0 | |
@bucket_name="avr-masterfiles-staging-rd56wk8", | |
@client=#<Aws::S3::Client>, | |
@data=nil, | |
@key="preservation/b2/77/3w/17/b2773w177/1_Sec_audio.ogg"> | |
[5] pry(main)> obj.etag | |
=> "\"00e54f93a1b6edd40685dc303f6a17c9\"" | |
[6] pry(main)> | |
[7] pry(main)> md5 = Digest::MD5.new | |
=> #<Digest::MD5: d41d8cd98f00b204e9800998ecf8427e> | |
[8] pry(main)> obj.get { |chunk| md5 << chunk } | |
=> #<struct Aws::S3::Types::GetObjectOutput | |
body=#<Seahorse::Client::BlockIO:0x00007fe903c177a0 @block=#<Proc:0x00007fe903bd5f80@(pry):6>, @size=3188734>, | |
delete_marker=nil, | |
accept_ranges="bytes", | |
expiration=nil, | |
restore=nil, | |
last_modified=2018-04-30 19:57:52 +0000, | |
content_length=3188734, | |
etag="\"00e54f93a1b6edd40685dc303f6a17c9\"", | |
missing_meta=nil, | |
version_id=nil, | |
cache_control=nil, | |
content_disposition=nil, | |
content_encoding=nil, | |
content_language=nil, | |
content_range=nil, | |
content_type="binary/octet-stream", | |
expires=nil, | |
expires_string=nil, | |
website_redirect_location=nil, | |
server_side_encryption=nil, | |
metadata={}, | |
sse_customer_algorithm=nil, | |
sse_customer_key_md5=nil, | |
ssekms_key_id=nil, | |
storage_class=nil, | |
request_charged=nil, | |
replication_status=nil, | |
parts_count=nil, | |
tag_count=nil> | |
[9] pry(main)> md5.to_s | |
=> "00e54f93a1b6edd40685dc303f6a17c9" | |
[10] pry(main)> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment