func (resp *Response) SendFile(path string) error {
	f, err := os.Open(path)
	if err != nil {
		return err
	}
	fileInfo, err := f.Stat()
	if err != nil {
		f.Close()
		return err
	}
	size64 := fileInfo.Size()
	size := int(size64)
	if int64(size) != size64 {
		size = -1
	}

	resp.Header.SetLastModified(fileInfo.ModTime())
	resp.SetBodyStream(f, size)
	return nil
}
func (resp *Response) SendFile(path string) error {
	f, err := os.Open(path)
	if err != nil {
		return err
	}
	fileInfo, err := f.Stat()
	if err != nil {
		f.Close()
		return err
	}
	size64 := fileInfo.Size()
	size := int(size64)
	if int64(size) != size64 {
		size = -1
	}

	resp.Header.SetLastModified(fileInfo.ModTime())
	resp.SetBodyStream(f, size)
	return nil
}
func ( resp * Response ) SendFile ( path string ) error { f , err := os . Open ( path ) if err != nil { return err } fileInfo , err := f . Stat ( ) if err != nil { f . Close ( ) return err } size64 := fileInfo . Size ( ) size := int ( size64 ) if int64 ( size ) != size64 { size = - 1 } resp . Header . SetLastModified ( fileInfo . ModTime ( ) ) resp . SetBodyStream ( f , size ) return nil }
// SendFile registers file on the given path to be used as response body
// when Write is called.
//
// Note that SendFile doesn't set Content-Type, so set it yourself
// with Header.SetContentType.
SendFile registers file on the given path to be used as response body when Write is called . Note that SendFile doesn t set Content - Type so set it yourself with Header . SetContentType .