# png-or-not

A lightweight Node.js utility to check whether a given buffer contains a valid PNG image, by verifying its magic number (signature bytes).

---

## 📦 Installation

```bash
npm install png-or-not
```

---

## 🚀 Usage

```js
const fs = require('fs');
const isPng = require('png-or-not');

// Read a file into a buffer
const buffer = fs.readFileSync('image.png');

console.log(isPng(buffer)); // true if it's a PNG, false otherwise
```

---

## 📘 API

### `isPng(buffer: Buffer): boolean`

- **Parameters**: `buffer` — a Node.js Buffer  
- **Returns**: `true` if the buffer starts with the PNG file signature, `false` otherwise  
- **Note**: The function does not decode the image — it only checks the file signature

---

## 🧪 Testing

You can run the included test script:

```bash
npm test
```

Make sure to place a valid `sample.png` file in the `test/` directory.

---

## 📄 License

MIT © 2025 [Abhay Patel](mailto:patelabhay550@gmail.com)