Registry / devops / node-superfetch

node-superfetch

JSON →
library0.3.5jsnpmunverified

node-superfetch is a tiny wrapper around Node.js's native fetch API (available since Node 18) that provides a superagent-like fluent interface. Version 0.3.5 is the latest stable release, with sporadic updates. It supports HTTP methods (get, post, put, patch, delete, head), query parameters, headers, send/attach for bodies, redirect limits, agent configuration, and optional noResultData mode. Unlike node-fetch or bare fetch, it offers a chainable API and response parsing (JSON, text, buffer, stream). It ships TypeScript types and is ESM-compatible via import or require (CJS).

npm install node-superfetch
INSTALL
IMPORT
SIG · NODE-SUPERFETCH
N
node-superfetch
devopsjavascriptv0.3.5
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.

request
import request from 'node-superfetch'
const request = require('node-superfetch').default
Default export (ESM) or require returns the main function directly.
Request
import type { Request } from 'node-superfetch'
import { Request } from 'node-superfetch'
Request is a class used for type annotations; not exported as value.
Response
import type { Response } from 'node-superfetch'
import { Response } from 'node-superfetch'
Response is a type used for the returned result.
request.get
const { body } = await request.get(url)
request.get(url).then(res => res.json())
The library automatically parses JSON responses; access body directly.

Shows a basic GET request with automatic JSON parsing and error handling.

import request from 'node-superfetch'; async function main() { try { const { body } = await request.get('https://api.github.com/repos/lilyissillyyy/node-superfetch'); console.log('Repository name:', body.full_name); } catch (err) { console.error('Request failed:', err); } } main();
Debug
Known issues
deprecatedThe .end() callback method is deprecated; use async/await or .then() instead.
fix
Replace .end(callback) with await request.get(...) or .then().
affects: >=0.3.0
gotchaThe 'body' property is always an object (parsed JSON) by default. For non-JSON responses, use { text } or { buffer }.
fix
Use { text } for plain text, { buffer } for binary data.
affects: >=0.3.0
breakingDropped support for Node <18; native fetch is required.
fix
Upgrade Node.js to version 18 or later.
affects: >=0.3.5
gotchaFormData attach() requires the 'formdata-node' package; ensure it is installed.
fix
Run 'npm install formdata-node' if you use attach().
affects: >=0.3.0
Errors
Common errors & fixes
Cannot find module 'node-superfetch'
Package not installed or missing from package.json
fix
Run 'npm install node-superfetch'
TypeError: request.get is not a function
Importing incorrectly (e.g., using named import instead of default)
fix
Use 'import request from \"node-superfetch\"' (default import)
TypeError: Cannot destructure property 'body' of ... as it is undefined.
Trying to access body before awaiting the promise; need to await the full request.
fix
Use 'const { body } = await request.get(url)'
Upgrade
Version history
0.3.5latest on npm
Audit
Dependencies
node-fetchrequiredCore HTTP library; node-superfetch wraps it (even though Node 18+ has native fetch, the package depends on node-fetch for older Node versions or consistency).
formdata-noderequiredUsed internally for FormData support via attach().
Agent activity
7 hits · last 30 days
node
6
Amazon
1
Resources
node-superfetch — npm install node-superfetch · libregistry