Sparse files are huge with io.Copy()
问题 I want to copy files from one place to another and the problem is I deal with a lot of sparse files. Is there any (easy) way of copying sparse files without becoming huge at the destination? My basic code: out, err := os.Create(bricks[0] + "/" + fileName) in, err := os.Open(event.Name) io.Copy(out, in) 回答1: Some background theory Note that io.Copy() pipes raw bytes – which is sort of understandable once you consider that it pipes data from an io.Reader to an io.Writer which provide Read([