Revert "avoid expensive Object.keys by using a flag"

Premature optimization is the devil.

This reverts commit 7b21a86b5f462a5e0e6b848f7af8dc3b8424262f.
style
better error message for files without metadata
return error when we unexpectedly hit the end of the stream