This allows to read from a file descriptor instad of a file

* Rewrites some of the tests to use the functionality