remove usage of tempfile.mkstemp because it was too easy to leave open file handles laying around
and use binary mode for streaming files to and from the repo.