[]previous and next page

safeImageFetch

Creates a fetch that only connects to addresses refuse allows.

Creates a fetch that only connects to addresses refuse allows.

Import#

ts
import { safeImageFetch } from "@shadow-js/dusk/server";

Signature#

ts
function safeImageFetch(options: SafeImageFetchOptions = {}): typeof fetch

Parameters#

Name Description
options The resolver and the predicate (both default to the system's).

Returns#

A fetch for images.fetch.

Throws#

  • TypeError (from the returned function) for a URL that is not http(s), has credentials, or names a refused host.
  • Error (from the returned function) when the name resolves to no address, or to any refused one.