JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5092
  • Score
    100M100P100Q131281F
  • License ISC

A wrapper for node-fetch that makes it appear like superagent.

Package Exports

  • node-superfetch

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (node-superfetch) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

node-superfetch

Downloads Version Travis

node-superfetch is a tiny little wrapper for node-fetch that makes it look like you are using superagent. It arose after I decided I disliked the node-fetch API and loved the superagent API, but node-fetch is smaller than superagent and snekfetch is buggy (and this probably is too).

Basic Usage

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

try {
    const { body } = await request.get('https://registry.npmjs.com/node-fetch');
    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), and redirects (for setting the allowed number of redirects). end is also supported for callbacks. It does not implement anything related to formdata (but you can probably attach it like you would with node-fetch).

Disclaimer for Contributors

This package is really made for my own personal use, I will accept PRs to it but I won't implement feature x just because the public wants it or superagent has it. I also want to keep the codebase relatively dependency-free aside from node-fetch, so please refrain from adding useless additional modules. Thank you.