Answers the format-specific loader once the remote
content type is known: a LoaderRegistry, or any object
with getLoader(extension).
How the loader reads; fetchDocument replaces the
global fetch.
Fetch source over HTTP/HTTPS and return a LoadedDocument.
The response body is buffered in memory and then handed to the appropriate
sub-loader according to the Content-Type header:
text/html → fetched as text, passed to the HTML loader as a Buffer.application/pdf → fetched as bytes, passed to the PDF loader as a
Buffer.'text' and
source metadata set to the URL.With fetchDocument, the answer it gives is handed on instead: HTML and
XHTML to the HTML loader, PDF to the PDF loader, anything else as plain
text, with source metadata set to the answer's last address.
HTTP/HTTPS URL string.
Optional options: LoadOptionsOptional load hints forwarded to the delegated loader.
A promise resolving to the LoadedDocument.
When source is a Buffer (URLs must be strings).
When the HTTP request fails (network error or non-2xx
status), or whatever fetchDocument throws.
When the answer is a PDF and the loader source has no
.pdf loader, or, with fetchDocument, HTML or XHTML and
it has no .html loader.
Readonly supportedURLs have no file extension so this array is always empty.
Routing to this loader must be performed via canLoad rather than the registry's extension-based lookup.
An IDocumentLoader that fetches a remote URL and delegates parsing to the appropriate registered loader based on the response
Content-Type.Supported content types
text/htmlapplication/pdfWith
fetchDocument, the answer's media type picks the loader:text/htmlandapplication/xhtml+xmlgo to the.htmlloader,application/pdfto the.pdfloader, anything else is read as UTF-8 text, andmetadata.sourceis the answer's last address after redirects. An HTML, XHTML or PDF answer the loader source has no loader for is refused with an error, so an HTML or XHTML answer is never returned as raw markup.Example
An address a person gave a server
Implements