All Products
Search
Document Center

Object Storage Service:ZIP package decompression

Last Updated:May 28, 2026

Configure decompression rules to automatically extract ZIP packages uploaded to a specified OSS directory. Function Compute decompresses the packages and saves the extracted objects to the destination directory.

Prerequisite

Function Compute is activated. To activate it, go to the Function Compute page.

Scenarios

  • Batch upload: Compress many small objects into a single ZIP package to reduce upload time.

  • Resource completeness: Bundle related files into one ZIP package to ensure all components are uploaded together.

  • Directory structure preservation: Package a local directory tree into a ZIP file and upload it to OSS. The decompression rule recreates the original folder structure in the bucket.

  • Content delivery: Compress objects into a ZIP package and upload it to OSS. The package is decompressed to specified directories, reducing transmission time and bandwidth usage.

How it works

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

image
  1. A ZIP package is uploaded to the directory specified by the Prefix parameter in a decompression rule.

  2. The Function Compute trigger is invoked.

    When you configure a decompression rule, authorize the trigger so that OSS can use the AliyunOSSEventNotificationRole role to access Function Compute.

  3. Function Compute decompresses the ZIP package and saves the extracted objects to the specified OSS directory.

    When you configure a decompression rule, authorize Function Compute to read from and write to the OSS bucket.

Billing

ZIP package decompression incurs fees in both OSS and Function Compute. Data transfers between OSS and Function Compute over internal endpoints are free of charge.

  • On the OSS side, you are charged for API operation calling and object storage. For more information, see Billing overview.

  • On the Function Compute side, you are charged for vCPU usage, memory usage and disk usage based on the execution duration. For more information, see Billing overview.

    For example, if a ZIP package decompression task uses a Function Compute instance that has 3 GB of memory and a 2-core vCPU and takes 5 minutes to complete decompression, and the default size of the disk allocated for temporarily created storage files is 10 GB, the amount of the fees charged by Function Compute is calculated based on the following formula:

Resource usage item

Unit

Formula

Billing example

vCPU usage

vCPU-seconds

Active vCPU usage = vCPU capacity × Execution duration (seconds)

If the function is configured with 2 vCPUs and runs for 300 seconds, the vCPU usage for a single run is calculated by using the following formula: 2 ×300 = 600 vCPU-seconds.

Memory usage

GB-seconds

Memory usage = Memory capacity (GB) × Execution duration (seconds)

If the function is configured with the memory size of 3GB and runs for 300 seconds, the memory usage for a single run is calculated by using the following formula: 3 ×300 = 900 GB-seconds

Disk usage

GB-seconds

Disk usage = Disk capacity (GB) × Execution duration (seconds)

Note: Disk usage up to 512 MB is free of charge.

If the function is configured with a temporary disk size of 10 GB and runs for 300 seconds, the disk usage for a single run is calculated by using the following formula: (10-512/1024) × 300 = 2850 GB-seconds.

Limitations

  • Storage classes: A Cold Archive object must be restored before it can be decompressed. An Archive object in a bucket for which real-time access of Archive objects is not enabled must also be restored before it can be decompressed.

  • Object and directory naming: Encode object and directory names in UTF-8 or GB 2312. Other encodings may cause decompression failures or garbled names.

  • Object size and decompression duration: Each object in a ZIP package cannot exceed 1 GB. You can increase the decompression duration if necessary. For more information, What do I do if a ZIP package fails to be decompressed due to a decompression timeout?

Configure a ZIP package decompression rule

  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 tree, choose Data Processing > Decompress ZIP Package.

  4. Click Decompress ZIP Package. In the Decompress ZIP Package panel, configure the parameters described in the following table.

    Parameters

    Parameter

    Required

    Description

    Service Authorization

    Yes

    Authorize Function Compute to read from and write 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 instead of the Authorize Trigger parameter.

    Prefix

    No

    The prefix that ZIP package names must match to trigger decompression. If you upload a ZIP package whose name contains this prefix or upload it to the directory specified by the prefix, Function Compute decompresses it. If not specified, all ZIP packages uploaded to the bucket 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

    The directory where extracted objects are stored. If not specified, objects are decompressed to the root directory of the bucket.

    • To store extracted objects in a subdirectory named after the ZIP package, select Add the compressed object name to the destination directory.

    • To store extracted objects directly in the destination directory without a subdirectory, select Decompress to the destination directory. The following table shows configuration examples.

    Warning

    To prevent service disruption, data contamination, or data loss when configuring rules for ZIP package decompression on a bucket with OSS-HDFS enabled, do not set the Destination Directory to.dlsdata/.

    Decompression configuration examples

    Scenario

    Configuration method

    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 names as the packages in the root directory of the bucket.

    Configure the following parameters:

    • Set Prefix to zipfolder/.

    • Leave Destination Directory empty.

    • 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 names as the packages in the destfolder directory.

    Configure the following parameters:

    • 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.

