Errors may occur when data is being transmitted between the client and the server. Cloud Object Storage (COS) combined with Serverless Cloud Function (SCF) can ensure the integrity of uploaded data through data verification, for example, MD5 verification. When users upload files to COS, SCF will help verify the objects uploaded by the users to ensure the integrity and correctness of the uploaded data.
None of the existing public cloud object storage services in the industry provides MD5 verification, and after a user uploads a file, the following situations may occur:
Log in to the COS console.
create a workflow, customize a format filter rule, and create a custom function node,For detailed steps, see Configuring a Workflow.
In the function node pop-up window, click Add Function.
On the SCF creation page, select the Calculate COS object hash template.
Based on the user's file size, configure the execution timeout period in the basic settings and configure sufficient memory in the advanced settings.
Configure the function code. This function template supports the following two environment variables:
["crc64", "md5", "sha1", "sha256"]
.lowercase
. You can also pass in uppercase
.Enable permission configuration and bind a role that has the read/write permission of the current bucket. If you need to create an execution role, see Role and Authorization.
Click Finish.
Go back to the previous workflow page, select the custom transcoding function created just now, and save the workflow.
Upload the file. After the workflow processing is successful, you can see that multiple hash headers are successfully added to the uploaded file.
Apakah halaman ini membantu?