Home / Type/ SendFile Type — fiber Architecture

SendFile Type — fiber Architecture

Architecture documentation for the SendFile type/interface in res.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  ba284151_184e_14c1_4a48_51d42898a5df["SendFile"]
  4ab93de8_955a_4087_8264_32cf8000452f["res.go"]
  ba284151_184e_14c1_4a48_51d42898a5df -->|defined in| 4ab93de8_955a_4087_8264_32cf8000452f
  style ba284151_184e_14c1_4a48_51d42898a5df fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

res.go lines 27–63

type SendFile struct {
	// FS is the file system to serve the static files from.
	// You can use interfaces compatible with fs.FS like embed.FS, os.DirFS etc.
	//
	// Optional. Default: nil
	FS fs.FS

	// When set to true, the server tries minimizing CPU usage by caching compressed files.
	// This works differently than the github.com/gofiber/compression middleware.
	// You have to set Content-Encoding header to compress the file.
	// Available compression methods are gzip, br, and zstd.
	//
	// Optional. Default: false
	Compress bool `json:"compress"`

	// When set to true, enables byte range requests.
	//
	// Optional. Default: false
	ByteRange bool `json:"byte_range"`

	// When set to true, enables direct download.
	//
	// Optional. Default: false
	Download bool `json:"download"`

	// Expiration duration for inactive file handlers.
	// Use a negative time.Duration to disable it.
	//
	// Optional. Default: 10 * time.Second
	CacheDuration time.Duration `json:"cache_duration"`

	// The value for the Cache-Control HTTP-header
	// that is set on the file response. MaxAge is defined in seconds.
	//
	// Optional. Default: 0
	MaxAge int `json:"max_age"`
}

Defined In

Frequently Asked Questions

What is the SendFile type?
SendFile is a type/interface in the fiber codebase, defined in res.go.
Where is SendFile defined?
SendFile is defined in res.go at line 27.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free