@types/d3-fetch

  • Version 3.0.7
  • Published
  • 16.9 kB
  • 1 dependency
  • MIT license

Install

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

Overview

TypeScript definitions for d3-fetch

Index

Functions

function blob

blob: (url: string, init?: RequestInit) => Promise<Blob>;
  • Fetches the binary file at the specified input URL and returns it as a Promise of a Blob. If init is specified, it is passed along to the underlying call to fetch.

    Parameter url

    A valid URL string.

    Parameter init

    An optional request initialization object.

function buffer

buffer: (url: string, init?: RequestInit) => Promise<ArrayBuffer>;
  • Fetches the binary file at the specified input URL and returns it as a Promise of an ArrayBuffer. If init is specified, it is passed along to the underlying call to fetch.

    Parameter url

    A valid URL string.

    Parameter init

    An optional request initialization object.

function csv

csv: {
<Columns extends string>(url: string, init?: RequestInit): Promise<
DSVRowArray<Columns>
>;
<ParsedRow extends object, Columns extends string = string>(
url: string,
row: (
rawRow: DSVRowString<Columns>,
index: number,
columns: Columns[]
) => ParsedRow
): Promise<DSVParsedArray<ParsedRow>>;
<ParsedRow extends object, Columns extends string = string>(
url: string,
init: RequestInit,
row: (
rawRow: DSVRowString<Columns>,
index: number,
columns: Columns[]
) => ParsedRow
): Promise<DSVParsedArray<ParsedRow>>;
};
  • Fetches the CSV file at the specified input URL and returns a promise of an array of objects representing the parsed rows. The values of the properties of the parsed row objects are represented as strings.

    If init is specified, it is passed along to the underlying call to fetch.

    The generic parameter describes the column names as a union of string literal types.

    Parameter url

    A valid URL string.

    Parameter init

    An optional request initialization object.

  • Fetches the CSV file at the specified input URL and returns a promise of an array of objects representing the parsed rows.

    The specified row conversion function is used to map and filter row objects to a more-specific representation; see dsv.csvParse for details.

    The first generic parameter describes the type of the object representation of a parsed row. The second generic parameter describes the column names as a union of string literal types.

    Parameter url

    A valid URL string.

    Parameter row

    A row conversion function which is invoked for each row, being passed an object representing the current row (d), the index (i) starting at zero for the first non-header row, and the array of column names. If the returned value is null or undefined, the row is skipped and will be omitted from the array returned by dsv.csvParse; otherwise, the returned value defines the corresponding row object. In effect, row is similar to applying a map and filter operator to the returned rows.

  • Fetches the CSV file at the specified input URL and returns a promise of an array of objects representing the parsed rows.

    The init object is passed along to the underlying call to fetch.

    The specified row conversion function is used to map and filter row objects to a more-specific representation; see dsv.csvParse for details.

    The first generic parameter describes the type of the object representation of a parsed row. The second generic parameter describes the column names as a union of string literal types.

    Parameter url

    A valid URL string.

    Parameter init

    An request initialization object.

    Parameter row

    A row conversion function which is invoked for each row, being passed an object representing the current row (d), the index (i) starting at zero for the first non-header row, and the array of column names. If the returned value is null or undefined, the row is skipped and will be omitted from the array returned by dsv.csvParse; otherwise, the returned value defines the corresponding row object. In effect, row is similar to applying a map and filter operator to the returned rows.

function dsv

dsv: {
<Columns extends string>(
delimiter: string,
url: string,
init?: RequestInit
): Promise<DSVRowArray<Columns>>;
<ParsedRow extends object, Columns extends string = string>(
delimiter: string,
url: string,
row: (
rawRow: DSVRowString<Columns>,
index: number,
columns: Columns[]
) => ParsedRow
): Promise<DSVParsedArray<ParsedRow>>;
<ParsedRow extends object, Columns extends string = string>(
delimiter: string,
url: string,
init: RequestInit,
row: (
rawRow: DSVRowString<Columns>,
index: number,
columns: Columns[]
) => ParsedRow
): Promise<DSVParsedArray<ParsedRow>>;
};
  • Fetches the DSV file with the specified delimiter character at the specified input URL and returns a promise of an array of objects representing the parsed rows. The values of the properties of the parsed row objects are represented as strings.

    If init is specified, it is passed along to the underlying call to fetch.

    The generic parameter describes the column names as a union of string literal types.

    Parameter delimiter

    The delimiter character used in the DSV file to be fetched.

    Parameter url

    A valid URL string.

    Parameter init

    An optional request initialization object.

  • Fetches the DSV file with the specified delimiter character at the specified input URL and returns a promise of an array of objects representing the parsed rows.

    The specified row conversion function is used to map and filter row objects to a more-specific representation; see dsv.parse for details.

    The first generic parameter describes the type of the object representation of a parsed row. The second generic parameter describes the column names as a union of string literal types.

    Parameter delimiter

    The delimiter character used in the DSV file to be fetched.

    Parameter url

    A valid URL string.

    Parameter row

    A row conversion function which is invoked for each row, being passed an object representing the current row (d), the index (i) starting at zero for the first non-header row, and the array of column names. If the returned value is null or undefined, the row is skipped and will be omitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object. In effect, row is similar to applying a map and filter operator to the returned rows.

  • Fetches the DSV file with the specified delimiter character at the specified input URL and returns a promise of an array of objects representing the parsed rows.

    The init object is passed along to the underlying call to fetch.

    The specified row conversion function is used to map and filter row objects to a more-specific representation; see dsv.parse for details.

    The first generic parameter describes the type of the object representation of a parsed row. The second generic parameter describes the column names as a union of string literal types.

    Parameter delimiter

    The delimiter character used in the DSV file to be fetched.

    Parameter url

    A valid URL string.

    Parameter init

    An request initialization object.

    Parameter row

    A row conversion function which is invoked for each row, being passed an object representing the current row (d), the index (i) starting at zero for the first non-header row, and the array of column names. If the returned value is null or undefined, the row is skipped and will be omitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object. In effect, row is similar to applying a map and filter operator to the returned rows.

function html

html: (url: string, init?: RequestInit) => Promise<Document>;
  • Fetches the file at the specified input URL as text, parses it as HTML and returns a Promise of an HTML DOM Document.

    If init is specified, it is passed along to the underlying call to fetch.

    Parameter url

    A valid URL string.

    Parameter init

    An optional request initialization object.

function image

image: (
url: string,
init?: Partial<HTMLImageElement>
) => Promise<HTMLImageElement>;
  • Fetches the image at the specified input URL and returns a promise of an HTML image element.

    If init is specified, sets any additional properties on the image before loading.

    Parameter url

    A valid URL string.

    Parameter init

    An optional object of image properties to set.

function json

json: <ParsedJSONObject extends unknown>(
url: string,
init?: RequestInit
) => Promise<ParsedJSONObject | undefined>;
  • Fetches the json file at the specified input URL and returns it as a Promise of a parsed JSON object.

    If init is specified, it is passed along to the underlying call to fetch.

    If the server returns a status code of [204 No Content](https://developer.mozilla.org/docs/Web/HTTP/Status/204) or [205 Reset Content](https://developer.mozilla.org/docs/Web/HTTP/Status/205), the promise resolves to undefined.

    The generic parameter describes the type of the object parsed from the returned JSON.

    Parameter url

    A valid URL string.

    Parameter init

    An optional request initialization object.

function svg

svg: (url: string, init?: RequestInit) => Promise<Document>;
  • Fetches the file at the specified input URL as text, parses it as SVG and returns a Promise of an SVG Document.

    If init is specified, it is passed along to the underlying call to fetch.

    Parameter url

    A valid URL string.

    Parameter init

    An optional request initialization object.

function text

text: (url: string, init?: RequestInit) => Promise<string>;
  • Fetches the text file at the specified input URL and returns it as a Promise of a string.

    If init is specified, it is passed along to the underlying call to fetch.

    Parameter url

    A valid URL string.

    Parameter init

    An optional request initialization object.

function tsv

tsv: {
<Columns extends string>(url: string, init?: RequestInit): Promise<
DSVRowArray<Columns>
>;
<ParsedRow extends object, Columns extends string = string>(
url: string,
row: (
rawRow: DSVRowString<Columns>,
index: number,
columns: Columns[]
) => ParsedRow
): Promise<DSVParsedArray<ParsedRow>>;
<ParsedRow extends object, Columns extends string = string>(
url: string,
init: RequestInit,
row: (
rawRow: DSVRowString<Columns>,
index: number,
columns: Columns[]
) => ParsedRow
): Promise<DSVParsedArray<ParsedRow>>;
};
  • Fetches the TSV file at the specified input URL and returns a promise of an array of objects representing the parsed rows.

    If init is specified, it is passed along to the underlying call to fetch.

    The generic parameter describes the column names as a union of string literal types.

    Parameter url

    A valid URL string.

    Parameter init

    An optional request initialization object.

  • Fetches the TSV file at the specified input URL and returns a promise of an array of objects representing the parsed rows. The values of the properties of the parsed row objects are represented as strings.

    The specified row conversion function is used to map and filter row objects to a more-specific representation; see dsv.tsvParse for details.

    The first generic parameter describes the type of the object representation of a parsed row. The second generic parameter describes the column names as a union of string literal types.

    Parameter url

    A valid URL string.

    Parameter row

    A row conversion function which is invoked for each row, being passed an object representing the current row (d), the index (i) starting at zero for the first non-header row, and the array of column names. If the returned value is null or undefined, the row is skipped and will be omitted from the array returned by dsv.tsvParse; otherwise, the returned value defines the corresponding row object. In effect, row is similar to applying a map and filter operator to the returned rows.

  • Fetches the TSV file at the specified input URL and returns a promise of an array of objects representing the parsed rows.

    The init object is passed along to the underlying call to fetch.

    The specified row conversion function is used to map and filter row objects to a more-specific representation; see dsv.tsvParse for details.

    The first generic parameter describes the type of the object representation of a parsed row. The second generic parameter describes the column names as a union of string literal types.

    Parameter url

    A valid URL string.

    Parameter init

    An request initialization object.

    Parameter row

    A row conversion function which is invoked for each row, being passed an object representing the current row (d), the index (i) starting at zero for the first non-header row, and the array of column names. If the returned value is null or undefined, the row is skipped and will be omitted from the array returned by dsv.tsvParse; otherwise, the returned value defines the corresponding row object. In effect, row is similar to applying a map and filter operator to the returned rows.

function xml

xml: (url: string, init?: RequestInit) => Promise<XMLDocument>;
  • Fetches the file at the specified input URL as text, parses it as XML and returns a Promise of an XML Document.

    If init is specified, it is passed along to the underlying call to fetch.

    Parameter url

    A valid URL string.

    Parameter init

    An optional request initialization object.

Package Files (1)

Dependencies (1)

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/d3-fetch.

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