d3-fetch is a D3 module providing convenient parsing on top of the Fetch API for loading and parsing text, JSON, CSV, TSV, and XML files. Version 3.0.1 is the latest stable release, with no active development since 2021. It is part of the D3 v6/v7 ecosystem, replacing the older d3-request module. Differentiators include built-in support for common data formats, row conversion functions for DSV files, and compatibility with modern JavaScript modules and UMD bundles. Requires Node >=12.
npm install d3-fetchNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates loading text, CSV, and JSON files using async/await with the three main functions.
Use ES module import (import) or switch to the UMD bundle for legacy environments.
Replace d3.xhr, d3.text, etc. with the corresponding d3-fetch functions.
Ensure d3-dsv is installed (npm install d3-dsv).
Use await or .then() to handle the promise.
Pass init (optional) before row: csv(url, init, row) not csv(url, row).
npm install d3-dsv
Use import { csv } from 'd3-fetch' instead of const d3 = require('d3-fetch').Ensure the URL is correct and the server supports CORS or use a proxy.