Home / Function/ sendFileContentLength() — fiber Function Reference

sendFileContentLength() — fiber Function Reference

Architecture documentation for the sendFileContentLength() function in res.go from the fiber codebase.

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

res.go lines 950–969

func sendFileContentLength(path string, cfg SendFile) (int64, error) {
	if cfg.FS != nil {
		cleanPath := pathpkg.Clean(utils.TrimLeft(path, '/'))
		if cleanPath == "." {
			cleanPath = ""
		}
		info, err := fs.Stat(cfg.FS, cleanPath)
		if err != nil {
			return 0, fmt.Errorf("stat %q: %w", cleanPath, err)
		}
		return info.Size(), nil
	}

	info, err := os.Stat(filepath.FromSlash(path))
	if err != nil {
		return 0, fmt.Errorf("stat %q: %w", path, err)
	}

	return info.Size(), nil
}

Domain

Subdomains

Defined In

Frequently Asked Questions

What does sendFileContentLength() do?
sendFileContentLength() is a function in the fiber codebase, defined in res.go.
Where is sendFileContentLength() defined?
sendFileContentLength() is defined in res.go at line 950.

Analyze Your Own Codebase

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

Try Supermodel Free