URL of the resource.
A Blob with the current resource content.
An array of Links (a subset of links), containing only subresource links, and
for whose subresourceType
a Resource subclass exists. That is, those links that fromLink accepts.
Static
fromCreate a Resource from a Blob and a URL, and a subresource type.
Note that the URL is not resolved (see fromLink for that), but is used to interpret any relative links that the resource may contain.
Currently, the subresourceType
is mandatory, and determines what subclass of Resource is
instantiated (in freeze-dry, this method is only used for subresources, so the expected type
is always known). The Blob’s MIME type is ignored.
An instance of a subclass of Resource matching the given subresource type.
Perform a function on each subresource link.
A promise that completes when all invocations have completed.
Invoked on each subresource link.
Static
fromFetch the resource a given link
points to, and return it as a Resource.
This method does not modify the given link; the caller can store the created Resource in
link.resource
, to grow a tree of links and resources.
link.resource = await Resource.fromLink(link)
The newly created Resource.
The link pointing to the resource.
Optional environment configuration.
Static
getDetermine the Resource subclass to use for the given subresource type.
The appropriate Resource subclass, or undefined
if the type is not
supported.
The type of subresource expected by the parent resource, e.g.
'image'
or 'style'
. Note this is not the same as its MIME type.
LeafResource represents any Resource without links (e.g. fonts, images, videos).
It basically contains a Blob and a URL, and does nothing special.