1.1.1 • Published 3 years ago
capacitor-plugin-filedownload-bg v1.1.1
capacitor-plugin-filedownload
a simple file download plugin for Capacitor3
Install
npm install capacitor-plugin-filedownload
npx cap sync
eg:
import { FileDownload } from "capacitor-plugin-filedownload";
FileDownload.download({
uri: "http://www.xxxxx.com/file/rvh.apk",
fileName: "release.apk"
}).then((res) => {
console.log(res.path);
}).catch(err => {
console.log(err);
})
···
API
download(...)
download(options: FileDownloadOptions) => any
Param | Type |
---|---|
options | FileDownloadOptions |
Returns: any
addListener(...)
addListener(eventName: 'downloadProgress', listenerFunc: (progress: FileDownloadProgress) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Param | Type |
---|---|
eventName | "downloadProgress" |
listenerFunc | (progress: FileDownloadProgress) => void |
Returns: any
addListener(...)
addListener(eventName: 'downloadStatus', listenerFunc: (status: FileDownloadStatus) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Param | Type |
---|---|
eventName | "downloadStatus" |
listenerFunc | (status: FileDownloadStatus) => void |
Returns: any
Interfaces
FileDownloadOptions
Prop | Type |
---|---|
uri | string |
fileName | string |
title | string |
description | string |
objectId | string |
FileDownloadResponse
Prop | Type |
---|---|
path | string |
FileDownloadProgress
Prop | Type |
---|---|
progress | number |
objectId | string |
PluginListenerHandle
Prop | Type |
---|---|
remove | () => any |
FileDownloadStatus
Prop | Type |
---|---|
status | string |
objectId | string |
感谢 https://github.com/veluxa/capacitor-plugin-file-downloader