1.0.9 • Published 5 years ago

downloadable v1.0.9

Weekly downloads
552
License
ISC
Repository
github
Last release
5 years ago

downloadable

Check if url downloadable before download.

  • resolve a promise with the HTTP headers when given URL is downloadable (should have 'content-type' and 'content-length')
  • reject a promise with error message when given URL is not downloadable

NPM

Install

$ npm install --save downloadable

Test

$ npm test

Usage

    const downloadable = require("downloadable");
    const imageUrl = 'https://cdn1.iconfinder.com/data/icons/logotypes/32/square-facebook-512.png'

    downloadable(imageUrl).then(function(headers){
      console.log(headers['content-type'])
      console.log(headers['content-length'])
      // link is downloadable, do something ....
    },function(err){
      // link is not downloadable, do something else ....
    });

License

MIT

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.2

6 years ago

1.0.3

6 years ago

1.0.1

6 years ago

1.0.0

8 years ago