Modify a ZIP package decompression rule

Modify a decompression rule to update the trigger prefix or function configurations.

Modify the Prefix parameter

  1. On the Decompress ZIP Package page in the OSS console, find the trigger that you want to modify and click Edit in the Actions column.

  2. On the Triggers tab of the function details page, find the trigger and click Modify in the Actions column.

  3. In the Modify Trigger panel, modify the Object Prefix parameter and retain the default settings for other parameters.

  4. Click OK.

Modify function configurations

  1. On the Configurations tab of the function details page, click Modify in the Basic Settings section or the Environment Information section.

  2. Modify the function configurations, such as Memory and Execution Timeout Period.

    For more information, see Manage functions.

Delete a trigger

Note

Deleted triggers cannot be restored. Deleting a trigger does not interrupt ongoing decompression tasks.

  1. On the Triggers tab of the function details page, find the trigger that you want to delete and click Delete in the Actions column.

  2. In the message that appears, click Delete.

Reference

Package and download objects as a ZIP file

FAQ

What do I do if a ZIP package upload fails to trigger a Function Compute decompression task?

Check the Base64-encoded x-oss-event-status response header. If the decoded value of x-oss-event-status is {"Result": "Ok"}, decompression was triggered. If the decoded value of x-oss-event-status is not {"Result": "Ok"}, re-upload the ZIP package. For more information, see Simple upload.

Note

Each object in a ZIP package cannot exceed 1 GB. The default maximum decompression duration is 2 hours.

What do I do if a ZIP package fails to be decompressed due to a decompression timeout?

The default maximum decompression duration is 2 hours, which can be increased to 24 hours. To modify the duration:

  1. On the Decompress ZIP Package page in the OSS console, find the trigger that you want to modify and click Edit in the Actions column.

  2. On the function details page, click the Configurations tab.

  3. Click Modify next to Environment Information.

  4. Modify the value of the Execution Timeout Period field and click OK.

How do I decompress a package that contains an object larger than 1 GB in size?

If an object in a ZIP package exceeds 1 GB, store the package in File Storage NAS and decompress it there. This incurs NAS storage fees. See the unzip-oss-nas GitHub repository.

Does Function Compute decompress a ZIP package that is within another ZIP package?

No. Function Compute decompresses the ZIP package only once.

If the ZIP package contains nested ZIP packages, the inner packages are not decompressed. Upload them separately to trigger another decompression task.

Does ZIP package decompression allow data to be decompressed to a different bucket?

No. Decompression is limited to directories within the same bucket. To decompress to a different bucket, implement a custom function in Function Compute.

Do extracted objects during decompression of a ZIP package appear in the destination directory synchronously?

Yes. Function Compute uploads extracted objects to the destination directory while continuing to decompress the remaining data.

Function Compute uploads decompressed objects from a ZIP package to OSS while it decompresses the remaining data in the package.

How do I check whether a decompression task is complete?

View the function invocation logs to check decompression status.

  1. On the Decompress ZIP Package page in the OSS console, find the trigger and click Edit in the Actions column.

  2. On the function details page, click the Logs tab.

  3. Click Enable.

  4. Attach the AliyunLogFullAccess policy to the RAM role. For more information, see Manage permissions for a RAM role.

  5. If a decompression task is triggered on a ZIP package upload, view the log information on the Logs tab to check if decompression is complete.

    If the log contains "FC Invoke End", the decompression task is complete.

    image.png

Does ZIP package decompression support .rar and .tar.gz files?

No. Only .zip files are supported.

ZIP package decompression supports only ZIP files.

Is a notification sent after completion of decompression?

No.

Check the Logs tab of the function details page, or configure an asynchronous invocation destination. For more information, see Destinations for asynchronous invocations.

Does OSS support online compression?

No, OSS does not support online compression.

Use Function Compute to package and download objects. Use Function Compute to package and download OSS objects.

Can I use ZIP package decompression to decompress multipart ZIP packages?

No. ZIP package decompression cannot merge or decompress multipart (split) ZIP archives.

ZIP package decompression does not merge content from multipart ZIP packages. Therefore, the feature cannot decompress multipart ZIP packages.

Why is the Decompress ZIP Package button grayed out?

  • Function Compute is not activated. Activate it on the Function Compute page.

  • ZIP package decompression is not supported in the region of your bucket. For more information, see Limitations.