Adapt generators and other iterables to a file-like interface
