# MultiFileDownload **Repository Path**: harmonyos_samples/multi-file-download ## Basic Information - **Project Name**: MultiFileDownload - **Description**: 本示例为开发者展示常见的多文件下载,介绍如何使用request模块实现多个文件下载进度和状态的监听管理。 - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 15 - **Forks**: 10 - **Created**: 2024-06-15 - **Last Updated**: 2025-11-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Downloading Multiple Files ### Overview This sample shows how to use the APIs provided by the **request** module to listen for and manage the download progress and status of multiple files. ### Preview ![](./screenshots/device/download_EN.png) ### Instructions for Use 1. Fill the `downloadUrlArray` variable in the source code file Index.ets with the array of files to be downloaded, then compile and install. 2. Open the Index page, click the download button for a specific item in the queue, or click the "Start All" button. 3. During file download, the progress will be displayed. Click the button to pause the download, and click again to resume it. 4. After the file is successfully downloaded, Done will be displayed. If the download fails or encounters an error, an Failed tip will be shown. ### Project Directory ``` ├──entry/src/main/ets/ │ ├──constants │ │ └──Constants.ets // Common constants │ ├──entryability │ │ └──EntryAbility.ets // Entry ability │ ├──pages │ │ └──Index.ets // Home page │ └──view │ ├──FileDownloadItem.ets // List item │ └──ProgressButton.ets // Progress button └──entry/src/main/resources // Static resources of the app ``` ### How to Implement 1. On the Index page, use the **List** component to implement the download file list (enter the URLs of the files to be downloaded in the **downloadUrlArray** variable). 2. Use **FileDownloadItem** to implement the list view. 3. Set download parameters in each list item, create a download task, register a listener, obtain the file download status from the listener callback, and bind the data to the corresponding component. 4. Provide the start, pause, and resume operations for each download task. ### Required Permissions - **ohos.permission.INTERNET**: allows an app to access Internet. ### Dependencies N/A ### Constraints 1. The sample is only supported on Huawei phones with standard systems. 2. The HarmonyOS version must be HarmonyOS 5.0.5 Release or later. 3. The DevEco Studio version must be DevEco Studio 5.0.5 Release or later. 4. The HarmonyOS SDK version must be HarmonyOS 5.0.5 Release SDK or later.