Registry / devops / qiao-fetch

qiao-fetch

JSON →
library5.2.4jsnpmunverified

qiao-fetch is a lightweight HTTP client for Node.js that wraps the built-in `http` and `https` modules, providing a simple fetch-like API. Current stable version is 5.2.4, released infrequently as a minor package. It focuses on simplicity and zero dependencies, making it suitable for basic HTTP requests in Node.js environments. Unlike axios or node-fetch, qiao-fetch is minimal and does not support streams, timeout configuration, or advanced features like interceptors.

npm install qiao-fetch
INSTALL
IMPORT
SIG · QIAO-FETCH
Q
qiao-fetch
devopsjavascriptv5.2.4
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.

default (qiao-fetch)
import fetch from 'qiao-fetch';
const qiaoFetch = require('qiao-fetch');
Package is ESM-only since v5. Use ES module imports.
fetch function (named)
import { fetch } from 'qiao-fetch';
Named export also available (same default and named export).
type Response
import type { Response } from 'qiao-fetch';
import { Response } from 'qiao-fetch';
Response type is not exported as value; only type import works. Use `import type` to avoid runtime errors.

Shows basic GET request using ESM import, handling response status and text body, with error handling.

import fetch from 'qiao-fetch'; async function main() { try { const res = await fetch('https://api.example.com/data'); const body = await res.text(); console.log('Status:', res.status); console.log('Body:', body); } catch (err) { console.error('Fetch failed:', err); } } main();
Debug
Known issues
breakingVersion 5.x is ESM-only. CommonJS require() will fail with ERR_REQUIRE_ESM.
fix
Use ES module imports or upgrade to Node.js 16+ with type: module in package.json.
affects: >=5.0.0
deprecatedVersion 4.x and below used CommonJS and are deprecated.
fix
Upgrade to v5 and switch to ESM imports.
affects: <5.0.0
gotchaNo timeout support: requests can hang indefinitely if server doesn't respond.
fix
Implement your own timeout with AbortController or use a different library like node-fetch.
affects: all
gotchaDoes not support response streaming. Body is fully buffered.
fix
If streaming is needed, consider using got or undici instead.
affects: all
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module
CommonJS require() used on ESM-only package v5+.
fix
Use import fetch from 'qiao-fetch' and ensure type: module in package.json.
TypeError: fetch is not a function
Wrong import style (e.g., default vs named) or CommonJS misuse.
fix
Use `import fetch from 'qiao-fetch'` or `import { fetch } from 'qiao-fetch'`.
UnhandledPromiseRejectionWarning: TypeError: Only absolute URLs are supported
Passed a relative URL instead of absolute URL.
fix
Provide fully qualified URL starting with http:// or https://.
Upgrade
Version history
5.2.4latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
qiao-fetch — npm install qiao-fetch · libregistry