A library for implementing a custom fetch() function using Node.js streams. Version 3.2.3 is the current stable release. It allows you to define a handler that processes standard Request objects and returns Response options. It provides a low-level API (makeFetch) for completely custom logic and a higher-level routed API (makeRoutedFetch) for matching URL patterns, supporting wildcards. Ships TypeScript types. Similar to node-fetch but focused on custom protocol implementations.
npm install make-fetchNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates creating a custom fetch using makeFetch with a simple handler and making a request.
Ensure handler returns an object with status (number), headers (object optional), and body (async iterable or string).
Use a for-await loop to consume the body chunks: for await (const chunk of body) { ... }Use const { makeFetch } = require('make-fetch') instead of const makeFetch = require('make-fetch')Each handler should return a response object directly or via a promise, not call next().
Use import { makeFetch } from 'make-fetch'Use for await (const chunk of request.body) { ... }Return an object with a body property: either a string or an async iterable.
No dependency data recorded yet.