Documentation / @giro3d/piero / index / Fetcher
Variable: Fetcher
Fetcher:
object
Defined in: packages/piero/src/utils/Fetcher.ts:132
Type Declaration
checkAbsoluteHost
checkAbsoluteHost: (
host) =>boolean
Checks a host is parsable and starts with http(s)://. This is useful when passing hosts to Giro3D's HttpConfiguration.
Parameters
host
string
Host (e.g. https://example.com/foobar)
Returns
boolean
true if valid
fetch
fetch: (
urlOrData,fetchOptions?) =>Promise<Response> =fetchInternal
Fetcher that is able to fetch a URL (if string) or make a Response from a File-object.
This redefines loaders.gl's fetch function to use Giro3D's fetcher.
Parameters
urlOrData
string | Blob
URL to fetch or Blob
fetchOptions?
RequestInit
fetch options
Returns
Promise<Response>
The response object
fetchArrayBuffer
fetchArrayBuffer: (
url,fetchOptions?) =>Promise<ArrayBuffer>
Fetches a url, Blob-like object and returns an ArrayBuffer object
Parameters
url
string | Blob
URL or Blob-like object
fetchOptions?
RequestInit
fetch options
Returns
Promise<ArrayBuffer>
ArrayBuffer
fetchJson
fetchJson: <
T>(url,fetchOptions?) =>Promise<T>
Fetches a url or Blob-like object and returns the content as a JSON object
Type Parameters
T
T extends object = object
Type of the JSON object returned
Parameters
url
string | Blob
fetchOptions?
RequestInit
fetch options
Returns
Promise<T>
Content as JSON object
fetchText
fetchText: (
url,fetchOptions?) =>Promise<string>
Fetches a url or Blob-like object and returns the content as a string
Parameters
url
string | Blob
URL or Blob-like object
fetchOptions?
RequestInit
fetch options
Returns
Promise<string>
Content as string
getContext
getContext: (
urlOrFetchedData) =>FetchContext
Gets the context from a url, Response or Blob-like object
Parameters
urlOrFetchedData
string | Blob | Response
URL, Response or Blob-like object
Returns
Fetch context
toDataURL
toDataURL: (
url) =>Promise<string>
Parameters
url
string | Blob
Returns
Promise<string>