Skip to content

Added dynamically assessed MinimalBufferSize to allow validation with custom validators requiring more than 20 bytes#33

Merged
AJMitev merged 2 commits intoAJMitev:masterfrom
ziocampo:master
Apr 3, 2024
Merged

Added dynamically assessed MinimalBufferSize to allow validation with custom validators requiring more than 20 bytes#33
AJMitev merged 2 commits intoAJMitev:masterfrom
ziocampo:master

Conversation

@ziocampo
Copy link
Copy Markdown

@ziocampo ziocampo commented Apr 3, 2024

Hello @AJMitev

I'm using your library in many projects with custom validators.

In a particular case I have to validate / recognize a couple of CSV files and I would like to stick to the "Use FileTypeChecker" pattern. The problem with this approach is that the BufferDefaultSize is fixed to 20 bytes, which in many cases is below the threshold I need to accurately determine the file type.

So I modified it to be dynamically determined, based on the size of the largest MagicSequence defined for the FileType being checked. Since BufferDefaultSize wasn't a fitting name anymore I renamed it to BufferSize, making it a getter.

I also added an appropriate test (GetFileType_ShouldUseTheMinimalBufferSizeWhenUsingStream).

Thank you very much for your time and effort, best regards

Daniele (ziocampo)

Daniele Bruni added 2 commits April 3, 2024 16:11
…o that each FileType uses only the minimal amount of bytes
@AJMitev AJMitev merged commit 484a718 into AJMitev:master Apr 3, 2024
@ziocampo
Copy link
Copy Markdown
Author

ziocampo commented Apr 4, 2024

Could you please release the package?

@AJMitev
Copy link
Copy Markdown
Owner

AJMitev commented Apr 4, 2024

Hello, @ziocampo, first thank you for your kind words and for your contribution to this project I really appreciate it! I am planning release it this weekend.

@ziocampo
Copy link
Copy Markdown
Author

ziocampo commented Apr 4, 2024

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants