Registry / devops / node-wget-fetch

node-wget-fetch

JSON →
library1.1.3jsnpmunverified

Ultra simple async retrieval of resources or remote files over HTTP/HTTPS, acting as a CLI tool and convenience wrapper around node-fetch with built-in retry. Version 1.1.3 targets Node.js >=12.0.0. It provides a main `fetching` function with response type options (download, json, text, etc.) and convenience methods for GET, HEAD, OPTIONS, POST, PUT, PATCH, DELETE. Differentiates itself from plain node-fetch by adding file download (`wget`), retry logic, and simpler response-type handling. Active development, weekly releases.

npm install node-wget-fetch
INSTALL
IMPORT
SIG · NODE-WGET-FETCH
N
node-wget-fetch
devopsjavascriptv1.1.3
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.

fetching
import fetching from 'node-wget-fetch'
import { fetching } from 'node-wget-fetch'
Default export is the main fetching function.
wget
import { wget } from 'node-wget-fetch'
Named export for download-to-file convenience.
get
import { get } from 'node-wget-fetch'
const get = require('node-wget-fetch').get
ESM-only; no CommonJS require for named exports.
Post
import { post } from 'node-wget-fetch'
import { Post } from 'node-wget-fetch'
Case-sensitive: lowercase 'post'.

Shows default export usage for download and JSON retrieval, including retry configuration.

import fetching from 'node-wget-fetch'; const url = 'https://httpbin.org/json'; // Download file to current directory fetching(url) .then(info => console.log('Downloaded:', info)) .catch(err => console.error(err)); // Get JSON response fetching(url, 'json') .then(data => console.log('JSON:', data)) .catch(err => console.error(err)); // With retry options fetching(url, { retry: { retries: 3 } }) .then(info => console.log('Success after retries')) .catch(err => console.error(err));
Debug
Known issues
breakingPackage is ESM-only since v1.0.0. CommonJS require() will not work for named exports.
fix
Use ES module `import` syntax or use default export with `const fetching = require('node-wget-fetch');` for main function only.
affects: >=1.0.0
deprecatedThe `wget` function is deprecated and will be removed in future versions.
fix
Use `fetching(url, 'download')` instead.
affects: >=1.1.0
gotchaResponse type 'stream' returns a Node.js readableStream, but the package does not handle stream errors automatically.
fix
Always attach error listener: `stream.on('error', ...)`.
affects: >=1.0.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module ... from ... not supported.
Trying to require() a named export from an ESM-only package.
fix
Use `import` statement or change to default import: `const fetching = require('node-wget-fetch');`
TypeError: fetching is not a function
Using named import on default export: `import { fetching } from '...'`
fix
Use default import: `import fetching from 'node-wget-fetch'`
Upgrade
Version history
1.1.3latest on npm
Audit
Dependencies
node-fetchrequiredCore HTTP client; this package is a wrapper.
Agent activity
9 hits · last 30 days
node
8
Amazon
1
Resources
node-wget-fetch — npm install node-wget-fetch · libregistry