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

@whatwg-node/node-fetch

Package Overview
Dependencies
Maintainers
1
Versions
509
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@whatwg-node/node-fetch - npm Package Compare versions

Comparing version 0.5.15 to 0.5.16-alpha-20240726002236-105dd434a11d1e455ea8f23481530c2ec4ca0aae

cjs/CompressionStream.js

4

cjs/fetchNodeHttp.js

@@ -54,2 +54,6 @@ "use strict";

break;
case 'x-deflate-raw':
case 'deflate-raw':
responseBody = nodeResponse.pipe((0, zlib_1.createInflateRaw)());
break;
case 'br':

@@ -56,0 +60,0 @@ responseBody = nodeResponse.pipe((0, zlib_1.createBrotliDecompress)());

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.URLSearchParams = exports.URL = exports.btoa = exports.TextDecoder = exports.TextEncoder = exports.Blob = exports.FormData = exports.File = exports.ReadableStream = exports.Response = exports.Request = exports.Body = exports.Headers = exports.fetch = void 0;
exports.DecompressionStream = exports.CompressionStream = exports.TransformStream = exports.WritableStream = exports.URLSearchParams = exports.URL = exports.btoa = exports.TextDecoder = exports.TextEncoder = exports.Blob = exports.FormData = exports.File = exports.ReadableStream = exports.Response = exports.Request = exports.Body = exports.Headers = exports.fetch = void 0;
var fetch_js_1 = require("./fetch.js");

@@ -30,1 +30,9 @@ Object.defineProperty(exports, "fetch", { enumerable: true, get: function () { return fetch_js_1.fetchPonyfill; } });

Object.defineProperty(exports, "URLSearchParams", { enumerable: true, get: function () { return URLSearchParams_js_1.PonyfillURLSearchParams; } });
var WritableStream_js_1 = require("./WritableStream.js");
Object.defineProperty(exports, "WritableStream", { enumerable: true, get: function () { return WritableStream_js_1.PonyfillWritableStream; } });
var TransformStream_js_1 = require("./TransformStream.js");
Object.defineProperty(exports, "TransformStream", { enumerable: true, get: function () { return TransformStream_js_1.PonyfillTransformStream; } });
var CompressionStream_js_1 = require("./CompressionStream.js");
Object.defineProperty(exports, "CompressionStream", { enumerable: true, get: function () { return CompressionStream_js_1.PonyfillCompressionStream; } });
var DecompressionStream_js_1 = require("./DecompressionStream.js");
Object.defineProperty(exports, "DecompressionStream", { enumerable: true, get: function () { return DecompressionStream_js_1.PonyfillDecompressionStream; } });

27

cjs/ReadableStream.js

@@ -158,9 +158,21 @@ "use strict";

async pipeTo(destination) {
const writer = destination.getWriter();
await writer.ready;
for await (const chunk of this.readable) {
await writer.write(chunk);
if (isPonyfillWritableStream(destination)) {
return new Promise((resolve, reject) => {
this.readable.pipe(destination.writable);
destination.writable.once('finish', resolve);
destination.writable.once('error', reject);
});
}
await writer.ready;
return writer.close();
else {
const writer = destination.getWriter();
try {
for await (const chunk of this) {
await writer.write(chunk);
}
await writer.close();
}
catch (err) {
await writer.abort(err);
}
}
}

@@ -176,1 +188,4 @@ pipeThrough({ writable, readable, }) {

exports.PonyfillReadableStream = PonyfillReadableStream;
function isPonyfillWritableStream(obj) {
return obj?.writable != null;
}
import { request as httpRequest } from 'http';
import { request as httpsRequest } from 'https';
import { PassThrough, Readable } from 'stream';
import { createBrotliDecompress, createGunzip, createInflate } from 'zlib';
import { createBrotliDecompress, createGunzip, createInflate, createInflateRaw } from 'zlib';
import { PonyfillAbortError } from './AbortError.js';

@@ -51,2 +51,6 @@ import { PonyfillRequest } from './Request.js';

break;
case 'x-deflate-raw':
case 'deflate-raw':
responseBody = nodeResponse.pipe(createInflateRaw());
break;
case 'br':

@@ -53,0 +57,0 @@ responseBody = nodeResponse.pipe(createBrotliDecompress());

@@ -13,1 +13,5 @@ export { fetchPonyfill as fetch } from './fetch.js';

export { PonyfillURLSearchParams as URLSearchParams } from './URLSearchParams.js';
export { PonyfillWritableStream as WritableStream } from './WritableStream.js';
export { PonyfillTransformStream as TransformStream } from './TransformStream.js';
export { PonyfillCompressionStream as CompressionStream } from './CompressionStream.js';
export { PonyfillDecompressionStream as DecompressionStream } from './DecompressionStream.js';

@@ -155,9 +155,21 @@ import { Readable } from 'stream';

async pipeTo(destination) {
const writer = destination.getWriter();
await writer.ready;
for await (const chunk of this.readable) {
await writer.write(chunk);
if (isPonyfillWritableStream(destination)) {
return new Promise((resolve, reject) => {
this.readable.pipe(destination.writable);
destination.writable.once('finish', resolve);
destination.writable.once('error', reject);
});
}
await writer.ready;
return writer.close();
else {
const writer = destination.getWriter();
try {
for await (const chunk of this) {
await writer.write(chunk);
}
await writer.close();
}
catch (err) {
await writer.abort(err);
}
}
}

@@ -172,1 +184,4 @@ pipeThrough({ writable, readable, }) {

}
function isPonyfillWritableStream(obj) {
return obj?.writable != null;
}
{
"name": "@whatwg-node/node-fetch",
"version": "0.5.15",
"version": "0.5.16-alpha-20240726002236-105dd434a11d1e455ea8f23481530c2ec4ca0aae",
"description": "Fetch API implementation for Node",

@@ -5,0 +5,0 @@ "sideEffects": false,

@@ -13,1 +13,5 @@ export { fetchPonyfill as fetch } from './fetch.js';

export { PonyfillURLSearchParams as URLSearchParams } from './URLSearchParams.js';
export { PonyfillWritableStream as WritableStream } from './WritableStream.js';
export { PonyfillTransformStream as TransformStream } from './TransformStream.js';
export { PonyfillCompressionStream as CompressionStream } from './CompressionStream.js';
export { PonyfillDecompressionStream as DecompressionStream } from './DecompressionStream.js';

Sorry, the diff of this file is not supported yet

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