16e7c69efSopenharmony_ci# Zip and Unzip
26e7c69efSopenharmony_ci
36e7c69efSopenharmony_ci### Introduction
46e7c69efSopenharmony_ci
56e7c69efSopenharmony_ciThis sample demonstrates the use of @ohos.zlib. Below shows the sample app.
66e7c69efSopenharmony_ci
76e7c69efSopenharmony_ci![](screenshots/device/main.png)
86e7c69efSopenharmony_ci
96e7c69efSopenharmony_ci### Concepts
106e7c69efSopenharmony_ci
116e7c69efSopenharmony_ciZip: compresses a file or folder based on the passed file path to zip and the path of the zipped file.
126e7c69efSopenharmony_ci
136e7c69efSopenharmony_ciUnzip: decompresses a file or folder based on the passed file path to unzip and the path of the unzipped file.
146e7c69efSopenharmony_ci
156e7c69efSopenharmony_ci### Required Permissions
166e7c69efSopenharmony_ci
176e7c69efSopenharmony_ciN/A
186e7c69efSopenharmony_ci
196e7c69efSopenharmony_ci### Usage
206e7c69efSopenharmony_ci
216e7c69efSopenharmony_ci1. Touch **+** in the upper right corner of the sample app.
226e7c69efSopenharmony_ci
236e7c69efSopenharmony_ci2. In the **Create file** dialog box displayed, enter the file name and content, and touch **OK**.
246e7c69efSopenharmony_ci
256e7c69efSopenharmony_ci3. The file created is displayed on the home page. Touch **Zip**. A message is displayed, indicating that the file is compressed, and a **.zip** file with the same name is created in the file list.
266e7c69efSopenharmony_ci
276e7c69efSopenharmony_ci4. Touch **Unzip** next to the zipped file. A message is displayed, indicating that the file is decompressed, and a folder with the same name is created in the file list.
286e7c69efSopenharmony_ci
296e7c69efSopenharmony_ci### Constraints
306e7c69efSopenharmony_ci
316e7c69efSopenharmony_ci1. This sample can only be run on standard-system devices.
326e7c69efSopenharmony_ci
336e7c69efSopenharmony_ci2. This sample requires DevEco Studio 3.1 Canary1 (Build Version: 3.1.0.100, built on November 3, 2022) to compile and run.
346e7c69efSopenharmony_ci
356e7c69efSopenharmony_ci3. The paths passed in the `Zip` and `Unzip` APIs must be the relative paths obtained by the context API. Currently, `Zip` and `Unzip` support operations only on files in the app directory.
36