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
- Host: GitHub
- URL: https://github.com/dimkl/ffv
- Owner: dimkl
- License: other
- Created: 2019-09-15T17:32:47.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-08T17:19:26.000Z (over 2 years ago)
- Last Synced: 2025-01-12T09:48:23.929Z (4 months ago)
- Topics: assertions, ffv, file-extension, file-format, file-signature, file-validation
- Language: JavaScript
- Homepage:
- Size: 123 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Welcome to ffv 👋
> 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)_