JSPM

file-download

0.1.2
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 92
    • Score
      100M100P100Q73332F
    • License ISC

    Generic file downloader

    Package Exports

    • file-download

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (file-download) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    file-download

    Install

    npm install file-download --save

    Usage

    var download = require('file-download')
    
    var url = "http://i.imgur.com/G9bDaPH.jpg"
    
    var options = {
        directory: "./images/cats/",
        filename: "cat.gif"
    }
    
    download(url, options, function(err){
        if (err) throw err
        console.log("meow")
    }) 

    API

    download(url, [options], callback(err))
    url string of the file URL to download
    options object with options
    • directory string with path to directory where to save files (default: current working directory)
    • filename string for the name of the file to be saved as (default: filename in the url)
    • timeout integer of how long in ms to wait while downloading (default: 20000)
    callback function to run after