@types/node-fetch

  • Version 2.6.11
  • Published
  • 11.9 kB
  • 2 dependencies
  • MIT license

Install

npm i @types/node-fetch
yarn add @types/node-fetch
pnpm add @types/node-fetch

Overview

TypeScript definitions for node-fetch

Index

Functions

function fetch

fetch: typeof fetch;

    function isRedirect

    isRedirect: (code: number) => boolean;

      Classes

      class AbortError

      class AbortError extends Error {}

        constructor

        constructor(message: string);

          property name

          readonly name: string;

            property type

            readonly type: string;

              class Blob

              class Blob {}

                constructor

                constructor(blobParts?: BlobPart[], options?: BlobOptions);

                  property size

                  readonly size: number;

                    property type

                    readonly type: string;

                      method slice

                      slice: (start?: number, end?: number) => Blob;

                        method text

                        text: () => Promise<string>;

                          class Body

                          class Body {}

                            constructor

                            constructor(
                            body?: any,
                            opts?: { size?: number | undefined; timeout?: number | undefined }
                            );

                              property body

                              body: NodeJS.ReadableStream;

                                property bodyUsed

                                bodyUsed: boolean;

                                  property size

                                  size: number;

                                    property timeout

                                    timeout: number;

                                      method arrayBuffer

                                      arrayBuffer: () => Promise<ArrayBuffer>;

                                        method blob

                                        blob: () => Promise<Blob>;

                                          method buffer

                                          buffer: () => Promise<Buffer>;

                                            method json

                                            json: () => Promise<any>;

                                              method text

                                              text: () => Promise<string>;

                                                method textConverted

                                                textConverted: () => Promise<string>;

                                                  class FetchError

                                                  class FetchError extends Error {}

                                                    constructor

                                                    constructor(message: string, type: string, systemError?: SystemError);

                                                      property code

                                                      code?: string;

                                                        property errno

                                                        errno?: string;

                                                          property name

                                                          name: string;

                                                            property type

                                                            type: string;

                                                              class Headers

                                                              class Headers implements Iterable<[string, string]> {}

                                                                constructor

                                                                constructor(init?: HeadersInit);

                                                                  method [Symbol.iterator]

                                                                  [Symbol.iterator]: () => Iterator<[string, string]>;

                                                                    method append

                                                                    append: (name: string, value: string) => void;

                                                                      method delete

                                                                      delete: (name: string) => void;

                                                                        method entries

                                                                        entries: () => IterableIterator<[string, string]>;

                                                                          method forEach

                                                                          forEach: (callback: (value: string, name: string) => void) => void;

                                                                            method get

                                                                            get: (name: string) => string | null;

                                                                              method has

                                                                              has: (name: string) => boolean;

                                                                                method keys

                                                                                keys: () => IterableIterator<string>;

                                                                                  method raw

                                                                                  raw: () => { [k: string]: string[] };

                                                                                    method set

                                                                                    set: (name: string, value: string) => void;

                                                                                      method values

                                                                                      values: () => IterableIterator<string>;

                                                                                        class Request

                                                                                        class Request extends Body {}

                                                                                          constructor

                                                                                          constructor(input: RequestInfo, init?: RequestInit);

                                                                                            property agent

                                                                                            agent?: any;

                                                                                              property compress

                                                                                              compress: boolean;

                                                                                                property context

                                                                                                context: RequestContext;

                                                                                                  property counter

                                                                                                  counter: number;

                                                                                                    property follow

                                                                                                    follow: number;

                                                                                                      property headers

                                                                                                      headers: Headers;

                                                                                                        property hostname

                                                                                                        hostname: string;

                                                                                                          property method

                                                                                                          method: string;

                                                                                                            property port

                                                                                                            port?: number;

                                                                                                              property protocol

                                                                                                              protocol: string;

                                                                                                                property redirect

                                                                                                                redirect: RequestRedirect;

                                                                                                                  property referrer

                                                                                                                  referrer: string;

                                                                                                                    property size

                                                                                                                    size: number;

                                                                                                                      property timeout

                                                                                                                      timeout: number;

                                                                                                                        property url

                                                                                                                        url: string;

                                                                                                                          method clone

                                                                                                                          clone: () => Request;

                                                                                                                            class Response

                                                                                                                            class Response extends Body {}

                                                                                                                              constructor

                                                                                                                              constructor(body?: any, init?: ResponseInit);

                                                                                                                                property headers

                                                                                                                                headers: Headers;

                                                                                                                                  property ok

                                                                                                                                  ok: boolean;

                                                                                                                                    property redirected

                                                                                                                                    redirected: boolean;

                                                                                                                                      property status

                                                                                                                                      status: number;

                                                                                                                                        property statusText

                                                                                                                                        statusText: string;

                                                                                                                                          property type

                                                                                                                                          type: ResponseType;

                                                                                                                                            property url

                                                                                                                                            url: string;

                                                                                                                                              method clone

                                                                                                                                              clone: () => Response;

                                                                                                                                                method error

                                                                                                                                                static error: () => Response;

                                                                                                                                                  method redirect

                                                                                                                                                  static redirect: (url: string, status: number) => Response;

                                                                                                                                                    Interfaces

                                                                                                                                                    interface RequestInit

                                                                                                                                                    interface RequestInit {}

                                                                                                                                                      property agent

                                                                                                                                                      agent?: RequestOptions['agent'] | ((parsedUrl: URL) => RequestOptions['agent']);

                                                                                                                                                        property body

                                                                                                                                                        body?: BodyInit | undefined;

                                                                                                                                                          property compress

                                                                                                                                                          compress?: boolean | undefined;

                                                                                                                                                            property follow

                                                                                                                                                            follow?: number | undefined;

                                                                                                                                                              property headers

                                                                                                                                                              headers?: HeadersInit | undefined;

                                                                                                                                                                property method

                                                                                                                                                                method?: string | undefined;

                                                                                                                                                                  property redirect

                                                                                                                                                                  redirect?: RequestRedirect | undefined;

                                                                                                                                                                    property signal

                                                                                                                                                                    signal?: AbortSignal | null | undefined;

                                                                                                                                                                      property size

                                                                                                                                                                      size?: number | undefined;

                                                                                                                                                                        property timeout

                                                                                                                                                                        timeout?: number | undefined;

                                                                                                                                                                          interface ResponseInit

                                                                                                                                                                          interface ResponseInit {}

                                                                                                                                                                            property counter

                                                                                                                                                                            counter?: number | undefined;

                                                                                                                                                                              property headers

                                                                                                                                                                              headers?: HeadersInit | undefined;

                                                                                                                                                                                property size

                                                                                                                                                                                size?: number | undefined;

                                                                                                                                                                                  property status

                                                                                                                                                                                  status?: number | undefined;

                                                                                                                                                                                    property statusText

                                                                                                                                                                                    statusText?: string | undefined;

                                                                                                                                                                                      property timeout

                                                                                                                                                                                      timeout?: number | undefined;

                                                                                                                                                                                        property url

                                                                                                                                                                                        url?: string | undefined;

                                                                                                                                                                                          Type Aliases

                                                                                                                                                                                          type BodyInit

                                                                                                                                                                                          type BodyInit =
                                                                                                                                                                                          | ArrayBuffer
                                                                                                                                                                                          | ArrayBufferView
                                                                                                                                                                                          | NodeJS.ReadableStream
                                                                                                                                                                                          | string
                                                                                                                                                                                          | URLSearchParams
                                                                                                                                                                                          | FormData;

                                                                                                                                                                                            type HeaderInit

                                                                                                                                                                                            type HeadersInit = Headers | string[][] | { [key: string]: string | string[] };

                                                                                                                                                                                              type HeadersInit

                                                                                                                                                                                              type HeadersInit = Headers | string[][] | { [key: string]: string | string[] };

                                                                                                                                                                                                type RequestCache

                                                                                                                                                                                                type RequestCache =
                                                                                                                                                                                                | 'default'
                                                                                                                                                                                                | 'force-cache'
                                                                                                                                                                                                | 'no-cache'
                                                                                                                                                                                                | 'no-store'
                                                                                                                                                                                                | 'only-if-cached'
                                                                                                                                                                                                | 'reload';

                                                                                                                                                                                                  type RequestContext

                                                                                                                                                                                                  type RequestContext =
                                                                                                                                                                                                  | 'audio'
                                                                                                                                                                                                  | 'beacon'
                                                                                                                                                                                                  | 'cspreport'
                                                                                                                                                                                                  | 'download'
                                                                                                                                                                                                  | 'embed'
                                                                                                                                                                                                  | 'eventsource'
                                                                                                                                                                                                  | 'favicon'
                                                                                                                                                                                                  | 'fetch'
                                                                                                                                                                                                  | 'font'
                                                                                                                                                                                                  | 'form'
                                                                                                                                                                                                  | 'frame'
                                                                                                                                                                                                  | 'hyperlink'
                                                                                                                                                                                                  | 'iframe'
                                                                                                                                                                                                  | 'image'
                                                                                                                                                                                                  | 'imageset'
                                                                                                                                                                                                  | 'import'
                                                                                                                                                                                                  | 'internal'
                                                                                                                                                                                                  | 'location'
                                                                                                                                                                                                  | 'manifest'
                                                                                                                                                                                                  | 'object'
                                                                                                                                                                                                  | 'ping'
                                                                                                                                                                                                  | 'plugin'
                                                                                                                                                                                                  | 'prefetch'
                                                                                                                                                                                                  | 'script'
                                                                                                                                                                                                  | 'serviceworker'
                                                                                                                                                                                                  | 'sharedworker'
                                                                                                                                                                                                  | 'style'
                                                                                                                                                                                                  | 'subresource'
                                                                                                                                                                                                  | 'track'
                                                                                                                                                                                                  | 'video'
                                                                                                                                                                                                  | 'worker'
                                                                                                                                                                                                  | 'xmlhttprequest'
                                                                                                                                                                                                  | 'xslt';

                                                                                                                                                                                                    type RequestCredentials

                                                                                                                                                                                                    type RequestCredentials = 'omit' | 'include' | 'same-origin';

                                                                                                                                                                                                      type RequestInfo

                                                                                                                                                                                                      type RequestInfo = string | URLLike | Request;

                                                                                                                                                                                                        type RequestMode

                                                                                                                                                                                                        type RequestMode = 'cors' | 'no-cors' | 'same-origin';

                                                                                                                                                                                                          type RequestRedirect

                                                                                                                                                                                                          type RequestRedirect = 'error' | 'follow' | 'manual';

                                                                                                                                                                                                            type ResponseType

                                                                                                                                                                                                            type ResponseType =
                                                                                                                                                                                                            | 'basic'
                                                                                                                                                                                                            | 'cors'
                                                                                                                                                                                                            | 'default'
                                                                                                                                                                                                            | 'error'
                                                                                                                                                                                                            | 'opaque'
                                                                                                                                                                                                            | 'opaqueredirect';

                                                                                                                                                                                                              Package Files (1)

                                                                                                                                                                                                              Dependencies (2)

                                                                                                                                                                                                              Dev Dependencies (0)

                                                                                                                                                                                                              No dev dependencies.

                                                                                                                                                                                                              Peer Dependencies (0)

                                                                                                                                                                                                              No peer dependencies.

                                                                                                                                                                                                              Badge

                                                                                                                                                                                                              To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                                                                                                              You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/node-fetch.

                                                                                                                                                                                                              • Markdown
                                                                                                                                                                                                                [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/node-fetch)
                                                                                                                                                                                                              • HTML
                                                                                                                                                                                                                <a href="https://www.jsdocs.io/package/@types/node-fetch"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>