问题
Google provide a great documentation for their cloud services, but unfortunately nobody can understand the content.
Their explanation always jumping and leave people with no clue to accomplish even a simple task.
Creating tsv file should be a simple task.
I tried to follow everything in this page Creating a URL List but stuck with "unknown error" log. Unknown error means I never know what I am doing wrong.
They gave example downloaded file md5-test a string "Storage Transfer MD5 Test" => BfnRTwvHpofMOn2Pq7EVyQ==
I can successfully verify the md5-test file with
`openssl md5 -binary md5-test | openssl enc -base64`
to get hash "BfnRTwvHpofMOn2Pq7EVyQ=="
Is it mean the hash for "Storage Transfer MD5 Test" is "BfnRTwvHpofMOn2Pq7EVyQ==" ?
They gave different string in their example code:
TsvHttpData-1.0
https://example.com/buckets/obj1 1357 wHENa08V36iPYAsOa2JAdw== https://example.com/buckets/obj2 2468 R9acAaveoPd2y8nniLUYbw==
It is not match, and leave me with no clue which object should be encoded?
Why don't they just gave the download file content the same with the example code?
What string will generate "wHENa08V36iPYAsOa2JAdw==" ?
I have tried to put every part of the example code in the md5-test file and run openssl md5 -binary md5-test | openssl enc -base64
but can not get that example hash.
回答1:
The md5-test file is used to verify that you can generate md5 hashes correctly. Since you're getting the correct md5 hash BfnRTwvHpofMOn2Pq7EVyQ==
from this file, you're all set for generating Base64-encoded MD5 hashes.
Now you'll need to generate one for each file you'd like to include in your TSV file by running locally the following command:
openssl md5 -binary <your_file_name> | openssl enc -base64
which will give you a new Base64-encoded MD5 hash for each file. You can then upload the files to their final destination and create the TSV file accordingly. To take the example provided in the documentation, and let's say you'd like to include the md5-test file in your URL list, the resulting TSV file would look like this:
TsvHttpData-1.0
https://storage.googleapis.com/md5-test/md5-test 26 BfnRTwvHpofMOn2Pq7EVyQ== https://example.com/buckets/obj1 1357 wHENa08V36iPYAsOa2JAdw== https://example.com/buckets/obj2 2468 R9acAaveoPd2y8nniLUYbw==
来源:https://stackoverflow.com/questions/48703123/how-to-create-a-tsv-file-on-google-storage-transfer