In #41, @generalmimon replied to my suggestion that we use file_size_b[:file_size_b.index(b"\x00")] to strip null terminating bytes:
Yes. But bytes.index raises ValueError if the searched sequence is not found, so now it really makes sense to keep the try..except statement and apply the null termination only if int() on the original file_size_b fails.
And as I mentioned, this should be probably used for other fields (like file names) too.
In #41, @generalmimon replied to my suggestion that we use
file_size_b[:file_size_b.index(b"\x00")]
to strip null terminating bytes:Originally posted by @generalmimon in https://github.com/lmmx/range-streams/issues/41#issuecomment-1518411074
This ticket can be used to track this work:
bytes.index
docs linked above