Added dynamically assessed MinimalBufferSize to allow validation with custom validators requiring more than 20 bytes#33
Merged
AJMitev merged 2 commits intoAJMitev:masterfrom Apr 3, 2024
ziocampo:master
Merged
Added dynamically assessed MinimalBufferSize to allow validation with custom validators requiring more than 20 bytes#33AJMitev merged 2 commits intoAJMitev:masterfrom ziocampo:master
AJMitev merged 2 commits intoAJMitev:masterfrom
ziocampo:master
Conversation
added 2 commits
April 3, 2024 16:11
… MagicSequences lenght > 20b
…o that each FileType uses only the minimal amount of bytes
Author
|
Could you please release the package? |
Owner
|
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. |
Author
|
Thank you. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)