A library that provides a browser-compatible fetch() API for IPFS, allowing developers to fetch content from IPFS and IPNS URLs using the same interface as HTTP fetch. Version 5.3.0 is the latest stable release, with occasional updates. It wraps an IPFS instance (e.g., ipfs-core) and returns a fetch function that supports GET, PUT, HEAD methods, range requests, directory listings, and file uploads via FormData. Key differentiators: mimics Web Fetch API exactly, supports both ipfs:// and ipns:// schemes, and allows directory listing with HTML/JSON responses.
npm install js-ipfs-fetchNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates an IPFS instance, initializes ipfs-fetch with it, fetches a file via IPFS URL, logs its text content, and stops the IPFS node.
Always await makeIpfsFetch({ ipfs }) before using fetch.Ensure ipfs is created and started before passing to makeIpfsFetch.
Always append '/' to directory CIDs when fetching.
Upgrade to latest version and use async/await or .then() syntax.
Use import makeIpfsFetch from 'ipfs-fetch' (default import).
const ipfs = await create(); const fetch = await makeIpfsFetch({ ipfs });const fetch = await makeIpfsFetch({ ipfs });Check that the CID exists and the IPFS node is connected to network.