An open API service indexing awesome lists of open source software.

https://github.com/sefinek/is-image-header

This simple module checks if the given link leads to an image.
https://github.com/sefinek/is-image-header

header headers image is jpeg jpg photo png url

Last synced: 6 months ago
JSON representation

This simple module checks if the given link leads to an image.

Awesome Lists containing this project

README

          

# 🌍 » What does it do?
This simple module checks if the given link leads to an image.

## 🤔 » Installation
```bash
npm install is-image-header
````

## 📝 » Usage
### • Async/await example
```js
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, isImage: true }

const example2 = await isImage('https://sefinek.net');
console.log(example2); // { success: true, status: 200, isImage: false }
})();
```

### • Promise example
```js
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, isImage: true }
isImage('https://sefinek.net').then(console.log); // { success: true, status: 200, isImage: false }
```

## 🤝 » Support
Join our [Discord server](https://discord.gg/53DBjTuzgZ) or open a new [Issue](https://github.com/sefinek/is-image-header/issues).

## ⭐ » Star
If you enjoy this module, please consider starring [the repository](https://github.com/sefinek/random-cat-img).

## 📜 » License MIT


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