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

https://github.com/dimkl/ffv

File Format Validation Project
https://github.com/dimkl/ffv

assertions ffv file-extension file-format file-signature file-validation

Last synced: about 2 months ago
JSON representation

File Format Validation Project

Awesome Lists containing this project

README

        

Welcome to ffv 👋




Version




Documentation


Maintenance


License: MIT

> 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 **

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

## 🤝 Contributing

Contributions, issues and feature requests are welcome!
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 ](https://github.com/dimkl).

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)_