onecodex / needletail

Fast FASTX parsing and k-mer methods in Rust
MIT License
174 stars 20 forks source link

Handling of empty files #51

Closed mbhall88 closed 3 years ago

mbhall88 commented 4 years ago

https://github.com/onecodex/needletail/blob/cd12c12fd2ec9a1fa2c3ac5c1473af2e9f84a53e/src/parser/mod.rs#L53

This line will cause an error to be returned for an empty file. Is this a feature or a bug?

Effectively, I'm asking if you intentionally return an error for empty files?

I personally don't like failing on empty files. I wonder if you would consider adding a ParseErrorKind variant for an empty file so I can identify and handle these cases accordingly in my project?

I'm happy to implement if you're short on time, but wanted to check first if this is inline with your library.

Keats commented 4 years ago

IIRC it's intended, we consider empty files to be invalid in our codebases. I think a specific ParseErrorKind would be nicer than a IO error though. A PR would be welcome.

mbhall88 commented 3 years ago

@Keats do you think I might be able to get a review on #52 at some point? I appreciate you probably have lots of other things happening so if you don't have time that is ok.