# ffv-validator

> File format validation project is responsible to check if file contents match provided extension

Latest version **0.0.5** (published 2023-01-08) · MIT license · 0 weekly downloads

## Install

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

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.5 |
| Published | 2023-01-08 |
| First published | 2019-09-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=12.0.0 |
| Dependencies | 0 |
| Unpacked size | 69 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Dimitris Klouvas |
| Maintainers | dimkl |
| Keywords | ffv, stream, file-extension, file, security, validation |

## Links

- npm: https://www.npmjs.com/package/ffv-validator
- Repository: https://github.com/dimkl/ffv
- Homepage: https://github.com/dimkl/ffv#readme
- Issues: https://github.com/dimkl/ffv/issues
- npm.io page: https://npm.io/package/ffv-validator

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 0.0.5 (latest) — 2023-01-08
- 0.0.4 — 2021-02-07
- 0.0.3 — 2019-09-16
- 0.0.2 — 2019-09-15
- 0.0.1 — 2019-09-15

## README

<h1 align="center">Welcome to ffv 👋</h1>
<p>
  <a href="https://www.npmjs.com/package/ffv">
    <img alt="Version" src="https://img.shields.io/npm/v/ffv.svg">
  </a>
  <img src="https://img.shields.io/badge/npm-%3E%3D5.5.0-blue.svg" />
  <img src="https://img.shields.io/badge/node-%3E%3D8.0.0-blue.svg" />
  <a href="https://github.com/dimkl/ffv#readme">
    <img alt="Documentation" src="https://img.shields.io/badge/documentation-yes-brightgreen.svg" target="_blank" />
  </a>
  <a href="https://github.com/dimkl/ffv/graphs/commit-activity">
    <img alt="Maintenance" src="https://img.shields.io/badge/Maintained%3F-yes-green.svg" target="_blank" />
  </a>
  <a href="https://github.com/dimkl/ffv/blob/master/LICENSE">
    <img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-yellow.svg" target="_blank" />
  </a>
</p>

> File format validation project is responsible to check if file contents match provided extension

### 🏠 [Homepage](https://github.com/dimkl/ffv#readme)

## Prerequisites

- npm >=5.5.0
- node >=8.0.0

## Install

```sh
npm install ffv-validator
```

## Run tests

```sh
npm run test
```

## Example

```javascript
const fs = require('fs');
const { validate } = require('ffv');

const filename = './download.jpeg';
const readStream = fs.createReadStream(filename, { highWaterMark: 512 });
const wstream = fs.createWriteStream('download-1.png');

const pass = validate('jpeg');

readStream
  .pipe(pass)
  .pipe(wstream)
  .on('error', err => {
    console.error('Pipeline failed.', err);
  })
  .on('close', () => {
    console.log('Pipeline succeeded.');
  });
```

## Resources

- https://www.garykessler.net/library/file_sigs.html
- https://www.owasp.org/index.php/OWASP_File_Format_Validation_Project

## Author

👤 **Dimitris Klouvas <dimitris.klouvas@gmail.com>**

- Github: [@dimkl](https://github.com/dimkl)

## 🤝 Contributing

Contributions, issues and feature requests are welcome!<br />Feel free to check [issues page](https://github.com/dimkl/ffv/issues).

## Show your support

Give a ⭐️ if this project helped you!

## 📝 License

Copyright © 2019 [Dimitris Klouvas <dimitris.klouvas@gmail.com>](https://github.com/dimkl).<br />
This project is [MIT](https://github.com/dimkl/ffv/blob/master/LICENSE) licensed.

---

_This README was generated with ❤️ by [readme-md-generator](https://github.com/kefranabg/readme-md-generator)_

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