Help us shape the future of Go! Take the 2026 Go Developer Survey

asset

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: BSD-3-Clause Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dependencies

type Dependencies struct {
	archive.ArchiveFactory
}

type FileAsset

type FileAsset struct {
	// contains filtered or unexported fields
}

Represents a publication stored as a file on the local file system.

func File

func File(filepath string) *FileAsset

func FileWithMediaType

func FileWithMediaType(filepath string, mediatype *mediatype.MediaType) *FileAsset

Creates a FileAsset from a File and an optional media type, when known.

func FileWithMediaTypeHint

func FileWithMediaTypeHint(filepath string, mediatypeHint string) *FileAsset

Creates a FileAsset from a File and an optional media type hint. Providing a media type hint will improve performances when sniffing the media type.

func (*FileAsset) CreateFetcher

func (a *FileAsset) CreateFetcher(dependencies Dependencies, credentials string) (fetcher.Fetcher, error)

CreateFetcher implements PublicationAsset

func (*FileAsset) MediaType

func (a *FileAsset) MediaType() mediatype.MediaType

MediaType implements PublicationAsset

func (*FileAsset) Name

func (a *FileAsset) Name() string

Name implements PublicationAsset

type PublicationAsset

type PublicationAsset interface {
	Name() string                                                                         // Name of the asset, e.g. a filename.
	MediaType() mediatype.MediaType                                                       // Media type of the asset. If unknown, fallback on `MediaType.Binary`.
	CreateFetcher(dependencies Dependencies, credentials string) (fetcher.Fetcher, error) // Creates a fetcher used to access the asset's content.
}

Represents a digital medium (e.g. a file) offering access to a publication.

Jump to

Keyboard shortcuts

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