import "helm.sh/helm/v3/internal/fileutil"
fileutil.go
func AtomicWriteFile(filename string, reader io.Reader, mode os.FileMode) error
AtomicWriteFile atomically (as atomic as os.Rename allows) writes a file to a disk.