Registry / devops / fatcher

fatcher

JSON →
library3.0.2jsnpmunverified

Fatcher is a lightweight, zero-dependency HTTP request library built on the native fetch API, designed for both browsers and Node.js environments (Node.js >= 18.0.0). Current stable version is 3.0.2, released with TypeScript support and a composable middleware system inspired by Koa. Key differentiators: <1kb size, streaming API support, compatible with all modern browsers (Chrome 66+, Firefox 65+, Safari 12.1+, Edge 16+), and seamless cross-platform usage. Unlike axios or got, fatcher leverages the native fetch API with a tiny middleware layer for extensibility.

npm install fatcher
INSTALL
IMPORT
SIG · FATCHER
F
fatcher
devopsjavascriptv3.0.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

fatcher
import { fatcher } from 'fatcher'
import fatcher from 'fatcher'
fatcher is a named export, not default. Wrong import will cause undefined.
defineMiddleware
import { defineMiddleware } from 'fatcher'
const { defineMiddleware } = require('fatcher')
fatcher is ESM-only (type: module), CJS require is not supported.
FatcherOptions
import type { FatcherOptions } from 'fatcher'
import { FatcherOptions } from 'fatcher'
FatcherResponse
import type { FatcherResponse } from 'fatcher'
import { FatcherResponse } from 'fatcher'
Types should be imported with `import type` to avoid runtime errors in bundlers.

Demonstrates basic fatcher usage with a custom logging middleware and async/await.

import { fatcher, defineMiddleware } from 'fatcher'; const logger = defineMiddleware(async (context, next) => { const start = Date.now(); const response = await next(); console.log(`Request took ${Date.now() - start}ms`); return response; }); async function main() { try { const res = await fatcher('https://jsonplaceholder.typicode.com/todos/1', { middlewares: [logger], headers: { 'Content-Type': 'application/json' } }); const data = await res.json(); console.log('Todo:', data); } catch (error) { console.error('Fetch failed:', error); } } main();
Debug
Known issues
breakingfatcher v3 is ESM-only; CommonJS require() will fail.
fix
Use import syntax or set type: module in package.json.
affects: >=3.0.0
breakingNode.js 18+ required; older versions are not supported.
fix
Upgrade Node.js to >=18.
affects: >=3.0.0
deprecatedfatcher is a named export, not default export. import fatcher from 'fatcher' yields undefined.
fix
Use import { fatcher } from 'fatcher'.
affects: >=3.0.0
gotchaMiddleware `use` function must return response, otherwise next() chain breaks silently.
fix
Always await next() and return its result in functional middlewares.
affects: >=3.0.0
gotchaInternet Explorer is not supported; fatcher uses native fetch which is unavailable in IE.
fix
Use a polyfill or avoid IE.
affects: >=3.0.0
Errors
Common errors & fixes
TypeError: fatcher is not a function
Default import instead of named import: `import fatcher from 'fatcher'` yields undefined.
fix
Change to `import { fatcher } from 'fatcher'`.
ERR_REQUIRE_ESM
Using require() to import an ESM-only package.
fix
Use import() or set type: module and use import syntax.
TypeError: (intermediate value).use is not a function
Middleware object missing 'use' key or incorrectly defined.
fix
Ensure middleware is created with defineMiddleware or has { use: async (ctx, next) => {...} }.
Upgrade
Version history
3.0.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
fatcher — npm install fatcher · libregistry