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
Returns: any
addListener(...)
addListener(eventName: 'downloadProgress', listenerFunc: (progress: FileDownloadProgress) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Returns: any
addListener(...)
addListener(eventName: 'downloadStatus', listenerFunc: (status: FileDownloadStatus) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Returns: any
Interfaces
FileDownloadOptions
Prop | Type |
---|
uri | string |
fileName | string |
title | string |
description | string |
objectId | string |
FileDownloadResponse
FileDownloadProgress
Prop | Type |
---|
progress | number |
objectId | string |
PluginListenerHandle
FileDownloadStatus
Prop | Type |
---|
status | string |
objectId | string |
感谢 https://github.com/veluxa/capacitor-plugin-file-downloader