
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
capacitor-plugin-filedownload
Advanced tools
a file download plugin for capacitor3.0+
since v2.0.0 supported Capacitor5
since version
1.0.6
, theuri
option was changed tourl
npm install capacitor-plugin-filedownload
npx cap sync
eg:
import { FileDownload } from "capacitor-plugin-filedownload";
const download = async () => {
FileDownload.download({
url: "http://www.xxxxx.com/file/rvh.apk",
fileName: "release.apk",
// headers for http request with POST method
headers: {},
// parameter for http request with POST method
body: {},
// only works on Android, deprecated since 1.0.6
downloadTitle: 'downloading',
// only works on Android, deprecated since 1.0.6
downloadDescription: 'file is downloading',
}).then((res) => {
console.log(res.path);
}).catch(err => {
console.log(err);
})
}
// cancel download
const cancelDownload = async () => {
await FileDownload.cancel();
}
// get download status
const getDownloadStatus = () => {
const {isCanceled} = await FileDownload.isCanceled();
console.log(isCanceled);
}
// event listener for downloadProgress
const onDownloadProgress = async () => {
const eventListener = await FileDownload.addListener('downloadProgress', data =>{
console.log(data.progress);
})
// remove eventListener
eventListener.remove();
}
...
if you wish to open the file, you can install this plugin: https://github.com/capacitor-community/file-opener
download(...)
cancel()
isCanceled()
checkPermissions()
requestPermissions()
openSetting()
addListener('downloadProgress', ...)
download(options: FileDownloadOptions) => Promise<FileDownloadResponse>
Param | Type |
---|---|
options | FileDownloadOptions |
Returns: Promise<FileDownloadResponse>
cancel() => Promise<void>
cancel download
isCanceled() => Promise<CancelStatus>
get status of download
Returns: Promise<CancelStatus>
checkPermissions() => Promise<PermissionStatus>
only for android
Returns: Promise<PermissionStatus>
requestPermissions() => Promise<PermissionStatus>
only for android
Returns: Promise<PermissionStatus>
openSetting() => Promise<void>
open app setting, only for android
addListener(eventName: 'downloadProgress', listenerFunc: (progress: FileDownloadProgress) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Param | Type |
---|---|
eventName | 'downloadProgress' |
listenerFunc | (progress: FileDownloadProgress) => void |
Returns: Promise<PluginListenerHandle> & PluginListenerHandle
Prop | Type |
---|---|
path | string |
Prop | Type | Description | Default |
---|---|---|---|
url | string | ||
fileName | string | ||
destination | Destination | Download file destination | ios default: Document android default: External Storage |
headers | Record<string, string> | request headers, when headers has value, url must be a http request with POST method | |
body | Record<string, unknown> | request body, when body has value, url must be a http request width POST method | |
downloadTitle | string | Downloader Title, Only Android | |
downloadDescription | string | Downloader Description, Only Android |
Prop | Type |
---|---|
isCanceled | boolean |
Prop | Type | Description |
---|---|---|
storage | PermissionState | prompt: 首次申请,询问。 prompt-with-rationale: 每次都询问。 granted: 已获取权限。 denied:权限已拒绝。 |
Prop | Type |
---|---|
remove | () => Promise<void> |
Prop | Type |
---|---|
progress | number |
download destination , on android default is "DOWNLOAD", on ios default is "DOCUMENT"
"DOCUMENT" | "EXTERNAL" | "EXTERNAL_STORAGE" | "DATA" | "CACHE" | "LIBRARY"
Construct a type with a set of properties K of type T
{
[P in K]: T;
}
'prompt' | 'prompt-with-rationale' | 'granted' | 'denied'
FAQs
a file download plugin for capacitor3.0+
The npm package capacitor-plugin-filedownload receives a total of 24 weekly downloads. As such, capacitor-plugin-filedownload popularity was classified as not popular.
We found that capacitor-plugin-filedownload demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.