hash command is used to calculate the hash value of a local file or get the hash value of a file in COS.cos:HeadObject. For more authorizations, please refer to CAM-Enabled API../coscli hash <object-name> [flag]
hash includes the following parameters:Parameter Format | Description | Example |
<object-name> | Specifies the target file, which can be a local path or a COS file path. The COS path is accessible by using the bucket alias or bucket name configured in the configuration file as detailed in Download and Installation Configuration. If you use the bucket name for access, you also need to include the endpoint flag. | Local path: ~/example.txt COS file path specified with the bucket alias: cos://bucketalias/example.txt COS file path specified with the bucket name: cos://examplebucket-1250000000/example.txt |
hash command contains the following optional flags:Flag Abbreviation | Flag Name | Description |
-h | --help | Views the usage of this command. |
None | --type | Hash type, which can be MD5 or CRC64 (default) Note: The md5 can only obtain the etag. If you need to get the file md5, you can download the complete file and then calculate it. |
./coscli hash ~/test.txt
./coscli hash cos://bucket1/example.txt --type=md5
Feedback