Home / File/ res.go — fiber Source File

res.go — fiber Source File

Architecture documentation for res.go, a go file in the fiber codebase. 1 imports, 0 dependents.

File go FiberCore Routing 1 imports 7 functions 11 classes

Entity Profile

Dependency Diagram

graph LR
  4ab93de8_955a_4087_8264_32cf8000452f["res.go"]
  3c539dc4_ce70_7be5_43dc_5058a965884a["bufio"]
  4ab93de8_955a_4087_8264_32cf8000452f --> 3c539dc4_ce70_7be5_43dc_5058a965884a
  style 4ab93de8_955a_4087_8264_32cf8000452f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

package fiber

import (
	"bufio"
	"bytes"
	"fmt"
	"html/template"
	"io"
	"io/fs"
	"net/http"
	"net/url"
	"os"
	pathpkg "path"
	"path/filepath"
	"strconv"
	"strings"
	"time"
	"unicode"
	"unicode/utf8"

	"github.com/gofiber/utils/v2"
	"github.com/valyala/bytebufferpool"
	"github.com/valyala/fasthttp"
)

// SendFile defines configuration options when to transfer file with SendFile.
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.
	//
// ... (1078 more lines)

Domain

Subdomains

Dependencies

  • bufio

Frequently Asked Questions

What does res.go do?
res.go is a source file in the fiber codebase, written in go. It belongs to the FiberCore domain, Routing subdomain.
What functions are defined in res.go?
res.go defines 7 function(s): error, fallbackFilenameIfInvalid, headerContainsValue, sanitizeFilename, sendFileContentLength, shouldIncludeCharset, statusDisallowsBody.
What does res.go depend on?
res.go imports 1 module(s): bufio.
Where is res.go in the architecture?
res.go is located at res.go (domain: FiberCore, subdomain: Routing).

Analyze Your Own Codebase

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

Try Supermodel Free