Add support for all file-like objects, and tests