Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for copyBufPool (0.12 sec)

  1. internal/ioutil/ioutil.go

    	return &SkipReader{r, n}
    }
    
    var copyBufPool = sync.Pool{
    	New: func() interface{} {
    		b := make([]byte, 32*1024)
    		return &b
    	},
    }
    
    // Copy is exactly like io.Copy but with reusable buffers.
    func Copy(dst io.Writer, src io.Reader) (written int64, err error) {
    	bufp := copyBufPool.Get().(*[]byte)
    	buf := *bufp
    	defer copyBufPool.Put(bufp)
    
    	return io.CopyBuffer(dst, src, buf)
    }
    
    Registered: Sun Jun 16 00:44:34 UTC 2024
    - Last Modified: Wed May 22 23:07:14 UTC 2024
    - 10.2K bytes
    - Viewed (0)
Back to top