Documentation
¶
Index ¶
- type Dependencies
- type FileAsset
- func (a *FileAsset) CreateFetcher(ctx context.Context, dependencies Dependencies, credentials string) (fetcher.Fetcher, error)
- func (a *FileAsset) CreateRelativeFetcher(ctx context.Context, root url.URL) (fetcher.Fetcher, error)
- func (a *FileAsset) Location() url.URL
- func (a *FileAsset) MediaType(ctx context.Context) mediatype.MediaType
- func (a *FileAsset) Name() string
- type GCSAsset
- func (a *GCSAsset) CreateFetcher(ctx context.Context, dependencies Dependencies, credentials string) (fetcher.Fetcher, error)
- func (a *GCSAsset) CreateRelativeFetcher(ctx context.Context, root url.URL) (fetcher.Fetcher, error)
- func (a *GCSAsset) Location() url.URL
- func (a *GCSAsset) MediaType(ctx context.Context) mediatype.MediaType
- func (a *GCSAsset) Name() string
- type HTTPAsset
- func (a *HTTPAsset) CreateFetcher(ctx context.Context, dependencies Dependencies, credentials string) (fetcher.Fetcher, error)
- func (a *HTTPAsset) CreateRelativeFetcher(ctx context.Context, root url.URL) (fetcher.Fetcher, error)
- func (a *HTTPAsset) Location() url.URL
- func (a *HTTPAsset) MediaType(ctx context.Context) mediatype.MediaType
- func (a *HTTPAsset) Name() string
- type PublicationAsset
- type RelativePublicationAsset
- type S3Asset
- func (a *S3Asset) CreateFetcher(ctx context.Context, dependencies Dependencies, credentials string) (fetcher.Fetcher, error)
- func (a *S3Asset) CreateRelativeFetcher(ctx context.Context, root url.URL) (fetcher.Fetcher, error)
- func (a *S3Asset) Location() url.URL
- func (a *S3Asset) MediaType(ctx context.Context) mediatype.MediaType
- func (a *S3Asset) Name() string
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 FileWithMediaType ¶
Creates a FileAsset from a File and an optional media type, when known.
func FileWithMediaTypeHint ¶
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(ctx context.Context, dependencies Dependencies, credentials string) (fetcher.Fetcher, error)
CreateFetcher implements PublicationAsset
func (*FileAsset) CreateRelativeFetcher ¶ added in v0.15.0
func (a *FileAsset) CreateRelativeFetcher(ctx context.Context, root url.URL) (fetcher.Fetcher, error)
CreateRelativeFetcher implements RelativePublicationAsset
type GCSAsset ¶ added in v0.9.0
type GCSAsset struct {
// contains filtered or unexported fields
}
Represents a publication stored on an Amazon S3-compatible remote server.
func GCSWithMediaType ¶ added in v0.9.0
func GCSWithMediaType(client *storage.Client, uri url.AbsoluteURL, mediatype *mediatype.MediaType) *GCSAsset
Creates a S3Asset from a File and an optional media type, when known.
func (*GCSAsset) CreateFetcher ¶ added in v0.9.0
func (a *GCSAsset) CreateFetcher(ctx context.Context, dependencies Dependencies, credentials string) (fetcher.Fetcher, error)
CreateFetcher implements PublicationAsset
func (*GCSAsset) CreateRelativeFetcher ¶ added in v0.15.0
func (a *GCSAsset) CreateRelativeFetcher(ctx context.Context, root url.URL) (fetcher.Fetcher, error)
CreateRelativeFetcher implements RelativePublicationAsset
type HTTPAsset ¶ added in v0.9.0
type HTTPAsset struct {
// contains filtered or unexported fields
}
Represents a publication stored on an Amazon S3-compatible remote server.
func HTTPWithMediaType ¶ added in v0.9.0
func HTTPWithMediaType(client *http.Client, url url.AbsoluteURL, mediatype *mediatype.MediaType) *HTTPAsset
Creates a HTTPAsset from a File and an optional media type, when known.
func (*HTTPAsset) CreateFetcher ¶ added in v0.9.0
func (a *HTTPAsset) CreateFetcher(ctx context.Context, dependencies Dependencies, credentials string) (fetcher.Fetcher, error)
CreateFetcher implements PublicationAsset
func (*HTTPAsset) CreateRelativeFetcher ¶ added in v0.15.0
func (a *HTTPAsset) CreateRelativeFetcher(ctx context.Context, root url.URL) (fetcher.Fetcher, error)
CreateRelativeFetcher implements RelativePublicationAsset
type PublicationAsset ¶
type PublicationAsset interface {
Name() string // Name of the asset, e.g. a filename.
MediaType(ctx context.Context) mediatype.MediaType // Media type of the asset. If unknown, fallback on `MediaType.Binary`.
CreateFetcher(ctx context.Context, 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.
type RelativePublicationAsset ¶ added in v0.15.0
type RelativePublicationAsset interface {
PublicationAsset
// The URL of the asset within its medium, e.g. a file path URL, or an
// HTTP(S), S3 or GS URL. HREFs relative to the asset resolve against it.
Location() url.URL
// Creates a fetcher serving the resources surrounding this asset, rooted at [root]:
// a link with HREF `a/file.xhtml` is fetched from `a/file.xhtml` under the root
// directory, whether the asset lives on a local file system or on a remote server.
//
// [root] must be the URL of a directory containing the asset, typically derived
// from [Location] by resolving a `./` or `../` reference against it.
CreateRelativeFetcher(ctx context.Context, root url.URL) (fetcher.Fetcher, error)
}
A PublicationAsset which can also provide access to resources located relative to itself, e.g. the resources referenced by a bare (exploded) Readium Web Publication Manifest.
type S3Asset ¶ added in v0.9.0
type S3Asset struct {
// contains filtered or unexported fields
}
Represents a publication stored on an Amazon S3-compatible remote server.
func S3WithMediaType ¶ added in v0.9.0
func S3WithMediaType(client *s3.Client, uri url.AbsoluteURL, mediatype *mediatype.MediaType) *S3Asset
Creates a S3Asset from a File and an optional media type, when known.
func (*S3Asset) CreateFetcher ¶ added in v0.9.0
func (a *S3Asset) CreateFetcher(ctx context.Context, dependencies Dependencies, credentials string) (fetcher.Fetcher, error)
CreateFetcher implements PublicationAsset
func (*S3Asset) CreateRelativeFetcher ¶ added in v0.15.0
CreateRelativeFetcher implements RelativePublicationAsset