Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-superfetch

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-superfetch - npm Package Compare versions

Comparing version 0.1.11 to 0.2.0

6

index.js

@@ -17,2 +17,3 @@ const fetch = require('node-fetch');

this.agent = options.agent || null;
this.noResultData = options.noResultData || false;
}

@@ -28,3 +29,4 @@

});
const raw = await response.buffer();
let raw = null;
if (!this.noResultData) raw = await response.buffer();
const headers = {};

@@ -40,5 +42,7 @@ for (const [header, value] of response.headers.entries()) headers[header] = value;

get text() {
if (this.noResultData) return null;
return raw.toString();
},
get body() {
if (this.noResultData) return null;
if (/application\/json/gi.test(headers['content-type'])) {

@@ -45,0 +49,0 @@ try {

16

package.json
{
"name": "node-superfetch",
"version": "0.1.11",
"version": "0.2.0",
"description": "A wrapper for node-fetch that makes it appear like superagent.",

@@ -34,11 +34,11 @@ "main": "index.js",

"dependencies": {
"form-data": "^3.0.0",
"node-fetch": "^2.6.0"
"form-data": "^4.0.0",
"node-fetch": "^2.6.1"
},
"devDependencies": {
"@types/node": "^14.14.22",
"eslint": "^7.19.0",
"eslint-config-amber": "^2.0.1",
"eslint-plugin-json": "^2.0.1",
"typescript": "^4.1.3"
"@types/node": "^14.14.37",
"eslint": "^7.23.0",
"eslint-config-amber": "^2.0.4",
"eslint-plugin-json": "^2.1.2",
"typescript": "^4.2.3"
},

@@ -45,0 +45,0 @@ "eslintConfig": {

@@ -29,1 +29,10 @@ # node-superfetch

`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 of `node-fetch`'s methods to parse the result data.
```js
const { headers, url } = await request.get('https://registry.npmjs.com/node-fetch', { noResultData: true });
console.log(url); // should log https://registry.npmjs.com/node-fetch
```
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc