This module checks if the URL leads to a photo by analyzing the header.
npm install is-image-header
const isImage = require('is-image-header');
(async () => {
const example1 = await isImage('https://cdn.sefinek.net/images/animals/cat/cat-story-25-1377426-min.jpg');
console.log(example1); // { success: true, status: 200, error: false, isImage: true }
const example2 = await isImage('https://sefinek.net');
console.log(example2); // { success: true, status: 200, error: false, isImage: false }
})();
const isImage = require('is-image-header');
isImage('https://cdn.sefinek.net/images/animals/cat/cat-story-25-1377426-min.jpg').then(console.log); // { success: true, status: 200, error: false, isImage: true }
isImage('https://sefinek.net').then(console.log); // { success: true, status: 200, error: false, isImage: false }
Open new Issue on GitHub.
If you like this module, please star the repository.
Copyright 2023-2024 © by Sefinek. All Rights Reserved.