urischeme

package
v2.16.2 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2024 License: Apache-2.0 Imports: 5 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToFilePathArray

func ToFilePathArray(v []URIScheme) []string

ToFilePathArray returns an array of file paths from an array of URIScheme. If a URIScheme does not have a file path, it is not included in the result.

Types

type URIScheme

type URIScheme string

URIScheme represents a string type that defines a URI scheme. Supported URI schemes are: - /path/to/file (backward compatibility) - file:///path/to/file (RFC 8089) - data:;base64,SGVsbG8sIFdvcmxkIQ== (RFC 2397) - data:,plgd (RFC 2397)

func ToURISchemeArray

func ToURISchemeArray(v []string) []URIScheme

ToURISchemeArray converts a slice of strings to a slice of URIScheme.

func (URIScheme) FilePath

func (p URIScheme) FilePath() string

FilePath returns the file path of the URI scheme if it is a file URI scheme. If the URI scheme is a data URI scheme or any other supported URI scheme, it returns an empty string.

func (URIScheme) IsData

func (p URIScheme) IsData() bool

IsData returns true if the URIScheme is a data URI scheme.

func (URIScheme) IsFile

func (p URIScheme) IsFile() bool

IsFile returns true if the URIScheme is a file scheme.

func (URIScheme) Read

func (p URIScheme) Read() ([]byte, error)

Read reads the value of the URIScheme property. If the property is a data URI, it reads the data from the URI. Otherwise, it reads the data from the file specified by the URI.

Jump to

Keyboard shortcuts

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