All Products
Search
Document Center

Object Storage Service:ZIP package decompression

Last Updated:Sep 20, 2023

Object Storage Service (OSS) can automatically decompress ZIP packages uploaded to buckets. After you configure decompression rules for a bucket, all ZIP packages uploaded to the path specified in the rules are automatically decompressed.

Prerequisites

  • Function Compute is activated. If Function Compute is not activated, activate it on the Function Compute page.

  • ZIP package decompression is supported in the following regions:China (Hangzhou), China (Shanghai), China (Qingdao), China (Beijing), China (Zhangjiakou), China (Hohhot), China (Shenzhen), China (Chengdu), China (Hong Kong), Singapore, Australia (Sydney), Malaysia (Kuala Lumpur), Indonesia (Jakarta), Japan (Tokyo), Germany (Frankfurt), UK (London), US (Virginia), US (Silicon Valley), and India (Mumbai).

Background information

OSS uses Function Compute to decompress uploaded ZIP packages. The following flowchart shows the decompression process.

When a ZIP package that matches a configured decompression rule is uploaded to OSS, Function Compute automatically decompress the ZIP package. Objects extracted from the ZIP package are stored in the specified directory in OSS.

Usage notes

  • We recommend that you encode your object or directory names in UTF-8 or GB 2312. Otherwise, the object or directory names after decompression may be garbled, or the decompression process may be unexpectedly interrupted.

  • If the storage class of objects in a ZIP package is Cold Archive, you must restore the objects before the package can be decompressed.

  • If the storage class of objects in a ZIP package is Archive and real-time access of Archive objects is not enabled for the bucket in which the package is stored, you must restore the objects before the package can be decompressed.

  • The maximum time that can be consumed to decompress a ZIP package is 2 hours. If a decompression task lasts more than 2 hours, the task fails.

  • We recommend that each object packed into a ZIP package does not exceed 1 GB in size to reduce decompression failures.

  • ZIP package decompression is a value-added service. Function Compute calculates the fees based on the amount of time that is consumed to decompress ZIP packages. For more information, see Billing overview.

Configure rules for ZIP package decompression

  1. Log on to the OSS console.

  2. In the left-side navigation pane, click Buckets. On the Buckets page, find and click the desired bucket.

  3. In the left-side navigation pane, choose Data Processing > Decompress ZIP Package.

  4. Click Decompress ZIP Package. In the Decompress ZIP Package panel, configure decompression rules for ZIP packages.

    • Parameter description

      Parameter

      Required

      Description

      Service Authorization

      Yes

      Authorize Function Compute to read data from and write data to OSS and to execute functions.

      Click Authorize. Complete authorization on the page that appears.

      Authorize Trigger

      Yes

      Authorize OSS to access Function Compute.

      Click Authorize. Complete authorization on the page that appears. If OSS is authorized to access Function Compute, the Trigger Role parameter is displayed in place of the Authorize Trigger parameter.

      Prefix

      No

      The prefix that package names must contain to trigger Function Compute to decompress a ZIP package. If you upload a ZIP package whose name contains the specified prefix or upload a ZIP package to the directory specified by the prefix, Function Compute is triggered to decompress the ZIP package. If you do not specify this parameter, all uploaded ZIP packages are decompressed.

      Important

      If you do not specify this parameter, the decompression tasks may be repeatedly executed. Therefore, we recommend that you specify a prefix for each decompression rule. For more information, see How can I avoid trigger loops?.

      Destination Directory

      No

      Specify the directory in which the objects extracted from the ZIP package are stored. If you do not specify this parameter, Function Compute decompresses the ZIP package to the root directory of the current bucket. If you want to store the objects extracted from a ZIP package in a subdirectory that has the same name as the package in the destination directory, select Add the compressed object name to the destination directory. If you want to store the objects extracted from a ZIP package in the destination directory, select Decompress to the destination directory. For more information about the configuration of this parameter, see the examples in the following table.

      Warning

      To maintain OSS-HDFS availability and prevent data contamination, do not set Destination Directory to .dlsdata/ when you configure a ZIP package extraction rule for a bucket for which OSS-HDFS is enabled.

    • Decompression configuration examples

      Scenario

      Configuration

      Storage structure after decompression

      Decompress all ZIP packages uploaded to the zipfolder directory to the destfolder directory, without creating subdirectories that have the same names as the ZIP packages.

      • Set Prefix to zipfolder/.

      • Set Destination Directory to destfolder.

      • Select Decompress to the destination directory.

      bucket  
      ├─── zipfolder/   
      │    ├─── a.zip
      │    └─── b.zip
      └─── destfolder/
           ├─── a.txt
           ├─── b.txt
           └─── ...

      Decompress all ZIP packages uploaded to the zipfolder directory to the subdirectories that have the same name as the packages in the root directory of the bucket.

      • Set Prefix to zipfolder/.

      • Leave Destination Directory unspecified.

      • Select Add the compressed object name to the destination directory.

      bucket  
      ├─── zipfolder/   
      │    ├─── a.zip
      │    └─── b.zip
      ├─── a/
      │    ├─── a.txt
      │    └─── ...
      └─── b/
           ├─── b.txt
           └─── ...

      Decompress all ZIP packages uploaded to the zipfolder directory to the subdirectories that have the same name as the packages in the destfolder directory.

      • Set Prefix to zipfolder/.

      • Set Destination Directory to destfolder.

      • Select Add the compressed object name to the destination directory.

      bucket  
      ├─── zipfolder/   
      │    ├─── a.zip
      │    └─── b.zip
      └─── destfolder/
           ├─── a/
           │    ├─── a.txt
           │    └─── ...
           └─── b/
                ├─── b.txt
                └─── ...
  5. Select I have read the terms of service and agreed to activate Function Compute and process compressed files by using Function Compute. Only file or folder names encoded in UTF-8 or GB 2312 can be processed. and click OK.