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
Interfaces
FileDownloadOptions
Prop | Type |
---|
uri | string |
fileName | string |
title | string |
description | string |
FileDownloadResponse
FileDownloadProgress
PluginListenerHandle
感谢 https://github.com/veluxa/capacitor-plugin-file-downloader