Socket
Socket
Sign inDemoInstall

node-superfetch

Package Overview
Dependencies
7
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    node-superfetch

A wrapper for Node.js' fetch API that makes it appear like superagent.


Version published
Weekly downloads
9.6K
decreased by-19.71%
Maintainers
1
Install size
321 kB
Created
Weekly downloads
 

Readme

Source

node-superfetch

Downloads Version

node-superfetch is a tiny little wrapper for Node.js' fetch API that makes it look like you are using superagent.

Basic Usage

const request = require('node-superfetch');

try {
	const { body } = await request.get('https://registry.npmjs.com/node-superfetch');
	console.log(body);
} catch (err) {
	console.error(err);
}

Usage is basically that of superagent or snekfetch, and implements the same HTTP methods, as well as functions like query (sets query parameters), set (sets headers), send (for adding POST data and such), attach (for sending FormData), redirects (for setting the allowed number of redirects), and agent (for setting the HTTP agent). end is also supported for callbacks.

Additionally, you can also use the noResultData option to get everything except the actual result data of the request. This is essentially doing the request without calling any methods to parse the result data.

const { headers, url } = await request.get('https://registry.npmjs.com/node-superfetch', { noResultData: true });
console.log(url); // should log https://registry.npmjs.com/node-superfetch

Keywords

FAQs

Last updated on 24 Mar 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc