1.4.0 • Published 6 years ago
is-image-url-async v1.4.0
is-image-url-async
Checks to see if a URL points to an image and returns a string containing the appropiate extension, or undefined if the URL does not point to an image.
Installation
npm:
npm install is-image-url-async --save
Usage
Standard promises:
const isImageUrl = require('is-image-url-async');
isImageUrl(url, timeout)
.then(ext => console.log(ext))
.catch(error => console.error('Error', error));
Async function:
const isImageUrl = require('is-image-url-async');
async function foo(url, timeout) {
try {
const ext = await isImageUrl(url, timeout);
console.log(ext);
}
catch (error) {
console.error('Error', error);
}
}