# png-validator

> Png validator checks Png files for corruption

Latest version **2.0.0** (published 2023-11-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install png-validator
pnpm add png-validator
yarn add png-validator
bun add png-validator
```

## Health

**Score 40/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2023-11-16 |
| First published | 2020-09-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Dependencies | 0 |
| Unpacked size | 10.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Sámal Rasmussen |
| Maintainers | samal-rasmussen |
| Keywords | png, png-validator, png-validate, png-validation, validator, validate, validation, valid, invalid, corruption, corrupt, correct, correction, checker |

## Links

- npm: https://www.npmjs.com/package/png-validator
- Repository: https://github.com/samal-rasmussen/png-validator
- Issues: https://github.com/samal-rasmussen/png-validator/issues
- npm.io page: https://npm.io/package/png-validator

## Alternatives

- [vest](https://npm.io/package/vest.md) — 50.1K weekly downloads
- [@regle/core](https://npm.io/package/@regle/core.md) — 47.0K weekly downloads
- [typeof-arguments](https://npm.io/package/typeof-arguments.md) — 12.5K weekly downloads
- [@lokalise/projects-engine-contracts](https://npm.io/package/@lokalise/projects-engine-contracts.md) — 978 weekly downloads
- [@osjwnpm/nam-laboriosam-quibusdam](https://npm.io/package/@osjwnpm/nam-laboriosam-quibusdam.md) — 70 weekly downloads

## Recent versions

- 2.0.0 (latest) — 2023-11-16
- 1.1.0 — 2021-10-18
- 1.0.0 — 2020-09-15

## README

## Png Validator

Checks Png files for corruption.

This code is cut out of the much more comprehensive https://github.com/lukeapage/pngjs, so you can have a minimal implementation that only does png file validation.

It checks that the chunk layout is correct, and it checks that the crc code for each chunk is valid.

Zero dependencies and only 2.6 kb after minification.

Available as an npm package: https://www.npmjs.com/package/png-validator

## Usage

There is only a single function exposed called `pngValidator` that takes a single parameter, which is an Uint8Array with the raw Png file data. It will throw an error if the file is _not_ valid.

```
import { pngValidator } from 'png-validator';

try {
	pngValidator(buffer);
	// success
} catch (e) {
	// file is invalid or corrupt
	console.error(e);
}
```

From version 2.0 on there is only an esm version of Png Validator. Use v. 1.1 if you need commonjs.

---
_Source: https://npm.io/package/png-validator · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
