wreq-js 2.1.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,4 @@
1
+ import { Readable } from 'node:stream';
1
2
  import { ReadableStream } from 'node:stream/web';
2
3
 
3
4
  /**
@@ -692,6 +693,7 @@ declare class Response {
692
693
  text(): Promise<string>;
693
694
  blob(): Promise<Blob>;
694
695
  formData(): Promise<FormData>;
696
+ readable(): Readable;
695
697
  clone(): Response;
696
698
  private assertBodyAvailable;
697
699
  private consumeBody;
package/dist/wreq-js.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { Readable } from 'node:stream';
1
2
  import { ReadableStream } from 'node:stream/web';
2
3
 
3
4
  /**
@@ -692,6 +693,7 @@ declare class Response {
692
693
  text(): Promise<string>;
693
694
  blob(): Promise<Blob>;
694
695
  formData(): Promise<FormData>;
696
+ readable(): Readable;
695
697
  clone(): Response;
696
698
  private assertBodyAvailable;
697
699
  private consumeBody;
package/dist/wreq-js.js CHANGED
@@ -2,6 +2,7 @@
2
2
  import { randomUUID } from "crypto";
3
3
  import { STATUS_CODES } from "http";
4
4
  import { createRequire } from "module";
5
+ import { Readable } from "stream";
5
6
  import { ReadableStream } from "stream/web";
6
7
 
7
8
  // src/types.ts
@@ -86,7 +87,7 @@ var bodyHandleFinalizer = typeof FinalizationRegistry === "function" ? new Final
86
87
  }) : void 0;
87
88
  var DEFAULT_BROWSER = "chrome_142";
88
89
  var DEFAULT_OS = "macos";
89
- var DEFAULT_REQUEST_TIMEOUT_MS = 3e4;
90
+ var DEFAULT_REQUEST_TIMEOUT_MS = 3e5;
90
91
  var SUPPORTED_OSES = ["windows", "macos", "linux", "android", "ios"];
91
92
  var UTF8_DECODER = new TextDecoder("utf-8");
92
93
  var ephemeralIdCounter = 0;
@@ -552,6 +553,15 @@ var Response = class _Response {
552
553
  );
553
554
  return response.formData();
554
555
  }
556
+ readable() {
557
+ this.assertBodyAvailable();
558
+ this.bodyUsed = true;
559
+ const stream = this.body;
560
+ if (stream === null) {
561
+ return Readable.from([]);
562
+ }
563
+ return Readable.fromWeb(stream);
564
+ }
555
565
  clone() {
556
566
  if (this.bodyUsed) {
557
567
  throw new TypeError("Cannot clone a Response whose body is already used");