bigfile: better factor this for use with IO.copy_stream