Metadata-Version: 2.4
Name: file_signature_validation
Version: 1.0.0
Summary: Django uploaded file validation based on file signature.
License: MIT License
        
        Copyright (c) 2024 overnitecbt
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/overnitecbt/file_signature_validation
Keywords: file,validation
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests
Dynamic: license-file

# file signature validation


Comprehensive tests to validate a file based on file signature. For a Django uploaded file.


## Usage

`pip install file-signature-validation`

## Methods

Tests the file name to ensure it is allowed.

`regex_file_name_test(uploaded_file, allowed_extensions, regex)`

Tests the file to ensure the file signature matches with the corressponeding mime type, extension and given size.

`file_type_test(uploaded_file, allowed_type, allowed_mimes, allowed_extensions, allowed_size)`

Runs the file through all of the above tests.

`acceptable_file(uploaded_file, allowed_types, allowed_mimes, allowed_extensions, allowed_size, regex)`


## Disclaimer

The authors and contributors of this package can not be held liable for any false positives or damage caused by the use of the file signature validation package.
