Documentation ¶
Index ¶
- Constants
- func DescribeBytes(size int64) string
- func DurationToMS(d time.Duration, multiplier float64) string
- func ExtractKeywords(data []byte, keywordsToLookFor []string) ([]byte, map[string][]byte)
- func ExtractLocalImagePaths(html string) []string
- func FilterIntoGroups(bytelines [][]byte, filterfunc func([]byte) bool) ([][]byte, [][]byte)
- func GetDomain(req *http.Request) string
- func GetFilenames(dirname string) []string
- func Infostring(functionName string, args []string) string
- func RecorderToString(recorder *httptest.ResponseRecorder) string
- func URL2filename(dirname, urlpath string) string
- func WriteRecorder(w http.ResponseWriter, recorder *httptest.ResponseRecorder) int64
- func WriteStatus(sb *strings.Builder, title string, flags map[string]bool)
- type Node
- type PrefixMatch
Constants ¶
const ( // Pathsep is the path separator for the current platform Pathsep = string(filepath.Separator) // KiB is a kilobyte (kibibyte) KiB = 1024 // MiB is a megabyte (mibibyte) MiB = 1024 * 1024 )
Variables ¶
This section is empty.
Functions ¶
func DescribeBytes ¶
DescribeBytes converts bytes to KiB or MiB. Returns a string.
func DurationToMS ¶
DurationToMS converts time.Duration to milliseconds, as a string, (just the number as a string, no "ms" suffix).
func ExtractKeywords ¶
ExtractKeywords takes a source file as `data` and a list of keywords to
- look for. Lines without keywords are returned, together with a map
- from keywords to []bytes from the source `data`. *
- The keywords in the data must be on the form "keyword: value",
- and can be within single-line HTML comments (<-- ... -->).
func ExtractLocalImagePaths ¶ added in v1.15.5
ExtractLocalImagePaths can be used to find local image filenames that are included in the given HTML
func FilterIntoGroups ¶
FilterIntoGroups filters []byte slices into two groups, depending on the given filter function
func GetFilenames ¶
GetFilenames retrieves a list of filenames from a given directory name (that must exist)
func Infostring ¶
Infostring builds up a string on the form "functionname(arg1, arg2, arg3)"
func RecorderToString ¶
func RecorderToString(recorder *httptest.ResponseRecorder) string
RecorderToString discards the HTTP headers and return the recorder body as a string. Also flushes the recorder.
func URL2filename ¶
URL2filename translates a given URL path to a probable full filename
func WriteRecorder ¶
func WriteRecorder(w http.ResponseWriter, recorder *httptest.ResponseRecorder) int64
WriteRecorder writes to a ResponseWriter from a ResponseRecorder. Also flushes the recorder and returns how many bytes were written.
Types ¶
type PrefixMatch ¶ added in v1.15.0
type PrefixMatch struct {
// contains filtered or unexported fields
}
func (*PrefixMatch) Build ¶ added in v1.15.0
func (pm *PrefixMatch) Build(prefixes []string)
func (*PrefixMatch) Match ¶ added in v1.15.0
func (pm *PrefixMatch) Match(str string) []string