io.Copy instead of manually do the things (suggestion of  al...@lx.lc, andrey mirtchovski et al)