Download file in background or foreground
WIP: the plugin is not yet ready for production
npm install @capgo/capacitor-downloader
npx cap sync
download(...)
pause(...)
resume(...)
stop(...)
checkStatus(...)
getFileInfo(...)
addListener('downloadProgress', ...)
addListener('downloadCompleted', ...)
addListener('downloadFailed', ...)
removeAllListeners()
- Interfaces
download(options: DownloadOptions) => any
Param | Type |
---|---|
options |
DownloadOptions |
Returns: any
pause(id: string) => any
Param | Type |
---|---|
id |
string |
Returns: any
resume(id: string) => any
Param | Type |
---|---|
id |
string |
Returns: any
stop(id: string) => any
Param | Type |
---|---|
id |
string |
Returns: any
checkStatus(id: string) => any
Param | Type |
---|---|
id |
string |
Returns: any
getFileInfo(path: string) => any
Param | Type |
---|---|
path |
string |
Returns: any
addListener(eventName: 'downloadProgress', listenerFunc: (progress: { id: string; progress: number; }) => void) => any
Param | Type |
---|---|
eventName |
'downloadProgress' |
listenerFunc |
(progress: { id: string; progress: number; }) => void |
Returns: any
addListener(eventName: 'downloadCompleted', listenerFunc: (result: { id: string; }) => void) => any
Param | Type |
---|---|
eventName |
'downloadCompleted' |
listenerFunc |
(result: { id: string; }) => void |
Returns: any
addListener(eventName: 'downloadFailed', listenerFunc: (error: { id: string; error: string; }) => void) => any
Param | Type |
---|---|
eventName |
'downloadFailed' |
listenerFunc |
(error: { id: string; error: string; }) => void |
Returns: any
removeAllListeners() => any
Returns: any
Prop | Type |
---|---|
id |
string |
url |
string |
destination |
string |
headers |
{ [key: string]: string; } |
network |
'cellular' | 'wifi-only' |
priority |
'high' | 'normal' | 'low' |
Prop | Type |
---|---|
id |
string |
progress |
number |
state |
'PENDING' | 'RUNNING' | 'PAUSED' | 'DONE' | 'ERROR' |
Prop | Type |
---|---|
remove |
() => any |
This plugin was inspired from: https://github.com/kesha-antonov/react-native-background-downloader