I am reading a large data stream using lazy bytestrings, and want to know if at least X more bytes is available while parsing it. That is, I want to know if the bytestring is at least X bytes long.
Will calling length
on it result in the entire stream getting loaded, hence defeating the purpose of using the lazy bytestring?
If yes, then the followup would be: How to tell if it has at least X bytes without loading the entire stream?
EDIT: Originally I asked in the context of reading files but understand that there are better ways to determine filesize. Te ultimate solution I need however should not depend on the lazy bytestring source.