GithubHelp home page GithubHelp logo

asadahimeka / capacitor-plugin-filedownload Goto Github PK

View Code? Open in Web Editor NEW

This project forked from alwaysloveme/capacitor-plugin-filedownload

0.0 1.0 0.0 274 KB

a simple file download plugin for Capacitor3.0+

License: MIT License

JavaScript 22.45% Ruby 5.32% Objective-C 3.47% Java 39.07% TypeScript 7.43% CSS 0.22% Swift 16.23% HTML 5.80%

capacitor-plugin-filedownload's Introduction

capacitor-plugin-filedownload

A file download plugin for capacitor3.0+

Install

npm install @himeka/capacitor-plugin-filedownload
npx cap sync

eg:

import { FileDownload } from "@himeka/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);
})

/* Not implemented

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

API

download(...)

download(options: FileDownloadOptions) => Promise<FileDownloadResponse>
Param Type
options FileDownloadOptions

Returns: Promise<FileDownloadResponse>


addListener('downloadProgress', ...)

addListener(eventName: 'downloadProgress', listenerFunc: (progress: FileDownloadProgress) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Param Type
eventName 'downloadProgress'
listenerFunc (progress: FileDownloadProgress) => void

Returns: Promise<PluginListenerHandle> & PluginListenerHandle


Interfaces

FileDownloadResponse

Prop Type
path string

FileDownloadOptions

Prop Type
uri string
fileName string

PluginListenerHandle

Prop Type
remove () => Promise<void>

FileDownloadProgress

Prop Type
progress number

capacitor-plugin-filedownload's People

Contributors

alwaysloveme avatar asadahimeka avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.