Skip to content

sefinek24/is-image-header

Repository files navigation

🌍 » What is that?

This module checks if the URL leads to a photo by analyzing the header.

🤔 » Installation

npm install is-image-header

📝 » Usage

• Async/await example

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 }
})();

• Promise example

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 }

🤝 » Help

Open new Issue on GitHub.

⭐ » Star

If you like this module, please star the repository.

📜 » License MIT

Copyright 2023-2024 © by Sefinek. All Rights Reserved.