Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

download-url

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

download-url

download-url is a download toolkit which support both http and https URL, to check and download file by given URL, also resolve a promise when it is done

  • 2.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
increased by300%
Maintainers
1
Weekly downloads
 
Created
Source

download-url

download-url is a download toolkit which support both http and https URL, to check and download file by given URL, also resolve a promise when it is done

Install

$ npm install --save download-url

Usage

Chain version


var _d = new downloadAPI(url)

_d.setPath(path).start('abc.mp4').then(function(result){

  console.log('result: ', result)

},function(error){

  console.log(error)
})


API

constructor

Giving download url as parameter, and start check up if it is work and downloadable.

var downloadAPI = require('download-url');
downloadAPI("www.abc.jpg")

setPath("/upload/directary")

Giving destination directory as parameter, which needed to be created before storing the download file.

var downloadAPI = require('download-url');
downloadAPI("www.abc.jpg")
downloadAPI.setPath(path)

or 

downloadAPI("www.abc.jpg").setPath("/upload/directary")

start()

It is a function which return a promise, to trigger download, from the given URL to the given Directary and process the url validate checkup before download.

var downloadAPI = require('download-url');
downloadAPI("www.abc.jpg")
downloadAPI.setPath(path)
downloadAPI.start().then(function(result){
    //...... file is downloaded to local
},function(error){
    //...... do somthing
})

or 

downloadAPI("www.abc.jpg").setPath("/upload/directary").then(function(result){
    //...... file is downloaded to local
},function(error){
    //...... do somthing
})

isDownloadable(url)

It is a function which return a promise, to check if the url parameter downloadable.

var API = downloadAPI(url)
API.isDownloadable(url).then(function(isDownloadable){
    //...... file is downloaded to local
},function(error){
    //...... do somthing
})

License

MIT © Kevin Mårtensson

Keywords

FAQs

Package last updated on 14 Aug 2017

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc