Returns true if this resource provider accepts the given URL. Whether the URL is accepted or not is implementation specific. It could for example be that the specified URL must be relative to the Base URL, or that the protocol used is http. Note that this is not an "exists" check, calling fetch() with the given URL can still fail even if this method returns true.
If this method returns false, the fetch() method will fail with the specified URL.
Starts fetching a resource from this ResourceProvider. The returned Promise is resolved once a successful response is available.
The response includes both the metadata for the resource and methods for reading the resource body.
If a relative URL is specified, it will be resolved against the base URL of this ResourceProvider. If this ResourceProvider does not have a base URL, relative URLs will cause the returned Promise to be rejected.
Contrary to the browser Fetch API, this method MUST reject the returned Promise if the request is non-successful, such as if the resource could not be found.
The options
parameter can be used to configure how the resource should be fetched.
If the options
parameter is not defined, the fetch is performed using the default values specified in IResourceRequestOptions.
The absolute or relative URL to fetch.
Options for how to perform the fetch request.
Fetches metadata about a resource using the specified URL.
If a relative URL is specified, it will be resolved against the base URL of this ResourceProvider. If this ResourceProvider does not have a base URL, relative URLs will cause the returned Promise to be rejected.
The options
parameter can be used to configure the request.
If the options
parameter is not defined, the request is performed using the default values specified in IResourceRequestOptions.
The absolute or relative URL to the resource.
Options for how to perform the request.
Get the base URL for this ResourceProvider, if available. Relative URLs passed to fetch() or fetchMetadata() will be resolved using this base URL. The path component of the base URL SHOULD end with a forward slash.
If null is returned, relative URLs cannot be used with fetch() or fetchMetadata().
Get a list of ResourceMetadata items for all resources that can be fetched from this ResourceProvider instance. Returns null if this resource provider does not have a resource manifest.
For example, the ZipResourceProvider has a central directory containing metadata about all resources within the zip file, and would therefore return a resource manifest.
As another example, An HttpResourceProvider can probably not know about all available resources and should therefore return null.
Returns true if acceptsUrl() returns true for the URL, and the URL can be used by the browser directly without being fetched from the ResourceProvider.
For example: If true is returned, the URL can be assigned to the src
attributes of ,
Returns false otherwise.
Generated using TypeDoc
The ResourceProvider is an abstraction hiding the details about resource retrieval from the reading system. There are several implementations of this interface. For example: EpubOcfResourceProvider and ZipResourceProvider.