This topic describes how to use Intelligent Media Management (IMM) to compress one or more objects stored in Object Storage Service (OSS), query file content in a package, and decompress a package. Compression and decompression are useful in many scenarios, such as data transmission, backup, and archiving. You can use compression and decompression to efficiently manage and process data in a bucket. For example, you can use this feature to improve data transmission speed, reduce storage usage, and facilitate data archiving and sharing.
Feature overview
IMM supports compression and decompression of files in the cloud, which improves efficiency and simplifies file management. You can use IMM to compress and decompress objects online in OSS.
Prerequisites
An AccessKey pair is created and obtained. For more information, see Create an AccessKey pair.
OSS is activated, a bucket is created, and objects are uploaded to the bucket. For more information, see Upload objects.
IMM is activated. For more information, see Activate IMM.
A project is created in the IMM console. For more information about how to create a project by using the IMM console, see Create a project.
NoteYou can also call the CreateProject operation to create a project. For more information, see CreateProject.
You can call the ListProjects operation to query existing projects in a specific region. For more information, see ListProjects.
Supported formats
The compression feature only supports packaging operations.
The compression feature only supports the ZIP format.
The decompression and package preview features support ZIP, RAR, and 7z formats.
Notes
Information of compression, package read, and decompression tasks is retained for 7 days after the task start date and cannot be queried after the 7-day window ends. You can use one of the following methods to query task information:
In the region in which the IMM project is located, configure a Simple Message Queue (SMQ) subscription to receive task information notifications.. For more information, see Asynchronous message examples. For information about the MNS SDK, see Step 4: Receive and delete the message.
In the region in which the IMM project is located, create an ApsaraMQ for RocketMQ 4.0 instance, a topic, and a group to receive task notifications. For more information, see Asynchronous message examples. For information about how to use ApsaraMQ for RocketMQ, see Use HTTP client SDKs to send and subscribe to normal messages.
In the region in which the IMM project is located, use EventBridge to receive task information notifications. For more information, see IMM events.
Compression
Call the CreateFileCompressionTask - Create a file compression task operation to compress multiple objects in an OSS bucket.
Compression information
IMM project: test-project
Objects to compress:
oss://test-bucket/test-object1.jpg
oss://test-bucket/test-object2.jpg
oss://test-bucket/test-object3.jpg
oss://test-bucket/test-object4.jpg
Output path: oss://test-bucket/test-target-object.zip
Request example
{
"ProjectName": "test-project",
"CompressedFormat": "zip",
"Sources": "[{\"URI\":\"oss://test-bucket/test-object1.jpg\"},{\"URI\":\"oss://test-bucket/test-object2.jpg\"},{\"URI\":\"oss://test-bucket/test-object3.jpg\"},{\"URI\":\"oss://test-bucket/test-object4.jpg\"}]",
"TargetURI": "oss://test-bucket/test-target-object.zip"
}Response example
{
"TaskId": "FileCompression-7e3e2b8c-81bd-495f-a338-25b3762a****",
"RequestId": "C54C5888-9C96-5A35-AF73-ABD6EF15****",
"EventId": "164-1S6uXTYhUU4qAFCPOTcYdcb****"
}Sample code
Query package content
Call the CreateArchiveFileInspectionTask - Create a package parsing task operation to query the content of a package in OSS.
Package information
Project name: test-project
Path of the package: oss://test-bucket/test-target-object.zip
Output path: oss://test-bucket/test-target-object.json
Request example
{
"ProjectName": "test-project",
"SourceURI": "oss://test-bucket/test-target-object.zip",
"TargetURI": "oss://test-bucket/test-target-object.json"
}Response example
{
"TaskId": "ArchiveFileInspection-4a7c308a-5671-4d34-ba41-86a942d0****",
"RequestId": "20D23855-C9E6-5193-8939-3A8797E1****",
"EventId": "2AB-1S53L6FTdU6yMxkc1JgpwcV****"
}Sample code
Decompression
Call the CreateFileUncompressionTask - Create a decompression task operation to decompress a package in OSS.
Decompression information
Project name: test-project
Path of the package: oss://test-bucket/test-target-object.zip
Object to decompress: test-object1.jpg
Output path: oss://test-bucket/test-target-object
Request example
{
"ProjectName": "test-project",
"SourceURI": "oss://test-bucket/test-target-object.zip",
"Target": "{\"URI\":\"oss://test-bucket/test-target-object\"}",
"SelectedFiles": "[\"test-object1.jpg\"]"
}Response example
{
"TaskId": "FileUncompression-f31061ab-eaeb-469d-ac8f-9af10e5d****",
"RequestId": "20115435-9F59-58C0-8D15-E6ECC096****",
"EventId": "3B6-1S6ywKAB2ogXJnrzmk6tFUF****"
}Sample code
Billing
During package file decompression, the following billing items are generated on the OSS and IMM sides:
OSS side: For more information about pricing, see OSS Pricing.
API
Billing item
Description
GetObject
GET requests
You are charged request fees based on the number of successful requests.
outbound traffic over Internet
If you call the GetObject operation by using a public endpoint, such as oss-cn-hangzhou.aliyuncs.com, or an acceleration endpoint, such as oss-accelerate.aliyuncs.com, you are charged fees for outbound traffic over the Internet based on the data size.
Retrieval of IA objects
If IA objects are retrieved, you are charged IA data retrieval fees based on the size of retrieved IA objects.
Data Retrieval Capacity from Archive Direct Read
If Archive objects in a bucket for which real-time access is enabled are retrieved, You are charged Archive data retrieval fees based on the size of retrieved Archive objects.
Transfer acceleration
If you enable transfer acceleration and use an acceleration endpoint to access your bucket, you are charged transfer acceleration fees based on the data size.
IMM side: For more information about pricing, see IMM billing items.
ImportantStarting from 11:00 on July 28, 2025 (UTC+8), IMM file compression and decompression services will be upgraded from a free model to a paid model. For more information, see IMM billing adjustment announcement.
API
Billing item
Description
CreateFileCompressionTask
FileProcess
You are charged compression fees based on the size of source files to compress.
CreateFileUncompressionTask
You are charged decompression fees based on the size of decompressed files.
CreateArchiveFileInspectionTask
FilePreview
You are charged preview fees based on the size of the package to preview.
FAQ
How do I know whether a CreateFileCompressionTask operation has finished creating a package?
You can call the GetTask - Query task information operation to poll the task status, or use Example of asynchronous task lightweight message queue (formerly MNS) message processing to asynchronously receive success messages.
Can I use the CreateFileCompressionTask operation to compress objects from different OSS buckets into a single package?
Yes, you can compress objects from different OSS buckets into a single package if you have the required permissions.