Metadata-Version: 2.1
Name: file-verifier
Version: 0.0.0
Summary: Validation for local and upload file
Author-email: Dao Quang Duy <duydaoquang12@gmail.com>
Maintainer-email: Rabiloo Developers <oss@rabiloo.com>
License: The MIT License
Project-URL: Homepage, https://github.com/rabiloo/python-file-verifier
Project-URL: Repository, https://github.com/rabiloo/python-file-verifier
Project-URL: Bug Tracker, https://github.com/rabiloo/python-file-verifier/issues
Keywords: file-verifier,file-validator,filetype,magic,mimetypes,puremagic,Pillow
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Development Status :: 2 - Pre-Alpha
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Provides-Extra: dev
Requires-Dist: black ; extra == 'dev'
Requires-Dist: flake8 ; extra == 'dev'
Requires-Dist: flake8-pyproject ; extra == 'dev'
Requires-Dist: pytest ; extra == 'dev'
Requires-Dist: typing-extensions ; extra == 'dev'

# Python File Verifier

[![Testing](https://github.com/rabiloo/python-file-verifier/actions/workflows/test.yml/badge.svg)](https://github.com/rabiloo/python-file-verifier/actions/workflows/test.yml)
[![Latest Version](https://img.shields.io/pypi/v/file-verifier.svg)](https://pypi.org/project/file-verifier)
[![Downloads](https://img.shields.io/pypi/dm/file-verifier.svg)](https://pypi.org/project/file-verifier)
[![Pypi Status](https://img.shields.io/pypi/status/file-verifier.svg)](https://pypi.org/project/file-verifier)
[![Python Versions](https://img.shields.io/pypi/pyversions/file-verifier.svg)](https://pypi.org/project/python-file-verifier)

## About File Verifier

[File Verifier](https://github.com/rabiloo/python-file-verifier) is file validate library for python. It provides method to verify local and upload file

## Install

```
$ pip install file-verifier
```

## Usage

```
from file_verifier.mime.magic_async_mime import MagicAsyncValidatorMime
from file_verifier.size.basic_async_size import BaseAsyncValidatorSize
from file_verifier.type.filetype_type import FiletypeValidatorType
from file_verifier.convertor.pillow_convertor import PillowConvertor
from file_verifier.file_validator import FileValidator


mime_validator = MagicAsyncValidatorMime(acceptable_mimes=["image/jpeg"])
size_validator =  BaseAsyncValidatorSize(max_upload_file_size=1024 * 1024)
type_validator = FiletypeValidatorType(acceptable_types=["image"])
file_convertor = PillowConvertor(acceptable_mimes=["image/jpeg"])

obj_validator = FileValidator(mime_validator, size_validator, type_validator, file_convertor)

obj_validator.validate_file("/tmp/hello.txt")
```

## Changelog

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

## Contributing

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

## Security Vulnerabilities

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

## Credits

- [Dao Quang Duy](https://github.com/duydq12)
- [All Contributors](../../contributors)

## License

The MIT License (MIT). Please see [License File](LICENSE) for more information.
