fileutil

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 11, 2026 License: Apache-2.0 Imports: 11 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const TempFileSuffix = ".tmp"

Variables

View Source
var StaticMimeTypeMap = map[string]string{}/* 1261 elements not displayed */

Functions

func AtomicWriteFile

func AtomicWriteFile(fileName string, data []byte, perm os.FileMode) error

func DetectMimeType

func DetectMimeType(path string, fileInfo fs.FileInfo, extended bool) string

on error just returns "" does not return "application/octet-stream" as this is considered a detection failure can pass an existing fileInfo to avoid re-statting the file falls back to text/plain for 0 byte files

func DetectMimeTypeWithDirEnt

func DetectMimeTypeWithDirEnt(path string, dirEnt fs.DirEntry) string

func FixPath

func FixPath(path string) (string, error)

func IsInitScriptPath

func IsInitScriptPath(input string) bool

IsInitScriptPath tries to determine if the input string is a path to a script rather than an inline script content.

func WinSymlinkDir

func WinSymlinkDir(path string, bits os.FileMode) bool

Types

type ByteRangeType

type ByteRangeType struct {
	All     bool
	Start   int64
	End     int64 // inclusive; only valid when OpenEnd is false
	OpenEnd bool  // true when range is "N-" (read from Start to EOF)
}

func ParseByteRange

func ParseByteRange(rangeStr string) (ByteRangeType, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL