@whatwg-node/node-fetch
Advanced tools
Comparing version 0.0.1-alpha-20221228110541-2aa6aea to 0.0.1-alpha-20221228115139-6b81aa1
@@ -34,3 +34,2 @@ /// <reference types="node" /> | ||
text(): Promise<string>; | ||
readable(): Readable | null; | ||
} |
48
index.js
@@ -98,13 +98,9 @@ 'use strict'; | ||
let reader; | ||
let started = false; | ||
this.readable = new stream.Readable({ | ||
construct(callback) { | ||
try { | ||
read() { | ||
if (!started) { | ||
started = true; | ||
reader = underlyingSource.getReader(); | ||
callback(null); | ||
} | ||
catch (err) { | ||
callback(err); | ||
} | ||
}, | ||
read() { | ||
reader | ||
@@ -130,19 +126,12 @@ .read() | ||
else { | ||
let started = false; | ||
this.readable = new stream.Readable({ | ||
async construct(callback) { | ||
var _a; | ||
try { | ||
const controller = createController(0, this); | ||
async read(desiredSize) { | ||
var _a, _b; | ||
const controller = createController(desiredSize, this); | ||
if (!started) { | ||
started = true; | ||
await ((_a = underlyingSource === null || underlyingSource === void 0 ? void 0 : underlyingSource.start) === null || _a === void 0 ? void 0 : _a.call(underlyingSource, controller)); | ||
controller._flush(); | ||
callback(null); | ||
} | ||
catch (err) { | ||
callback(err); | ||
} | ||
}, | ||
async read(desiredSize) { | ||
var _a; | ||
const controller = createController(desiredSize, this); | ||
await ((_a = underlyingSource === null || underlyingSource === void 0 ? void 0 : underlyingSource.pull) === null || _a === void 0 ? void 0 : _a.call(underlyingSource, controller)); | ||
await ((_b = underlyingSource === null || underlyingSource === void 0 ? void 0 : underlyingSource.pull) === null || _b === void 0 ? void 0 : _b.call(underlyingSource, controller)); | ||
controller._flush(); | ||
@@ -498,11 +487,2 @@ }, | ||
} | ||
readable() { | ||
if (this.bodyType === BodyInitType.Readable) { | ||
return this.bodyInit; | ||
} | ||
if (this._body != null) { | ||
return this._body.readable; | ||
} | ||
return null; | ||
} | ||
} | ||
@@ -741,3 +721,7 @@ | ||
const requestFn = getRequestFnForProtocol(protocol); | ||
const nodeReadable = fetchRequest.body; | ||
const nodeReadable = (fetchRequest.body != null | ||
? 'pipe' in fetchRequest.body | ||
? fetchRequest.body | ||
: stream.Readable.from(fetchRequest.body) | ||
: null); | ||
const nodeHeaders = getHeadersObj(fetchRequest.headers); | ||
@@ -744,0 +728,0 @@ const abortListener = function abortListener(event) { |
{ | ||
"name": "@whatwg-node/node-fetch", | ||
"version": "0.0.1-alpha-20221228110541-2aa6aea", | ||
"version": "0.0.1-alpha-20221228115139-6b81aa1", | ||
"description": "Fetch API implementation for Node", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
68406
1786