1.0.2 • Published 5 years ago

dl-easy v1.0.2

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

dl-easy

English | 简体中文

Introduction

Simply download file in electron application.

Install

$   npm install dl-easy --save

Usage

# 1. CommonJs 
const { download } = require('dl-easy')
# 2. ES6
import { download } from 'dl-easy'

# basic usage
const { remote } = require('electron')
download(remote.getCurrentWindow(), url)
  .then(file => {
    // download success
  })
  .catch(err => {
    // download fail  
  })

# with callback
download(remote.getCurrentWindow(), url, {
  'onStart': (file) => { 
    // download has started
  },
  'onCancel': (fileObj) => { 
    // download has canceled
  }
})
  .then(file => {
    // download success
  })
  .catch(err => {
    // download fail  
  })