files

package
v2.0.0-...-eff2c45 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ContentBinaryHeaderValue header value for binary data.
	ContentBinaryHeaderValue = "application/octet-stream"
	// ContentWebassemblyHeaderValue header value for web assembly files.
	ContentWebassemblyHeaderValue = "application/wasm"
	// ContentHTMLHeaderValue is the  string of text/html response header's content type value.
	ContentHTMLHeaderValue = "text/html"
	// ContentJSONHeaderValue header value for JSON data.
	ContentJSONHeaderValue = "application/json"
	// ContentJSONProblemHeaderValue header value for JSON API problem error.
	// Read more at: https://tools.ietf.org/html/rfc7807
	ContentJSONProblemHeaderValue = "application/problem+json"
	// ContentXMLProblemHeaderValue header value for XML API problem error.
	// Read more at: https://tools.ietf.org/html/rfc7807
	ContentXMLProblemHeaderValue = "application/problem+xml"
	// ContentJavascriptHeaderValue header value for JSONP & Javascript data.
	ContentJavascriptHeaderValue = "text/javascript"
	// ContentTextHeaderValue header value for Text data.
	ContentTextHeaderValue = "text/plain"
	// ContentXMLHeaderValue header value for XML data.
	ContentXMLHeaderValue = "text/xml"
	// ContentXMLUnreadableHeaderValue obselete header value for XML.
	ContentXMLUnreadableHeaderValue = "application/xml"
	// ContentMarkdownHeaderValue custom key/content type, the real is the text/html.
	ContentMarkdownHeaderValue = "text/markdown"
	// ContentYAMLHeaderValue header value for YAML data.
	ContentYAMLHeaderValue = "application/x-yaml"
	// ContentYAMLTextHeaderValue header value for YAML plain text.
	ContentYAMLTextHeaderValue = "text/yaml"
	// ContentProtobufHeaderValue header value for Protobuf messages data.
	ContentProtobufHeaderValue = "application/x-protobuf"
	// ContentMsgPackHeaderValue header value for MsgPack data.
	ContentMsgPackHeaderValue = "application/msgpack"
	// ContentMsgPack2HeaderValue alternative header value for MsgPack data.
	ContentMsgPack2HeaderValue = "application/x-msgpack"
	// ContentFormHeaderValue header value for post form data.
	ContentFormHeaderValue = "application/x-www-form-urlencoded"
	// ContentFormMultipartHeaderValue header value for post multipart form data.
	ContentFormMultipartHeaderValue = "multipart/form-data"
	// ContentMultipartRelatedHeaderValue header value for multipart related data.
	ContentMultipartRelatedHeaderValue = "multipart/related"
	// ContentGRPCHeaderValue Content-Type header value for gRPC.
	ContentGRPCHeaderValue = "application/grpc"
)
View Source
const PermDir = 0755
View Source
const PermFile = 0644

Variables

This section is empty.

Functions

func IsNamedPipe

func IsNamedPipe(mode os.FileMode) bool
func IsSymlink(mode os.FileMode) bool

Types

type FileInfo

type FileInfo struct {
	*Listing
	Fs           afero.Fs          `json:"-"`
	Path         string            `json:"path"`
	Name         string            `json:"name"`
	Size         int64             `json:"size"`
	ModTime      time.Time         `json:"modified"`
	Mode         os.FileMode       `json:"mode"`
	IsDir        bool              `json:"isDir"`
	IsSymlink    bool              `json:"isSymlink"`
	Extension    string            `json:"extension"`
	Type         string            `json:"type"`
	Checksums    map[string]string `json:"checksums,omitempty"`
	Token        string            `json:"token,omitempty"`
	PresignedURL string            `json:"presignedURL,omitempty"`
}

FileInfo describes a file.

func NewFileInfo

func NewFileInfo(opts *FileOptions) (*FileInfo, error)

NewFileInfo creates a File object from a path and a given user. This File object will be automatically filled depending on if it is a directory or a file.

func (*FileInfo) RealPath

func (i *FileInfo) RealPath() string

type FileOptions

type FileOptions struct {
	Fs      afero.Fs
	Path    string
	Modify  bool
	Expand  bool
	Token   string
	Checker rules.Checker
}

FileOptions are the options when getting a file info.

type Listing

type Listing struct {
	Items    []*FileInfo `json:"items"`
	NumDirs  int         `json:"numDirs"`
	NumFiles int         `json:"numFiles"`
	Sorting  Sorting     `json:"sorting"`
}

Listing is a collection of files.

func (Listing) ApplySort

func (l Listing) ApplySort()

ApplySort applies the sort order using .Order and .Sort

type Sorting

type Sorting struct {
	By  string `json:"by"`
	Asc bool   `json:"asc"`
}

Sorting contains a sorting order.

Jump to

Keyboard shortcuts

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