# FileDownloader **Repository Path**: HarmonyOS-tpc/FileDownloader ## Basic Information - **Project Name**: FileDownloader - **Description**: HarmonyOpenSource multi-task file download engine. - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 7 - **Forks**: 3 - **Created**: 2021-04-01 - **Last Updated**: 2025-02-12 ## Categories & Tags **Categories**: harmonyos-network **Tags**: None ## README # FileDownloader HarmonyOpenSource multi-task file download engine. ## DEMO ![][single_demo_gif] ![][chunked_demo_gif] ![][serial_tasks_demo_gif] ![][parallel_tasks_demo_gif] ![][tasks_manager_demo_gif] ![][hybrid_test_demo_gif] ![][avoid_drop_frames_1_gif] ![][avoid_drop_frames_2_gif] ## Installation FileDownloader is installed by adding the following dependency to your `build.gradle` file: ```groovy dependencies { implementation 'io.openharmony.tpc.thirdlib:filedownloader:1.0.1' } ``` ## Open customize component From now on, FileDownloader support following components to be customized by yourself: | Name | Interface | Default Impl | --- | --- | --- | Connection | FileDownloadConnection | FileDownloadUrlConnection | OutputStream | FileDownloadOutputStream | FileDownloadRandomAccessFile | Database | FileDownloadDatabase | RemitDatabase | ConnectionCountAdapter | ConnectionCountAdapter | DefaultConnectionCountAdapter | IdGenerator | IdGenerator | DefaultIdGenerator | ForegroundServiceConfig | ForegroundServiceConfig | ForegroundServiceConfig > - If you don't want to use any database on FileDownloader(the database on FileDownloader is used for persist tasks' breakpoint info) just using NoDatabaseImpl.java ### How to valid it? Just create your own `DownloadMgrInitialParams.InitCustomMaker` and put those customized component to it, finally init the FileDownloader with it: FileDownloader#init ## Adaptation According to the [migration notes](https://developer.android.com/about/versions/pie/android-9.0-migration#tya), the FOREGROUND_SERVICE permission has been added to the library manifest since FileDownloader 1.7.6. ![][structure-img] ![][message-system-img] ## Usage By default, the FileDownloadService runs on the separate process, if you want to run it on the main process, just configure on the filedownloader.properties, and you can use `FileDownloadUtils.isDownloaderProcess(Context)` to check whether the FileDownloadService can run on the current process. ## LICENSE ``` Copyright (c) 2015 LingoChamp Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ``` [structure-img]: art/structure.png [message-system-img]: art/message-system.png [hybrid_test_demo_gif]: art/hybrid_test_demo.gif [parallel_tasks_demo_gif]: art/parallel_tasks_demo.gif [serial_tasks_demo_gif]: art/serial_tasks_demo.gif [tasks_manager_demo_gif]: art/tasks_manager_demo.gif [avoid_drop_frames_1_gif]: art/avoid_drop_frames1.gif [avoid_drop_frames_2_gif]: art/avoid_drop_frames2.gif [single_demo_gif]: art/single_demo.gif [chunked_demo_gif]: art/chunked_demo.gif