@capgo/capacitor-downloader

June 16, 2026 · View on GitHub

Capgo - Instant updates for Capacitor

➡️ Get Instant updates for your App with Capgo

Missing a feature? We’ll build the plugin for you 💪

Download file in background or foreground

Why Capacitor Downloader?

A reliable native file downloader built for Capacitor apps that continues downloads even when your app is backgrounded or closed:

  • Background downloads - Downloads continue even when app is minimized, backgrounded, or closed (main advantage)
  • Progress tracking - Real-time progress updates during downloads
  • Network control - Choose between WiFi-only or cellular network downloads
  • Custom headers - Add authentication tokens and custom HTTP headers
  • Resumable downloads - Pause and resume downloads (platform dependent)
  • Event listeners - Monitor download progress, completion, and failures
  • Large file support - Handle multi-gigabyte files without memory issues
  • Free and open source - No paid services required

Perfect for downloading large media files, offline content, app updates, and any scenario where downloads need to survive app lifecycle events.

Documentation

The most complete doc is available here: https://capgo.app/docs/plugins/downloader/

Compatibility

Plugin versionCapacitor compatibilityMaintained
v8.*.*v8.*.*
v7.*.*v7.*.*On demand
v6.*.*v6.*.*
v5.*.*v5.*.*

Note: The major version of this plugin follows the major version of Capacitor. Use the version that matches your Capacitor installation (e.g., plugin v8 for Capacitor 8). Only the latest major version is actively maintained.

Install

You can use our AI-Assisted Setup to install the plugin. Add the Capgo skills to your AI tool using the following command:

npx skills add https://github.com/cap-go/capacitor-skills --skill capacitor-plugins

Then use the following prompt:

Use the `capacitor-plugins` skill from `cap-go/capacitor-skills` to install the `@capgo/capacitor-downloader` plugin in my project.

If you prefer Manual Setup, install the plugin by running the following commands and follow the platform-specific instructions below:

npm install @capgo/capacitor-downloader
npx cap sync

API

Capacitor plugin for downloading files with background support. Provides resumable downloads with progress tracking.

download(...)

download(options: DownloadOptions) => Promise<DownloadTask>

Start a new download task.

ParamTypeDescription
optionsDownloadOptions- Download configuration

Returns: Promise<DownloadTask>


pause(...)

pause(options: { id: string; }) => Promise<void>

Pause an active download. Download can be resumed later from the same position.

ParamTypeDescription
options{ id: string; }- Options containing the download task ID

resume(...)

resume(options: { id: string; }) => Promise<void>

Resume a paused download. Continues from where it was paused.

ParamTypeDescription
options{ id: string; }- Options containing the download task ID

stop(...)

stop(options: { id: string; }) => Promise<void>

Stop and cancel a download permanently. Downloaded data will be deleted.

ParamTypeDescription
options{ id: string; }- Options containing the download task ID

checkStatus(...)

checkStatus(options: { id: string; }) => Promise<DownloadTask>

Check the current status of a download.

ParamTypeDescription
options{ id: string; }- Options containing the download task ID

Returns: Promise<DownloadTask>


getFileInfo(...)

getFileInfo(options: { path: string; }) => Promise<{ size: number; type: string; }>

Get information about a downloaded file.

ParamTypeDescription
options{ path: string; }- Options containing the file path

Returns: Promise<{ size: number; type: string; }>


addListener('downloadProgress', ...)

addListener(eventName: 'downloadProgress', listenerFunc: (progress: { id: string; progress: number; }) => void) => Promise<PluginListenerHandle>

Listen for download progress updates. Fired periodically as download progresses.

ParamTypeDescription
eventName'downloadProgress'- Must be 'downloadProgress'
listenerFunc(progress: { id: string; progress: number; }) => void- Callback receiving progress updates

Returns: Promise<PluginListenerHandle>


addListener('downloadCompleted', ...)

addListener(eventName: 'downloadCompleted', listenerFunc: (result: { id: string; }) => void) => Promise<PluginListenerHandle>

Listen for download completion. Fired when a download finishes successfully.

ParamTypeDescription
eventName'downloadCompleted'- Must be 'downloadCompleted'
listenerFunc(result: { id: string; }) => void- Callback receiving completion notification

Returns: Promise<PluginListenerHandle>


addListener('downloadFailed', ...)

addListener(eventName: 'downloadFailed', listenerFunc: (error: { id: string; error: string; }) => void) => Promise<PluginListenerHandle>

Listen for download failures. Fired when a download encounters an error.

ParamTypeDescription
eventName'downloadFailed'- Must be 'downloadFailed'
listenerFunc(error: { id: string; error: string; }) => void- Callback receiving error information

Returns: Promise<PluginListenerHandle>


removeAllListeners()

removeAllListeners() => Promise<void>

Remove all event listeners. Cleanup method to prevent memory leaks.


getPluginVersion()

getPluginVersion() => Promise<{ version: string; }>

Get the plugin version number.

Returns: Promise<{ version: string; }>


Interfaces

DownloadTask

Represents the current state and progress of a download task.

PropTypeDescription
idstringUnique identifier for the download task
progressnumberDownload progress from 0 to 100
state'PENDING' | 'RUNNING' | 'PAUSED' | 'DONE' | 'ERROR'Current state of the download

DownloadOptions

Configuration options for starting a download.

PropTypeDescription
idstringUnique identifier for this download task
urlstringURL of the file to download
destinationstringLocal file path where the download will be saved
headers{ [key: string]: string; }Optional HTTP headers to include in the request
network'cellular' | 'wifi-only'Network type requirement for download
priority'high' | 'normal' | 'low'Download priority level

PluginListenerHandle

PropType
remove() => Promise<void>

Credit

This plugin was inspired from: https://github.com/kesha-antonov/react-native-background-downloader