is-an-image-url

1.0.4 • Public • Published

is-an-image-url

npm package

NPM Version downloads Build Status Dependency Status Coverage Status Known Vulnerabilities XO code style Gitter

Does an async checks to see if a url is an image url.

Minor note: This package was originally created as an async replacement for is-image-url. I was using that one but my snyk security scanner said there was issue with one of the dependencies. I posted a pull request but a new version never got published, so onward and upward. The other lib was synchronous, I figured I'd make an async version.

Installation

Installation is easiest through npm:

npm install is-an-image-url --save

Usage

is-an-image-url can be included as a reference.

var isAnImageUrl = require('is-an-image-url');

isAnImageUrl(url, function(isAnImageResult){
  if(isAnImageResult){
      console.log("yes the url was an image");
  }else {
      console.log("no, the url was not an image");
  }
});

CLI

$ npm install --global is-an-image-url
$ is-an-image-url --help

  Usage
    $ is-an-image-url "<url>"

  Example
    $ is-an-image-url "http://www.google.com"

The isAnImageUrl package will use the callback function with the following signature callback(isAnImageResult). isAnImageResult will be a bool, true if the url is for an image and false otherwise.

License

MIT © Mark Rogers

Readme

Keywords

Package Sidebar

Install

npm i is-an-image-url

Weekly Downloads

1

Version

1.0.4

License

MIT

Unpacked Size

7.07 kB

Total Files

5

Last publish

Collaborators

  • markrogers