1.0.4 ⢠Published 9 months ago
@mikedeni/image-url-validator v1.0.4
šø image-url-validator
š A utility function to verify if a given URL points to a valid image by checking its content type.
š Features
- ā Validates if the URL points to a valid image.
- š Checks content type using a
HEADrequest. - š¦ Lightweight and easy to use.
āļø Installation
You can install the package via npm:
npm install @mikedeni/image-url-validatorš” Example
const isImageURL = require('@mikedeni/image-url-validator');
isImageURL('https://example.com/image.jpg')
.then(isImage => {
console.log(isImage ? 'The URL points to an image.' : 'The URL does not point to an image.');
})
.catch(error => {
console.error('Error:', error);
});