🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

image-url-validator

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

image-url-validator

Check if a url is an image using HTTP HEAD

latest
Source
npmnpm
Version
1.0.4
Version published
Weekly downloads
796
-24.48%
Maintainers
1
Weekly downloads
 
Created
Source

NPM version Build Status Downloads NPM

image-url-validator

Check if a url is an image

Checks asynchronously whether an image URL is valid or not with using HTTP HEAD.

Install

$ npm install --save image-url-validator

Usage

JavaScript

const isImageURL = require('image-url-validator').default;

// Promise
isImageURL('https://via.placeholder.com/300/09f/fff.png').then(is_image => {
    console.log(is_image) //=> true
});

isImageURL('https://github.com/BhanukaUOM/Image-Url-Validator').then(is_image => {
    console.log(is_image) //=> false
});

// Sync/Await
await isImageURL('https://via.placeholder.com/300/09f/fff.png'); //=> true

await isImageURL('https://github.com/BhanukaUOM/Image-Url-Validator'); //=> false

ES6

import isImageURL from 'image-url-validator';

// Promise
isImageURL('https://via.placeholder.com/300/09f/fff.png').then(is_image => {
    console.log(is_image) //=> true
});

isImageURL('https://github.com/BhanukaUOM/Image-Url-Validator').then(is_image => {
    console.log(is_image) //=> false
});

// Sync/Await
await isImageURL('https://via.placeholder.com/300/09f/fff.png'); //=> true

await isImageURL('https://github.com/BhanukaUOM/Image-Url-Validator'); //=> false

Release Notes

v1.0.1

  • Added ES6 Support

v0.2.0

  • Added ES5 Support

v0.0.1

  • Initial Release

License

Licensed under The MIT License (MIT)

Keywords

validate

FAQs

Package last updated on 03 Feb 2021

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