rezo 1.0.28 → 1.0.30
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.
- package/dist/adapters/entries/curl.d.ts +3 -4
- package/dist/adapters/entries/fetch.d.ts +3 -4
- package/dist/adapters/entries/http.d.ts +3 -4
- package/dist/adapters/entries/http2.d.ts +3 -4
- package/dist/adapters/entries/react-native.d.ts +3 -4
- package/dist/adapters/entries/xhr.d.ts +3 -4
- package/dist/adapters/fetch.cjs +0 -1
- package/dist/adapters/fetch.js +0 -1
- package/dist/adapters/index.cjs +6 -6
- package/dist/cache/index.cjs +13 -13
- package/dist/crawler.d.ts +3 -4
- package/dist/entries/crawler.cjs +5 -5
- package/dist/index.cjs +24 -24
- package/dist/index.d.ts +3 -4
- package/dist/platform/browser.d.ts +3 -4
- package/dist/platform/bun.d.ts +3 -4
- package/dist/platform/deno.d.ts +3 -4
- package/dist/platform/node.d.ts +3 -4
- package/dist/platform/react-native.d.ts +3 -4
- package/dist/platform/worker.d.ts +3 -4
- package/dist/plugin/index.cjs +36 -36
- package/dist/proxy/index.cjs +5 -80
- package/dist/proxy/index.js +2 -77
- package/dist/proxy/parse.cjs +79 -0
- package/dist/proxy/parse.js +77 -0
- package/dist/queue/index.cjs +8 -8
- package/dist/utils/form-data.cjs +7 -5
- package/dist/utils/form-data.js +7 -5
- package/dist/utils/headers.cjs +2 -4
- package/dist/utils/headers.js +2 -4
- package/dist/utils/http-config.cjs +13 -6
- package/dist/utils/http-config.js +13 -6
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ import { EventEmitter } from 'node:events';
|
|
|
4
4
|
import { Agent as HttpAgent, OutgoingHttpHeaders } from 'node:http';
|
|
5
5
|
import { Agent as HttpsAgent } from 'node:https';
|
|
6
6
|
import { Socket } from 'node:net';
|
|
7
|
-
import { Readable, Writable, WritableOptions } from 'node:stream';
|
|
7
|
+
import { Readable, Readable as ReadableType, Writable, WritableOptions } from 'node:stream';
|
|
8
8
|
import { SecureContext, TLSSocket } from 'node:tls';
|
|
9
9
|
import { Cookie as TouchCookie, CookieJar as TouchCookieJar, CreateCookieOptions } from 'tough-cookie';
|
|
10
10
|
|
|
@@ -140,7 +140,6 @@ export declare class RezoHeaders extends Headers {
|
|
|
140
140
|
string,
|
|
141
141
|
string | string[]
|
|
142
142
|
]>;
|
|
143
|
-
[util.inspect.custom](_depth: number, options: util.InspectOptionsStylized): string;
|
|
144
143
|
get [Symbol.toStringTag](): string;
|
|
145
144
|
}
|
|
146
145
|
export interface SerializedCookie {
|
|
@@ -314,8 +313,8 @@ export interface ReadableOptions {
|
|
|
314
313
|
highWaterMark?: number;
|
|
315
314
|
encoding?: string;
|
|
316
315
|
objectMode?: boolean;
|
|
317
|
-
read?(this:
|
|
318
|
-
destroy?(this:
|
|
316
|
+
read?(this: ReadableType, size: number): void;
|
|
317
|
+
destroy?(this: ReadableType, error: Error | null, callback: (error: Error | null) => void): void;
|
|
319
318
|
autoDestroy?: boolean;
|
|
320
319
|
}
|
|
321
320
|
export interface Options extends ReadableOptions {
|
|
@@ -4,7 +4,7 @@ import { EventEmitter } from 'node:events';
|
|
|
4
4
|
import { Agent as HttpAgent, OutgoingHttpHeaders } from 'node:http';
|
|
5
5
|
import { Agent as HttpsAgent } from 'node:https';
|
|
6
6
|
import { Socket } from 'node:net';
|
|
7
|
-
import { Readable, Writable, WritableOptions } from 'node:stream';
|
|
7
|
+
import { Readable, Readable as ReadableType, Writable, WritableOptions } from 'node:stream';
|
|
8
8
|
import { SecureContext, TLSSocket } from 'node:tls';
|
|
9
9
|
import { Cookie as TouchCookie, CookieJar as TouchCookieJar, CreateCookieOptions } from 'tough-cookie';
|
|
10
10
|
|
|
@@ -140,7 +140,6 @@ export declare class RezoHeaders extends Headers {
|
|
|
140
140
|
string,
|
|
141
141
|
string | string[]
|
|
142
142
|
]>;
|
|
143
|
-
[util.inspect.custom](_depth: number, options: util.InspectOptionsStylized): string;
|
|
144
143
|
get [Symbol.toStringTag](): string;
|
|
145
144
|
}
|
|
146
145
|
export interface SerializedCookie {
|
|
@@ -314,8 +313,8 @@ export interface ReadableOptions {
|
|
|
314
313
|
highWaterMark?: number;
|
|
315
314
|
encoding?: string;
|
|
316
315
|
objectMode?: boolean;
|
|
317
|
-
read?(this:
|
|
318
|
-
destroy?(this:
|
|
316
|
+
read?(this: ReadableType, size: number): void;
|
|
317
|
+
destroy?(this: ReadableType, error: Error | null, callback: (error: Error | null) => void): void;
|
|
319
318
|
autoDestroy?: boolean;
|
|
320
319
|
}
|
|
321
320
|
export interface Options extends ReadableOptions {
|
|
@@ -4,7 +4,7 @@ import { EventEmitter } from 'node:events';
|
|
|
4
4
|
import { Agent as HttpAgent, OutgoingHttpHeaders } from 'node:http';
|
|
5
5
|
import { Agent as HttpsAgent } from 'node:https';
|
|
6
6
|
import { Socket } from 'node:net';
|
|
7
|
-
import { Readable, Writable, WritableOptions } from 'node:stream';
|
|
7
|
+
import { Readable, Readable as ReadableType, Writable, WritableOptions } from 'node:stream';
|
|
8
8
|
import { SecureContext, TLSSocket } from 'node:tls';
|
|
9
9
|
import { Cookie as TouchCookie, CookieJar as TouchCookieJar, CreateCookieOptions } from 'tough-cookie';
|
|
10
10
|
|
|
@@ -140,7 +140,6 @@ export declare class RezoHeaders extends Headers {
|
|
|
140
140
|
string,
|
|
141
141
|
string | string[]
|
|
142
142
|
]>;
|
|
143
|
-
[util.inspect.custom](_depth: number, options: util.InspectOptionsStylized): string;
|
|
144
143
|
get [Symbol.toStringTag](): string;
|
|
145
144
|
}
|
|
146
145
|
export interface SerializedCookie {
|
|
@@ -314,8 +313,8 @@ export interface ReadableOptions {
|
|
|
314
313
|
highWaterMark?: number;
|
|
315
314
|
encoding?: string;
|
|
316
315
|
objectMode?: boolean;
|
|
317
|
-
read?(this:
|
|
318
|
-
destroy?(this:
|
|
316
|
+
read?(this: ReadableType, size: number): void;
|
|
317
|
+
destroy?(this: ReadableType, error: Error | null, callback: (error: Error | null) => void): void;
|
|
319
318
|
autoDestroy?: boolean;
|
|
320
319
|
}
|
|
321
320
|
export interface Options extends ReadableOptions {
|
|
@@ -4,7 +4,7 @@ import { EventEmitter } from 'node:events';
|
|
|
4
4
|
import { Agent as HttpAgent, OutgoingHttpHeaders } from 'node:http';
|
|
5
5
|
import { Agent as HttpsAgent } from 'node:https';
|
|
6
6
|
import { Socket } from 'node:net';
|
|
7
|
-
import { Readable, Writable, WritableOptions } from 'node:stream';
|
|
7
|
+
import { Readable, Readable as ReadableType, Writable, WritableOptions } from 'node:stream';
|
|
8
8
|
import { SecureContext, TLSSocket } from 'node:tls';
|
|
9
9
|
import { Cookie as TouchCookie, CookieJar as TouchCookieJar, CreateCookieOptions } from 'tough-cookie';
|
|
10
10
|
|
|
@@ -140,7 +140,6 @@ export declare class RezoHeaders extends Headers {
|
|
|
140
140
|
string,
|
|
141
141
|
string | string[]
|
|
142
142
|
]>;
|
|
143
|
-
[util.inspect.custom](_depth: number, options: util.InspectOptionsStylized): string;
|
|
144
143
|
get [Symbol.toStringTag](): string;
|
|
145
144
|
}
|
|
146
145
|
export interface SerializedCookie {
|
|
@@ -314,8 +313,8 @@ export interface ReadableOptions {
|
|
|
314
313
|
highWaterMark?: number;
|
|
315
314
|
encoding?: string;
|
|
316
315
|
objectMode?: boolean;
|
|
317
|
-
read?(this:
|
|
318
|
-
destroy?(this:
|
|
316
|
+
read?(this: ReadableType, size: number): void;
|
|
317
|
+
destroy?(this: ReadableType, error: Error | null, callback: (error: Error | null) => void): void;
|
|
319
318
|
autoDestroy?: boolean;
|
|
320
319
|
}
|
|
321
320
|
export interface Options extends ReadableOptions {
|
|
@@ -4,7 +4,7 @@ import { EventEmitter } from 'node:events';
|
|
|
4
4
|
import { Agent as HttpAgent, OutgoingHttpHeaders } from 'node:http';
|
|
5
5
|
import { Agent as HttpsAgent } from 'node:https';
|
|
6
6
|
import { Socket } from 'node:net';
|
|
7
|
-
import { Readable, Writable, WritableOptions } from 'node:stream';
|
|
7
|
+
import { Readable, Readable as ReadableType, Writable, WritableOptions } from 'node:stream';
|
|
8
8
|
import { SecureContext, TLSSocket } from 'node:tls';
|
|
9
9
|
import { Cookie as TouchCookie, CookieJar as TouchCookieJar, CreateCookieOptions } from 'tough-cookie';
|
|
10
10
|
|
|
@@ -140,7 +140,6 @@ export declare class RezoHeaders extends Headers {
|
|
|
140
140
|
string,
|
|
141
141
|
string | string[]
|
|
142
142
|
]>;
|
|
143
|
-
[util.inspect.custom](_depth: number, options: util.InspectOptionsStylized): string;
|
|
144
143
|
get [Symbol.toStringTag](): string;
|
|
145
144
|
}
|
|
146
145
|
export interface SerializedCookie {
|
|
@@ -314,8 +313,8 @@ export interface ReadableOptions {
|
|
|
314
313
|
highWaterMark?: number;
|
|
315
314
|
encoding?: string;
|
|
316
315
|
objectMode?: boolean;
|
|
317
|
-
read?(this:
|
|
318
|
-
destroy?(this:
|
|
316
|
+
read?(this: ReadableType, size: number): void;
|
|
317
|
+
destroy?(this: ReadableType, error: Error | null, callback: (error: Error | null) => void): void;
|
|
319
318
|
autoDestroy?: boolean;
|
|
320
319
|
}
|
|
321
320
|
export interface Options extends ReadableOptions {
|
|
@@ -4,7 +4,7 @@ import { EventEmitter } from 'node:events';
|
|
|
4
4
|
import { Agent as HttpAgent, OutgoingHttpHeaders } from 'node:http';
|
|
5
5
|
import { Agent as HttpsAgent } from 'node:https';
|
|
6
6
|
import { Socket } from 'node:net';
|
|
7
|
-
import { Readable, Writable, WritableOptions } from 'node:stream';
|
|
7
|
+
import { Readable, Readable as ReadableType, Writable, WritableOptions } from 'node:stream';
|
|
8
8
|
import { SecureContext, TLSSocket } from 'node:tls';
|
|
9
9
|
import { Cookie as TouchCookie, CookieJar as TouchCookieJar, CreateCookieOptions } from 'tough-cookie';
|
|
10
10
|
|
|
@@ -140,7 +140,6 @@ export declare class RezoHeaders extends Headers {
|
|
|
140
140
|
string,
|
|
141
141
|
string | string[]
|
|
142
142
|
]>;
|
|
143
|
-
[util.inspect.custom](_depth: number, options: util.InspectOptionsStylized): string;
|
|
144
143
|
get [Symbol.toStringTag](): string;
|
|
145
144
|
}
|
|
146
145
|
export interface SerializedCookie {
|
|
@@ -314,8 +313,8 @@ export interface ReadableOptions {
|
|
|
314
313
|
highWaterMark?: number;
|
|
315
314
|
encoding?: string;
|
|
316
315
|
objectMode?: boolean;
|
|
317
|
-
read?(this:
|
|
318
|
-
destroy?(this:
|
|
316
|
+
read?(this: ReadableType, size: number): void;
|
|
317
|
+
destroy?(this: ReadableType, error: Error | null, callback: (error: Error | null) => void): void;
|
|
319
318
|
autoDestroy?: boolean;
|
|
320
319
|
}
|
|
321
320
|
export interface Options extends ReadableOptions {
|
package/dist/adapters/fetch.cjs
CHANGED
package/dist/adapters/fetch.js
CHANGED
package/dist/adapters/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const
|
|
2
|
-
exports.detectRuntime =
|
|
3
|
-
exports.getAdapterCapabilities =
|
|
4
|
-
exports.buildAdapterContext =
|
|
5
|
-
exports.getAvailableAdapters =
|
|
6
|
-
exports.selectAdapter =
|
|
1
|
+
const _mod_jvt2y3 = require('./picker.cjs');
|
|
2
|
+
exports.detectRuntime = _mod_jvt2y3.detectRuntime;
|
|
3
|
+
exports.getAdapterCapabilities = _mod_jvt2y3.getAdapterCapabilities;
|
|
4
|
+
exports.buildAdapterContext = _mod_jvt2y3.buildAdapterContext;
|
|
5
|
+
exports.getAvailableAdapters = _mod_jvt2y3.getAvailableAdapters;
|
|
6
|
+
exports.selectAdapter = _mod_jvt2y3.selectAdapter;;
|
package/dist/cache/index.cjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
const
|
|
2
|
-
exports.LRUCache =
|
|
3
|
-
const
|
|
4
|
-
exports.DNSCache =
|
|
5
|
-
exports.getGlobalDNSCache =
|
|
6
|
-
exports.resetGlobalDNSCache =
|
|
7
|
-
const
|
|
8
|
-
exports.ResponseCache =
|
|
9
|
-
exports.normalizeResponseCacheConfig =
|
|
10
|
-
const
|
|
11
|
-
exports.FileCacher =
|
|
12
|
-
const
|
|
13
|
-
exports.UrlStore =
|
|
1
|
+
const _mod_rmp3wu = require('./lru-cache.cjs');
|
|
2
|
+
exports.LRUCache = _mod_rmp3wu.LRUCache;;
|
|
3
|
+
const _mod_r7c9g6 = require('./dns-cache.cjs');
|
|
4
|
+
exports.DNSCache = _mod_r7c9g6.DNSCache;
|
|
5
|
+
exports.getGlobalDNSCache = _mod_r7c9g6.getGlobalDNSCache;
|
|
6
|
+
exports.resetGlobalDNSCache = _mod_r7c9g6.resetGlobalDNSCache;;
|
|
7
|
+
const _mod_hc21ei = require('./response-cache.cjs');
|
|
8
|
+
exports.ResponseCache = _mod_hc21ei.ResponseCache;
|
|
9
|
+
exports.normalizeResponseCacheConfig = _mod_hc21ei.normalizeResponseCacheConfig;;
|
|
10
|
+
const _mod_e129fq = require('./file-cacher.cjs');
|
|
11
|
+
exports.FileCacher = _mod_e129fq.FileCacher;;
|
|
12
|
+
const _mod_wyslbn = require('./url-store.cjs');
|
|
13
|
+
exports.UrlStore = _mod_wyslbn.UrlStore;;
|
package/dist/crawler.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { EventEmitter } from 'node:events';
|
|
|
4
4
|
import { Agent as HttpAgent, OutgoingHttpHeaders } from 'node:http';
|
|
5
5
|
import { Agent as HttpsAgent } from 'node:https';
|
|
6
6
|
import { Socket } from 'node:net';
|
|
7
|
-
import { Readable, Writable, WritableOptions } from 'node:stream';
|
|
7
|
+
import { Readable, Readable as ReadableType, Writable, WritableOptions } from 'node:stream';
|
|
8
8
|
import { SecureContext, TLSSocket } from 'node:tls';
|
|
9
9
|
import { Cookie as TouchCookie, CookieJar as TouchCookieJar, CreateCookieOptions } from 'tough-cookie';
|
|
10
10
|
|
|
@@ -363,7 +363,6 @@ declare class RezoHeaders extends Headers {
|
|
|
363
363
|
string,
|
|
364
364
|
string | string[]
|
|
365
365
|
]>;
|
|
366
|
-
[util.inspect.custom](_depth: number, options: util.InspectOptionsStylized): string;
|
|
367
366
|
get [Symbol.toStringTag](): string;
|
|
368
367
|
}
|
|
369
368
|
export interface SerializedCookie {
|
|
@@ -537,8 +536,8 @@ export interface ReadableOptions {
|
|
|
537
536
|
highWaterMark?: number;
|
|
538
537
|
encoding?: string;
|
|
539
538
|
objectMode?: boolean;
|
|
540
|
-
read?(this:
|
|
541
|
-
destroy?(this:
|
|
539
|
+
read?(this: ReadableType, size: number): void;
|
|
540
|
+
destroy?(this: ReadableType, error: Error | null, callback: (error: Error | null) => void): void;
|
|
542
541
|
autoDestroy?: boolean;
|
|
543
542
|
}
|
|
544
543
|
export interface Options extends ReadableOptions {
|
package/dist/entries/crawler.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const
|
|
2
|
-
exports.Crawler =
|
|
3
|
-
const
|
|
4
|
-
exports.CrawlerOptions =
|
|
5
|
-
exports.Domain =
|
|
1
|
+
const _mod_rmr6y9 = require('../plugin/crawler.cjs');
|
|
2
|
+
exports.Crawler = _mod_rmr6y9.Crawler;;
|
|
3
|
+
const _mod_b09fov = require('../plugin/crawler-options.cjs');
|
|
4
|
+
exports.CrawlerOptions = _mod_b09fov.CrawlerOptions;
|
|
5
|
+
exports.Domain = _mod_b09fov.Domain;;
|
package/dist/index.cjs
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
const
|
|
2
|
-
exports.Rezo =
|
|
3
|
-
exports.createRezoInstance =
|
|
4
|
-
exports.createDefaultInstance =
|
|
5
|
-
const
|
|
6
|
-
exports.RezoError =
|
|
7
|
-
exports.RezoErrorCode =
|
|
8
|
-
const
|
|
9
|
-
exports.RezoHeaders =
|
|
10
|
-
const
|
|
11
|
-
exports.RezoFormData =
|
|
12
|
-
const
|
|
13
|
-
exports.RezoCookieJar =
|
|
14
|
-
exports.Cookie =
|
|
15
|
-
const
|
|
16
|
-
exports.createDefaultHooks =
|
|
17
|
-
exports.mergeHooks =
|
|
18
|
-
const
|
|
19
|
-
exports.ProxyManager =
|
|
20
|
-
const
|
|
21
|
-
exports.RezoQueue =
|
|
22
|
-
exports.HttpQueue =
|
|
23
|
-
exports.Priority =
|
|
24
|
-
exports.HttpMethodPriority =
|
|
1
|
+
const _mod_a2uu3a = require('./core/rezo.cjs');
|
|
2
|
+
exports.Rezo = _mod_a2uu3a.Rezo;
|
|
3
|
+
exports.createRezoInstance = _mod_a2uu3a.createRezoInstance;
|
|
4
|
+
exports.createDefaultInstance = _mod_a2uu3a.createDefaultInstance;;
|
|
5
|
+
const _mod_tu09se = require('./errors/rezo-error.cjs');
|
|
6
|
+
exports.RezoError = _mod_tu09se.RezoError;
|
|
7
|
+
exports.RezoErrorCode = _mod_tu09se.RezoErrorCode;;
|
|
8
|
+
const _mod_y3keed = require('./utils/headers.cjs');
|
|
9
|
+
exports.RezoHeaders = _mod_y3keed.RezoHeaders;;
|
|
10
|
+
const _mod_goh1u6 = require('./utils/form-data.cjs');
|
|
11
|
+
exports.RezoFormData = _mod_goh1u6.RezoFormData;;
|
|
12
|
+
const _mod_ku4hh5 = require('./utils/cookies.cjs');
|
|
13
|
+
exports.RezoCookieJar = _mod_ku4hh5.RezoCookieJar;
|
|
14
|
+
exports.Cookie = _mod_ku4hh5.Cookie;;
|
|
15
|
+
const _mod_f06gp2 = require('./core/hooks.cjs');
|
|
16
|
+
exports.createDefaultHooks = _mod_f06gp2.createDefaultHooks;
|
|
17
|
+
exports.mergeHooks = _mod_f06gp2.mergeHooks;;
|
|
18
|
+
const _mod_tx60cr = require('./proxy/manager.cjs');
|
|
19
|
+
exports.ProxyManager = _mod_tx60cr.ProxyManager;;
|
|
20
|
+
const _mod_wz29v4 = require('./queue/index.cjs');
|
|
21
|
+
exports.RezoQueue = _mod_wz29v4.RezoQueue;
|
|
22
|
+
exports.HttpQueue = _mod_wz29v4.HttpQueue;
|
|
23
|
+
exports.Priority = _mod_wz29v4.Priority;
|
|
24
|
+
exports.HttpMethodPriority = _mod_wz29v4.HttpMethodPriority;;
|
|
25
25
|
const { RezoError } = require('./errors/rezo-error.cjs');
|
|
26
26
|
const isRezoError = exports.isRezoError = RezoError.isRezoError;
|
|
27
27
|
const Cancel = exports.Cancel = RezoError;
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { EventEmitter } from 'node:events';
|
|
|
4
4
|
import { Agent as HttpAgent, OutgoingHttpHeaders } from 'node:http';
|
|
5
5
|
import { Agent as HttpsAgent } from 'node:https';
|
|
6
6
|
import { Socket } from 'node:net';
|
|
7
|
-
import { Readable, Writable, WritableOptions } from 'node:stream';
|
|
7
|
+
import { Readable, Readable as ReadableType, Writable, WritableOptions } from 'node:stream';
|
|
8
8
|
import { SecureContext, TLSSocket } from 'node:tls';
|
|
9
9
|
import { Cookie as TouchCookie, CookieJar as TouchCookieJar, CreateCookieOptions } from 'tough-cookie';
|
|
10
10
|
|
|
@@ -140,7 +140,6 @@ export declare class RezoHeaders extends Headers {
|
|
|
140
140
|
string,
|
|
141
141
|
string | string[]
|
|
142
142
|
]>;
|
|
143
|
-
[util.inspect.custom](_depth: number, options: util.InspectOptionsStylized): string;
|
|
144
143
|
get [Symbol.toStringTag](): string;
|
|
145
144
|
}
|
|
146
145
|
export interface SerializedCookie {
|
|
@@ -314,8 +313,8 @@ export interface ReadableOptions {
|
|
|
314
313
|
highWaterMark?: number;
|
|
315
314
|
encoding?: string;
|
|
316
315
|
objectMode?: boolean;
|
|
317
|
-
read?(this:
|
|
318
|
-
destroy?(this:
|
|
316
|
+
read?(this: ReadableType, size: number): void;
|
|
317
|
+
destroy?(this: ReadableType, error: Error | null, callback: (error: Error | null) => void): void;
|
|
319
318
|
autoDestroy?: boolean;
|
|
320
319
|
}
|
|
321
320
|
export interface Options extends ReadableOptions {
|
|
@@ -4,7 +4,7 @@ import { EventEmitter } from 'node:events';
|
|
|
4
4
|
import { Agent as HttpAgent, OutgoingHttpHeaders } from 'node:http';
|
|
5
5
|
import { Agent as HttpsAgent } from 'node:https';
|
|
6
6
|
import { Socket } from 'node:net';
|
|
7
|
-
import { Readable, Writable, WritableOptions } from 'node:stream';
|
|
7
|
+
import { Readable, Readable as ReadableType, Writable, WritableOptions } from 'node:stream';
|
|
8
8
|
import { SecureContext, TLSSocket } from 'node:tls';
|
|
9
9
|
import { Cookie as TouchCookie, CookieJar as TouchCookieJar, CreateCookieOptions } from 'tough-cookie';
|
|
10
10
|
|
|
@@ -140,7 +140,6 @@ export declare class RezoHeaders extends Headers {
|
|
|
140
140
|
string,
|
|
141
141
|
string | string[]
|
|
142
142
|
]>;
|
|
143
|
-
[util.inspect.custom](_depth: number, options: util.InspectOptionsStylized): string;
|
|
144
143
|
get [Symbol.toStringTag](): string;
|
|
145
144
|
}
|
|
146
145
|
export interface SerializedCookie {
|
|
@@ -314,8 +313,8 @@ export interface ReadableOptions {
|
|
|
314
313
|
highWaterMark?: number;
|
|
315
314
|
encoding?: string;
|
|
316
315
|
objectMode?: boolean;
|
|
317
|
-
read?(this:
|
|
318
|
-
destroy?(this:
|
|
316
|
+
read?(this: ReadableType, size: number): void;
|
|
317
|
+
destroy?(this: ReadableType, error: Error | null, callback: (error: Error | null) => void): void;
|
|
319
318
|
autoDestroy?: boolean;
|
|
320
319
|
}
|
|
321
320
|
export interface Options extends ReadableOptions {
|
package/dist/platform/bun.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { EventEmitter } from 'node:events';
|
|
|
4
4
|
import { Agent as HttpAgent, OutgoingHttpHeaders } from 'node:http';
|
|
5
5
|
import { Agent as HttpsAgent } from 'node:https';
|
|
6
6
|
import { Socket } from 'node:net';
|
|
7
|
-
import { Readable, Writable, WritableOptions } from 'node:stream';
|
|
7
|
+
import { Readable, Readable as ReadableType, Writable, WritableOptions } from 'node:stream';
|
|
8
8
|
import { SecureContext, TLSSocket } from 'node:tls';
|
|
9
9
|
import { Cookie as TouchCookie, CookieJar as TouchCookieJar, CreateCookieOptions } from 'tough-cookie';
|
|
10
10
|
|
|
@@ -140,7 +140,6 @@ export declare class RezoHeaders extends Headers {
|
|
|
140
140
|
string,
|
|
141
141
|
string | string[]
|
|
142
142
|
]>;
|
|
143
|
-
[util.inspect.custom](_depth: number, options: util.InspectOptionsStylized): string;
|
|
144
143
|
get [Symbol.toStringTag](): string;
|
|
145
144
|
}
|
|
146
145
|
export interface SerializedCookie {
|
|
@@ -314,8 +313,8 @@ export interface ReadableOptions {
|
|
|
314
313
|
highWaterMark?: number;
|
|
315
314
|
encoding?: string;
|
|
316
315
|
objectMode?: boolean;
|
|
317
|
-
read?(this:
|
|
318
|
-
destroy?(this:
|
|
316
|
+
read?(this: ReadableType, size: number): void;
|
|
317
|
+
destroy?(this: ReadableType, error: Error | null, callback: (error: Error | null) => void): void;
|
|
319
318
|
autoDestroy?: boolean;
|
|
320
319
|
}
|
|
321
320
|
export interface Options extends ReadableOptions {
|
package/dist/platform/deno.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { EventEmitter } from 'node:events';
|
|
|
4
4
|
import { Agent as HttpAgent, OutgoingHttpHeaders } from 'node:http';
|
|
5
5
|
import { Agent as HttpsAgent } from 'node:https';
|
|
6
6
|
import { Socket } from 'node:net';
|
|
7
|
-
import { Readable, Writable, WritableOptions } from 'node:stream';
|
|
7
|
+
import { Readable, Readable as ReadableType, Writable, WritableOptions } from 'node:stream';
|
|
8
8
|
import { SecureContext, TLSSocket } from 'node:tls';
|
|
9
9
|
import { Cookie as TouchCookie, CookieJar as TouchCookieJar, CreateCookieOptions } from 'tough-cookie';
|
|
10
10
|
|
|
@@ -140,7 +140,6 @@ export declare class RezoHeaders extends Headers {
|
|
|
140
140
|
string,
|
|
141
141
|
string | string[]
|
|
142
142
|
]>;
|
|
143
|
-
[util.inspect.custom](_depth: number, options: util.InspectOptionsStylized): string;
|
|
144
143
|
get [Symbol.toStringTag](): string;
|
|
145
144
|
}
|
|
146
145
|
export interface SerializedCookie {
|
|
@@ -314,8 +313,8 @@ export interface ReadableOptions {
|
|
|
314
313
|
highWaterMark?: number;
|
|
315
314
|
encoding?: string;
|
|
316
315
|
objectMode?: boolean;
|
|
317
|
-
read?(this:
|
|
318
|
-
destroy?(this:
|
|
316
|
+
read?(this: ReadableType, size: number): void;
|
|
317
|
+
destroy?(this: ReadableType, error: Error | null, callback: (error: Error | null) => void): void;
|
|
319
318
|
autoDestroy?: boolean;
|
|
320
319
|
}
|
|
321
320
|
export interface Options extends ReadableOptions {
|
package/dist/platform/node.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { EventEmitter } from 'node:events';
|
|
|
4
4
|
import { Agent as HttpAgent, OutgoingHttpHeaders } from 'node:http';
|
|
5
5
|
import { Agent as HttpsAgent } from 'node:https';
|
|
6
6
|
import { Socket } from 'node:net';
|
|
7
|
-
import { Readable, Writable, WritableOptions } from 'node:stream';
|
|
7
|
+
import { Readable, Readable as ReadableType, Writable, WritableOptions } from 'node:stream';
|
|
8
8
|
import { SecureContext, TLSSocket } from 'node:tls';
|
|
9
9
|
import { Cookie as TouchCookie, CookieJar as TouchCookieJar, CreateCookieOptions } from 'tough-cookie';
|
|
10
10
|
|
|
@@ -140,7 +140,6 @@ export declare class RezoHeaders extends Headers {
|
|
|
140
140
|
string,
|
|
141
141
|
string | string[]
|
|
142
142
|
]>;
|
|
143
|
-
[util.inspect.custom](_depth: number, options: util.InspectOptionsStylized): string;
|
|
144
143
|
get [Symbol.toStringTag](): string;
|
|
145
144
|
}
|
|
146
145
|
export interface SerializedCookie {
|
|
@@ -314,8 +313,8 @@ export interface ReadableOptions {
|
|
|
314
313
|
highWaterMark?: number;
|
|
315
314
|
encoding?: string;
|
|
316
315
|
objectMode?: boolean;
|
|
317
|
-
read?(this:
|
|
318
|
-
destroy?(this:
|
|
316
|
+
read?(this: ReadableType, size: number): void;
|
|
317
|
+
destroy?(this: ReadableType, error: Error | null, callback: (error: Error | null) => void): void;
|
|
319
318
|
autoDestroy?: boolean;
|
|
320
319
|
}
|
|
321
320
|
export interface Options extends ReadableOptions {
|
|
@@ -4,7 +4,7 @@ import { EventEmitter } from 'node:events';
|
|
|
4
4
|
import { Agent as HttpAgent, OutgoingHttpHeaders } from 'node:http';
|
|
5
5
|
import { Agent as HttpsAgent } from 'node:https';
|
|
6
6
|
import { Socket } from 'node:net';
|
|
7
|
-
import { Readable, Writable, WritableOptions } from 'node:stream';
|
|
7
|
+
import { Readable, Readable as ReadableType, Writable, WritableOptions } from 'node:stream';
|
|
8
8
|
import { SecureContext, TLSSocket } from 'node:tls';
|
|
9
9
|
import { Cookie as TouchCookie, CookieJar as TouchCookieJar, CreateCookieOptions } from 'tough-cookie';
|
|
10
10
|
|
|
@@ -140,7 +140,6 @@ export declare class RezoHeaders extends Headers {
|
|
|
140
140
|
string,
|
|
141
141
|
string | string[]
|
|
142
142
|
]>;
|
|
143
|
-
[util.inspect.custom](_depth: number, options: util.InspectOptionsStylized): string;
|
|
144
143
|
get [Symbol.toStringTag](): string;
|
|
145
144
|
}
|
|
146
145
|
export interface SerializedCookie {
|
|
@@ -314,8 +313,8 @@ export interface ReadableOptions {
|
|
|
314
313
|
highWaterMark?: number;
|
|
315
314
|
encoding?: string;
|
|
316
315
|
objectMode?: boolean;
|
|
317
|
-
read?(this:
|
|
318
|
-
destroy?(this:
|
|
316
|
+
read?(this: ReadableType, size: number): void;
|
|
317
|
+
destroy?(this: ReadableType, error: Error | null, callback: (error: Error | null) => void): void;
|
|
319
318
|
autoDestroy?: boolean;
|
|
320
319
|
}
|
|
321
320
|
export interface Options extends ReadableOptions {
|
|
@@ -4,7 +4,7 @@ import { EventEmitter } from 'node:events';
|
|
|
4
4
|
import { Agent as HttpAgent, OutgoingHttpHeaders } from 'node:http';
|
|
5
5
|
import { Agent as HttpsAgent } from 'node:https';
|
|
6
6
|
import { Socket } from 'node:net';
|
|
7
|
-
import { Readable, Writable, WritableOptions } from 'node:stream';
|
|
7
|
+
import { Readable, Readable as ReadableType, Writable, WritableOptions } from 'node:stream';
|
|
8
8
|
import { SecureContext, TLSSocket } from 'node:tls';
|
|
9
9
|
import { Cookie as TouchCookie, CookieJar as TouchCookieJar, CreateCookieOptions } from 'tough-cookie';
|
|
10
10
|
|
|
@@ -140,7 +140,6 @@ export declare class RezoHeaders extends Headers {
|
|
|
140
140
|
string,
|
|
141
141
|
string | string[]
|
|
142
142
|
]>;
|
|
143
|
-
[util.inspect.custom](_depth: number, options: util.InspectOptionsStylized): string;
|
|
144
143
|
get [Symbol.toStringTag](): string;
|
|
145
144
|
}
|
|
146
145
|
export interface SerializedCookie {
|
|
@@ -314,8 +313,8 @@ export interface ReadableOptions {
|
|
|
314
313
|
highWaterMark?: number;
|
|
315
314
|
encoding?: string;
|
|
316
315
|
objectMode?: boolean;
|
|
317
|
-
read?(this:
|
|
318
|
-
destroy?(this:
|
|
316
|
+
read?(this: ReadableType, size: number): void;
|
|
317
|
+
destroy?(this: ReadableType, error: Error | null, callback: (error: Error | null) => void): void;
|
|
319
318
|
autoDestroy?: boolean;
|
|
320
319
|
}
|
|
321
320
|
export interface Options extends ReadableOptions {
|
package/dist/plugin/index.cjs
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
const
|
|
2
|
-
exports.Crawler =
|
|
3
|
-
const
|
|
4
|
-
exports.CrawlerOptions =
|
|
5
|
-
const
|
|
6
|
-
exports.FileCacher =
|
|
7
|
-
const
|
|
8
|
-
exports.UrlStore =
|
|
9
|
-
const
|
|
10
|
-
exports.Oxylabs =
|
|
11
|
-
const
|
|
12
|
-
exports.OXYLABS_BROWSER_TYPES =
|
|
13
|
-
exports.OXYLABS_COMMON_LOCALES =
|
|
14
|
-
exports.OXYLABS_COMMON_GEO_LOCATIONS =
|
|
15
|
-
exports.OXYLABS_US_STATES =
|
|
16
|
-
exports.OXYLABS_EUROPEAN_COUNTRIES =
|
|
17
|
-
exports.OXYLABS_ASIAN_COUNTRIES =
|
|
18
|
-
exports.getRandomOxylabsBrowserType =
|
|
19
|
-
exports.getRandomOxylabsLocale =
|
|
20
|
-
exports.getRandomOxylabsGeoLocation =
|
|
21
|
-
const
|
|
22
|
-
exports.Decodo =
|
|
23
|
-
const
|
|
24
|
-
exports.DECODO_DEVICE_TYPES =
|
|
25
|
-
exports.DECODO_HEADLESS_MODES =
|
|
26
|
-
exports.DECODO_COMMON_LOCALES =
|
|
27
|
-
exports.DECODO_COMMON_COUNTRIES =
|
|
28
|
-
exports.DECODO_EUROPEAN_COUNTRIES =
|
|
29
|
-
exports.DECODO_ASIAN_COUNTRIES =
|
|
30
|
-
exports.DECODO_US_STATES =
|
|
31
|
-
exports.DECODO_COMMON_CITIES =
|
|
32
|
-
exports.getRandomDecodoDeviceType =
|
|
33
|
-
exports.getRandomDecodoLocale =
|
|
34
|
-
exports.getRandomDecodoCountry =
|
|
35
|
-
exports.getRandomDecodoCity =
|
|
36
|
-
exports.generateDecodoSessionId =
|
|
1
|
+
const _mod_yi47xm = require('./crawler.cjs');
|
|
2
|
+
exports.Crawler = _mod_yi47xm.Crawler;;
|
|
3
|
+
const _mod_adybyd = require('./crawler-options.cjs');
|
|
4
|
+
exports.CrawlerOptions = _mod_adybyd.CrawlerOptions;;
|
|
5
|
+
const _mod_tz3o9k = require('../cache/file-cacher.cjs');
|
|
6
|
+
exports.FileCacher = _mod_tz3o9k.FileCacher;;
|
|
7
|
+
const _mod_qopdx6 = require('../cache/url-store.cjs');
|
|
8
|
+
exports.UrlStore = _mod_qopdx6.UrlStore;;
|
|
9
|
+
const _mod_cgmauf = require('./addon/oxylabs/index.cjs');
|
|
10
|
+
exports.Oxylabs = _mod_cgmauf.Oxylabs;;
|
|
11
|
+
const _mod_rsaj94 = require('./addon/oxylabs/options.cjs');
|
|
12
|
+
exports.OXYLABS_BROWSER_TYPES = _mod_rsaj94.OXYLABS_BROWSER_TYPES;
|
|
13
|
+
exports.OXYLABS_COMMON_LOCALES = _mod_rsaj94.OXYLABS_COMMON_LOCALES;
|
|
14
|
+
exports.OXYLABS_COMMON_GEO_LOCATIONS = _mod_rsaj94.OXYLABS_COMMON_GEO_LOCATIONS;
|
|
15
|
+
exports.OXYLABS_US_STATES = _mod_rsaj94.OXYLABS_US_STATES;
|
|
16
|
+
exports.OXYLABS_EUROPEAN_COUNTRIES = _mod_rsaj94.OXYLABS_EUROPEAN_COUNTRIES;
|
|
17
|
+
exports.OXYLABS_ASIAN_COUNTRIES = _mod_rsaj94.OXYLABS_ASIAN_COUNTRIES;
|
|
18
|
+
exports.getRandomOxylabsBrowserType = _mod_rsaj94.getRandomBrowserType;
|
|
19
|
+
exports.getRandomOxylabsLocale = _mod_rsaj94.getRandomLocale;
|
|
20
|
+
exports.getRandomOxylabsGeoLocation = _mod_rsaj94.getRandomGeoLocation;;
|
|
21
|
+
const _mod_rhi157 = require('./addon/decodo/index.cjs');
|
|
22
|
+
exports.Decodo = _mod_rhi157.Decodo;;
|
|
23
|
+
const _mod_i5pjvf = require('./addon/decodo/options.cjs');
|
|
24
|
+
exports.DECODO_DEVICE_TYPES = _mod_i5pjvf.DECODO_DEVICE_TYPES;
|
|
25
|
+
exports.DECODO_HEADLESS_MODES = _mod_i5pjvf.DECODO_HEADLESS_MODES;
|
|
26
|
+
exports.DECODO_COMMON_LOCALES = _mod_i5pjvf.DECODO_COMMON_LOCALES;
|
|
27
|
+
exports.DECODO_COMMON_COUNTRIES = _mod_i5pjvf.DECODO_COMMON_COUNTRIES;
|
|
28
|
+
exports.DECODO_EUROPEAN_COUNTRIES = _mod_i5pjvf.DECODO_EUROPEAN_COUNTRIES;
|
|
29
|
+
exports.DECODO_ASIAN_COUNTRIES = _mod_i5pjvf.DECODO_ASIAN_COUNTRIES;
|
|
30
|
+
exports.DECODO_US_STATES = _mod_i5pjvf.DECODO_US_STATES;
|
|
31
|
+
exports.DECODO_COMMON_CITIES = _mod_i5pjvf.DECODO_COMMON_CITIES;
|
|
32
|
+
exports.getRandomDecodoDeviceType = _mod_i5pjvf.getRandomDeviceType;
|
|
33
|
+
exports.getRandomDecodoLocale = _mod_i5pjvf.getRandomLocale;
|
|
34
|
+
exports.getRandomDecodoCountry = _mod_i5pjvf.getRandomCountry;
|
|
35
|
+
exports.getRandomDecodoCity = _mod_i5pjvf.getRandomCity;
|
|
36
|
+
exports.generateDecodoSessionId = _mod_i5pjvf.generateSessionId;;
|
package/dist/proxy/index.cjs
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
const { SocksProxyAgent: RezoSocksProxy } = require("socks-proxy-agent");
|
|
2
2
|
const { HttpsProxyAgent: RezoHttpsSocks } = require("https-proxy-agent");
|
|
3
3
|
const { HttpProxyAgent: RezoHttpSocks } = require("http-proxy-agent");
|
|
4
|
-
const
|
|
5
|
-
|
|
4
|
+
const { parseProxyString } = require('./parse.cjs');
|
|
5
|
+
const _mod_050i71 = require('./manager.cjs');
|
|
6
|
+
exports.ProxyManager = _mod_050i71.ProxyManager;;
|
|
7
|
+
const _mod_cxafjm = require('./parse.cjs');
|
|
8
|
+
exports.parseProxyString = _mod_cxafjm.parseProxyString;;
|
|
6
9
|
function createOptions(uri, opts) {
|
|
7
10
|
if (uri instanceof URL || typeof uri === "string") {
|
|
8
11
|
return {
|
|
@@ -18,83 +21,6 @@ function createOptions(uri, opts) {
|
|
|
18
21
|
uri: `${protocol}://${authstr}${host}:${port}`
|
|
19
22
|
};
|
|
20
23
|
}
|
|
21
|
-
function isIPv4(host) {
|
|
22
|
-
const ipv4Regex = /^(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)){3}$/;
|
|
23
|
-
return ipv4Regex.test(host);
|
|
24
|
-
}
|
|
25
|
-
function isDomain(host) {
|
|
26
|
-
const domainRegex = /^(?=.{1,253}$)(?!-)([a-zA-Z0-9-]{1,63}\.)+[a-zA-Z]{2,63}$/;
|
|
27
|
-
return domainRegex.test(host);
|
|
28
|
-
}
|
|
29
|
-
function isNumeric(value) {
|
|
30
|
-
if (typeof value === "number")
|
|
31
|
-
return isFinite(value);
|
|
32
|
-
if (typeof value === "string" && value.trim() !== "") {
|
|
33
|
-
return !isNaN(Number(value));
|
|
34
|
-
}
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
|
-
function parseProxyString(input) {
|
|
38
|
-
if (!input)
|
|
39
|
-
return null;
|
|
40
|
-
let host = "";
|
|
41
|
-
let port = 0;
|
|
42
|
-
let username;
|
|
43
|
-
let password;
|
|
44
|
-
const proto = input.includes("://") ? input.split("://")[0].toLowerCase() : "";
|
|
45
|
-
const protocol = proto.startsWith("http") ? "http" : proto.startsWith("https") ? "https" : "socks5";
|
|
46
|
-
if (protocol !== "socks5" || input.includes("://")) {
|
|
47
|
-
input = input.split("://")[1];
|
|
48
|
-
}
|
|
49
|
-
const getProxy = (authPart, hostPart) => {
|
|
50
|
-
if (authPart && authPart.includes(":")) {
|
|
51
|
-
const [p1, ..._p2] = authPart.split(":");
|
|
52
|
-
const p2 = _p2.join(":");
|
|
53
|
-
if ((isIPv4(p1) || isDomain(p1)) && isNumeric(p2)) {
|
|
54
|
-
host = p1;
|
|
55
|
-
port = parseInt(p2, 10);
|
|
56
|
-
} else {
|
|
57
|
-
username = p1;
|
|
58
|
-
password = p2;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
if (hostPart && hostPart.includes(":")) {
|
|
62
|
-
const [p1, ..._p2] = hostPart.split(":");
|
|
63
|
-
const p2 = _p2.join(":");
|
|
64
|
-
if ((isIPv4(p1) || isDomain(p1)) && isNumeric(p2)) {
|
|
65
|
-
host = p1;
|
|
66
|
-
port = parseInt(p2, 10);
|
|
67
|
-
} else {
|
|
68
|
-
username = p1;
|
|
69
|
-
password = p2;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
if (!host && !port)
|
|
73
|
-
return null;
|
|
74
|
-
if (username && password) {
|
|
75
|
-
return { protocol, host, port, auth: { username, password } };
|
|
76
|
-
}
|
|
77
|
-
return {
|
|
78
|
-
protocol,
|
|
79
|
-
host,
|
|
80
|
-
port
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
input = input.trim();
|
|
84
|
-
if (input.includes("@")) {
|
|
85
|
-
const [authPart, hostPart] = input.split("@");
|
|
86
|
-
if (!authPart && !hostPart)
|
|
87
|
-
return null;
|
|
88
|
-
return getProxy(authPart, hostPart);
|
|
89
|
-
} else if (input.split(":").length === 4 || input.split(":").length === 2) {
|
|
90
|
-
const parts = input.split(":");
|
|
91
|
-
const authPart = input.split(":").length === 2 ? undefined : parts[2] + ":" + parts[3];
|
|
92
|
-
const hostPart = parts[0] + ":" + parts[1];
|
|
93
|
-
return getProxy(authPart || "", hostPart || "");
|
|
94
|
-
} else {
|
|
95
|
-
return null;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
24
|
function rezoProxy(uri, over, opts) {
|
|
99
25
|
if (typeof uri === "string") {
|
|
100
26
|
if (typeof over === "string") {
|
|
@@ -139,5 +65,4 @@ function rezoProxy(uri, over, opts) {
|
|
|
139
65
|
return new RezoSocksProxy(config.uri, config.opts);
|
|
140
66
|
}
|
|
141
67
|
|
|
142
|
-
exports.parseProxyString = parseProxyString;
|
|
143
68
|
exports.rezoProxy = rezoProxy;
|
package/dist/proxy/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { SocksProxyAgent as RezoSocksProxy } from "socks-proxy-agent";
|
|
2
2
|
import { HttpsProxyAgent as RezoHttpsSocks } from "https-proxy-agent";
|
|
3
3
|
import { HttpProxyAgent as RezoHttpSocks } from "http-proxy-agent";
|
|
4
|
+
import { parseProxyString } from './parse.js';
|
|
4
5
|
export { ProxyManager } from './manager.js';
|
|
6
|
+
export { parseProxyString } from './parse.js';
|
|
5
7
|
function createOptions(uri, opts) {
|
|
6
8
|
if (uri instanceof URL || typeof uri === "string") {
|
|
7
9
|
return {
|
|
@@ -17,83 +19,6 @@ function createOptions(uri, opts) {
|
|
|
17
19
|
uri: `${protocol}://${authstr}${host}:${port}`
|
|
18
20
|
};
|
|
19
21
|
}
|
|
20
|
-
function isIPv4(host) {
|
|
21
|
-
const ipv4Regex = /^(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)){3}$/;
|
|
22
|
-
return ipv4Regex.test(host);
|
|
23
|
-
}
|
|
24
|
-
function isDomain(host) {
|
|
25
|
-
const domainRegex = /^(?=.{1,253}$)(?!-)([a-zA-Z0-9-]{1,63}\.)+[a-zA-Z]{2,63}$/;
|
|
26
|
-
return domainRegex.test(host);
|
|
27
|
-
}
|
|
28
|
-
function isNumeric(value) {
|
|
29
|
-
if (typeof value === "number")
|
|
30
|
-
return isFinite(value);
|
|
31
|
-
if (typeof value === "string" && value.trim() !== "") {
|
|
32
|
-
return !isNaN(Number(value));
|
|
33
|
-
}
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
export function parseProxyString(input) {
|
|
37
|
-
if (!input)
|
|
38
|
-
return null;
|
|
39
|
-
let host = "";
|
|
40
|
-
let port = 0;
|
|
41
|
-
let username;
|
|
42
|
-
let password;
|
|
43
|
-
const proto = input.includes("://") ? input.split("://")[0].toLowerCase() : "";
|
|
44
|
-
const protocol = proto.startsWith("http") ? "http" : proto.startsWith("https") ? "https" : "socks5";
|
|
45
|
-
if (protocol !== "socks5" || input.includes("://")) {
|
|
46
|
-
input = input.split("://")[1];
|
|
47
|
-
}
|
|
48
|
-
const getProxy = (authPart, hostPart) => {
|
|
49
|
-
if (authPart && authPart.includes(":")) {
|
|
50
|
-
const [p1, ..._p2] = authPart.split(":");
|
|
51
|
-
const p2 = _p2.join(":");
|
|
52
|
-
if ((isIPv4(p1) || isDomain(p1)) && isNumeric(p2)) {
|
|
53
|
-
host = p1;
|
|
54
|
-
port = parseInt(p2, 10);
|
|
55
|
-
} else {
|
|
56
|
-
username = p1;
|
|
57
|
-
password = p2;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
if (hostPart && hostPart.includes(":")) {
|
|
61
|
-
const [p1, ..._p2] = hostPart.split(":");
|
|
62
|
-
const p2 = _p2.join(":");
|
|
63
|
-
if ((isIPv4(p1) || isDomain(p1)) && isNumeric(p2)) {
|
|
64
|
-
host = p1;
|
|
65
|
-
port = parseInt(p2, 10);
|
|
66
|
-
} else {
|
|
67
|
-
username = p1;
|
|
68
|
-
password = p2;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
if (!host && !port)
|
|
72
|
-
return null;
|
|
73
|
-
if (username && password) {
|
|
74
|
-
return { protocol, host, port, auth: { username, password } };
|
|
75
|
-
}
|
|
76
|
-
return {
|
|
77
|
-
protocol,
|
|
78
|
-
host,
|
|
79
|
-
port
|
|
80
|
-
};
|
|
81
|
-
};
|
|
82
|
-
input = input.trim();
|
|
83
|
-
if (input.includes("@")) {
|
|
84
|
-
const [authPart, hostPart] = input.split("@");
|
|
85
|
-
if (!authPart && !hostPart)
|
|
86
|
-
return null;
|
|
87
|
-
return getProxy(authPart, hostPart);
|
|
88
|
-
} else if (input.split(":").length === 4 || input.split(":").length === 2) {
|
|
89
|
-
const parts = input.split(":");
|
|
90
|
-
const authPart = input.split(":").length === 2 ? undefined : parts[2] + ":" + parts[3];
|
|
91
|
-
const hostPart = parts[0] + ":" + parts[1];
|
|
92
|
-
return getProxy(authPart || "", hostPart || "");
|
|
93
|
-
} else {
|
|
94
|
-
return null;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
22
|
export function rezoProxy(uri, over, opts) {
|
|
98
23
|
if (typeof uri === "string") {
|
|
99
24
|
if (typeof over === "string") {
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
function isIPv4(host) {
|
|
2
|
+
const ipv4Regex = /^(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)){3}$/;
|
|
3
|
+
return ipv4Regex.test(host);
|
|
4
|
+
}
|
|
5
|
+
function isDomain(host) {
|
|
6
|
+
const domainRegex = /^(?=.{1,253}$)(?!-)([a-zA-Z0-9-]{1,63}\.)+[a-zA-Z]{2,63}$/;
|
|
7
|
+
return domainRegex.test(host);
|
|
8
|
+
}
|
|
9
|
+
function isNumeric(value) {
|
|
10
|
+
if (typeof value === "number")
|
|
11
|
+
return isFinite(value);
|
|
12
|
+
if (typeof value === "string" && value.trim() !== "") {
|
|
13
|
+
return !isNaN(Number(value));
|
|
14
|
+
}
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
function parseProxyString(input) {
|
|
18
|
+
if (!input)
|
|
19
|
+
return null;
|
|
20
|
+
let host = "";
|
|
21
|
+
let port = 0;
|
|
22
|
+
let username;
|
|
23
|
+
let password;
|
|
24
|
+
const proto = input.includes("://") ? input.split("://")[0].toLowerCase() : "";
|
|
25
|
+
const protocol = proto.startsWith("http") ? "http" : proto.startsWith("https") ? "https" : "socks5";
|
|
26
|
+
if (protocol !== "socks5" || input.includes("://")) {
|
|
27
|
+
input = input.split("://")[1];
|
|
28
|
+
}
|
|
29
|
+
const getProxy = (authPart, hostPart) => {
|
|
30
|
+
if (authPart && authPart.includes(":")) {
|
|
31
|
+
const [p1, ..._p2] = authPart.split(":");
|
|
32
|
+
const p2 = _p2.join(":");
|
|
33
|
+
if ((isIPv4(p1) || isDomain(p1)) && isNumeric(p2)) {
|
|
34
|
+
host = p1;
|
|
35
|
+
port = parseInt(p2, 10);
|
|
36
|
+
} else {
|
|
37
|
+
username = p1;
|
|
38
|
+
password = p2;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (hostPart && hostPart.includes(":")) {
|
|
42
|
+
const [p1, ..._p2] = hostPart.split(":");
|
|
43
|
+
const p2 = _p2.join(":");
|
|
44
|
+
if ((isIPv4(p1) || isDomain(p1)) && isNumeric(p2)) {
|
|
45
|
+
host = p1;
|
|
46
|
+
port = parseInt(p2, 10);
|
|
47
|
+
} else {
|
|
48
|
+
username = p1;
|
|
49
|
+
password = p2;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (!host && !port)
|
|
53
|
+
return null;
|
|
54
|
+
if (username && password) {
|
|
55
|
+
return { protocol, host, port, auth: { username, password } };
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
protocol,
|
|
59
|
+
host,
|
|
60
|
+
port
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
input = input.trim();
|
|
64
|
+
if (input.includes("@")) {
|
|
65
|
+
const [authPart, hostPart] = input.split("@");
|
|
66
|
+
if (!authPart && !hostPart)
|
|
67
|
+
return null;
|
|
68
|
+
return getProxy(authPart, hostPart);
|
|
69
|
+
} else if (input.split(":").length === 4 || input.split(":").length === 2) {
|
|
70
|
+
const parts = input.split(":");
|
|
71
|
+
const authPart = input.split(":").length === 2 ? undefined : parts[2] + ":" + parts[3];
|
|
72
|
+
const hostPart = parts[0] + ":" + parts[1];
|
|
73
|
+
return getProxy(authPart || "", hostPart || "");
|
|
74
|
+
} else {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
exports.parseProxyString = parseProxyString;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
function isIPv4(host) {
|
|
2
|
+
const ipv4Regex = /^(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)){3}$/;
|
|
3
|
+
return ipv4Regex.test(host);
|
|
4
|
+
}
|
|
5
|
+
function isDomain(host) {
|
|
6
|
+
const domainRegex = /^(?=.{1,253}$)(?!-)([a-zA-Z0-9-]{1,63}\.)+[a-zA-Z]{2,63}$/;
|
|
7
|
+
return domainRegex.test(host);
|
|
8
|
+
}
|
|
9
|
+
function isNumeric(value) {
|
|
10
|
+
if (typeof value === "number")
|
|
11
|
+
return isFinite(value);
|
|
12
|
+
if (typeof value === "string" && value.trim() !== "") {
|
|
13
|
+
return !isNaN(Number(value));
|
|
14
|
+
}
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
export function parseProxyString(input) {
|
|
18
|
+
if (!input)
|
|
19
|
+
return null;
|
|
20
|
+
let host = "";
|
|
21
|
+
let port = 0;
|
|
22
|
+
let username;
|
|
23
|
+
let password;
|
|
24
|
+
const proto = input.includes("://") ? input.split("://")[0].toLowerCase() : "";
|
|
25
|
+
const protocol = proto.startsWith("http") ? "http" : proto.startsWith("https") ? "https" : "socks5";
|
|
26
|
+
if (protocol !== "socks5" || input.includes("://")) {
|
|
27
|
+
input = input.split("://")[1];
|
|
28
|
+
}
|
|
29
|
+
const getProxy = (authPart, hostPart) => {
|
|
30
|
+
if (authPart && authPart.includes(":")) {
|
|
31
|
+
const [p1, ..._p2] = authPart.split(":");
|
|
32
|
+
const p2 = _p2.join(":");
|
|
33
|
+
if ((isIPv4(p1) || isDomain(p1)) && isNumeric(p2)) {
|
|
34
|
+
host = p1;
|
|
35
|
+
port = parseInt(p2, 10);
|
|
36
|
+
} else {
|
|
37
|
+
username = p1;
|
|
38
|
+
password = p2;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (hostPart && hostPart.includes(":")) {
|
|
42
|
+
const [p1, ..._p2] = hostPart.split(":");
|
|
43
|
+
const p2 = _p2.join(":");
|
|
44
|
+
if ((isIPv4(p1) || isDomain(p1)) && isNumeric(p2)) {
|
|
45
|
+
host = p1;
|
|
46
|
+
port = parseInt(p2, 10);
|
|
47
|
+
} else {
|
|
48
|
+
username = p1;
|
|
49
|
+
password = p2;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (!host && !port)
|
|
53
|
+
return null;
|
|
54
|
+
if (username && password) {
|
|
55
|
+
return { protocol, host, port, auth: { username, password } };
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
protocol,
|
|
59
|
+
host,
|
|
60
|
+
port
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
input = input.trim();
|
|
64
|
+
if (input.includes("@")) {
|
|
65
|
+
const [authPart, hostPart] = input.split("@");
|
|
66
|
+
if (!authPart && !hostPart)
|
|
67
|
+
return null;
|
|
68
|
+
return getProxy(authPart, hostPart);
|
|
69
|
+
} else if (input.split(":").length === 4 || input.split(":").length === 2) {
|
|
70
|
+
const parts = input.split(":");
|
|
71
|
+
const authPart = input.split(":").length === 2 ? undefined : parts[2] + ":" + parts[3];
|
|
72
|
+
const hostPart = parts[0] + ":" + parts[1];
|
|
73
|
+
return getProxy(authPart || "", hostPart || "");
|
|
74
|
+
} else {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
}
|
package/dist/queue/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const
|
|
2
|
-
exports.RezoQueue =
|
|
3
|
-
const
|
|
4
|
-
exports.HttpQueue =
|
|
5
|
-
exports.extractDomain =
|
|
6
|
-
const
|
|
7
|
-
exports.Priority =
|
|
8
|
-
exports.HttpMethodPriority =
|
|
1
|
+
const _mod_7u4oi2 = require('./queue.cjs');
|
|
2
|
+
exports.RezoQueue = _mod_7u4oi2.RezoQueue;;
|
|
3
|
+
const _mod_zkptdl = require('./http-queue.cjs');
|
|
4
|
+
exports.HttpQueue = _mod_zkptdl.HttpQueue;
|
|
5
|
+
exports.extractDomain = _mod_zkptdl.extractDomain;;
|
|
6
|
+
const _mod_84nawv = require('./types.cjs');
|
|
7
|
+
exports.Priority = _mod_84nawv.Priority;
|
|
8
|
+
exports.HttpMethodPriority = _mod_84nawv.HttpMethodPriority;;
|
package/dist/utils/form-data.cjs
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
const NodeFormData = require("form-data");
|
|
2
|
-
|
|
2
|
+
function isReadableStream(value) {
|
|
3
|
+
return value !== null && typeof value === "object" && typeof value.pipe === "function" && typeof value.read === "function" && typeof value.on === "function";
|
|
4
|
+
}
|
|
3
5
|
|
|
4
6
|
class RezoFormData extends NodeFormData {
|
|
5
7
|
constructor(options) {
|
|
@@ -22,7 +24,7 @@ class RezoFormData extends NodeFormData {
|
|
|
22
24
|
const formData = new FormData;
|
|
23
25
|
const entries = await this.getFieldEntries();
|
|
24
26
|
for (const [key, value] of entries) {
|
|
25
|
-
if (value
|
|
27
|
+
if (isReadableStream(value)) {
|
|
26
28
|
const chunks = [];
|
|
27
29
|
for await (const chunk of value) {
|
|
28
30
|
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
@@ -95,7 +97,7 @@ class RezoFormData extends NodeFormData {
|
|
|
95
97
|
});
|
|
96
98
|
return;
|
|
97
99
|
}
|
|
98
|
-
if (value
|
|
100
|
+
if (isReadableStream(value)) {
|
|
99
101
|
formData.append(key, value);
|
|
100
102
|
return;
|
|
101
103
|
}
|
|
@@ -152,7 +154,7 @@ class RezoFormData extends NodeFormData {
|
|
|
152
154
|
} else {
|
|
153
155
|
hasOmittedData = true;
|
|
154
156
|
}
|
|
155
|
-
} else if (value
|
|
157
|
+
} else if (isReadableStream(value) || typeof File !== "undefined" && value instanceof File || typeof Blob !== "undefined" && value instanceof Blob) {
|
|
156
158
|
if (convertBinaryToBase64 && value instanceof File) {
|
|
157
159
|
hasOmittedData = true;
|
|
158
160
|
} else {
|
|
@@ -190,7 +192,7 @@ class RezoFormData extends NodeFormData {
|
|
|
190
192
|
} else {
|
|
191
193
|
hasOmittedData = true;
|
|
192
194
|
}
|
|
193
|
-
} else if (value
|
|
195
|
+
} else if (isReadableStream(value) || typeof File !== "undefined" && value instanceof File || typeof Blob !== "undefined" && value instanceof Blob) {
|
|
194
196
|
if (convertBinaryToBase64 && value instanceof File) {
|
|
195
197
|
hasOmittedData = true;
|
|
196
198
|
} else {
|
package/dist/utils/form-data.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import NodeFormData from "form-data";
|
|
2
|
-
|
|
2
|
+
function isReadableStream(value) {
|
|
3
|
+
return value !== null && typeof value === "object" && typeof value.pipe === "function" && typeof value.read === "function" && typeof value.on === "function";
|
|
4
|
+
}
|
|
3
5
|
|
|
4
6
|
export class RezoFormData extends NodeFormData {
|
|
5
7
|
constructor(options) {
|
|
@@ -22,7 +24,7 @@ export class RezoFormData extends NodeFormData {
|
|
|
22
24
|
const formData = new FormData;
|
|
23
25
|
const entries = await this.getFieldEntries();
|
|
24
26
|
for (const [key, value] of entries) {
|
|
25
|
-
if (value
|
|
27
|
+
if (isReadableStream(value)) {
|
|
26
28
|
const chunks = [];
|
|
27
29
|
for await (const chunk of value) {
|
|
28
30
|
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
@@ -95,7 +97,7 @@ export class RezoFormData extends NodeFormData {
|
|
|
95
97
|
});
|
|
96
98
|
return;
|
|
97
99
|
}
|
|
98
|
-
if (value
|
|
100
|
+
if (isReadableStream(value)) {
|
|
99
101
|
formData.append(key, value);
|
|
100
102
|
return;
|
|
101
103
|
}
|
|
@@ -152,7 +154,7 @@ export class RezoFormData extends NodeFormData {
|
|
|
152
154
|
} else {
|
|
153
155
|
hasOmittedData = true;
|
|
154
156
|
}
|
|
155
|
-
} else if (value
|
|
157
|
+
} else if (isReadableStream(value) || typeof File !== "undefined" && value instanceof File || typeof Blob !== "undefined" && value instanceof Blob) {
|
|
156
158
|
if (convertBinaryToBase64 && value instanceof File) {
|
|
157
159
|
hasOmittedData = true;
|
|
158
160
|
} else {
|
|
@@ -190,7 +192,7 @@ export class RezoFormData extends NodeFormData {
|
|
|
190
192
|
} else {
|
|
191
193
|
hasOmittedData = true;
|
|
192
194
|
}
|
|
193
|
-
} else if (value
|
|
195
|
+
} else if (isReadableStream(value) || typeof File !== "undefined" && value instanceof File || typeof Blob !== "undefined" && value instanceof Blob) {
|
|
194
196
|
if (convertBinaryToBase64 && value instanceof File) {
|
|
195
197
|
hasOmittedData = true;
|
|
196
198
|
} else {
|
package/dist/utils/headers.cjs
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
const util = require("node:util");
|
|
2
|
-
|
|
3
1
|
class RezoHeaders extends Headers {
|
|
4
2
|
constructor(init) {
|
|
5
3
|
if (init instanceof RezoHeaders) {
|
|
@@ -149,8 +147,8 @@ class RezoHeaders extends Headers {
|
|
|
149
147
|
[Symbol.iterator]() {
|
|
150
148
|
return Object.entries(this.toObject())[Symbol.iterator]();
|
|
151
149
|
}
|
|
152
|
-
[util.inspect.custom](
|
|
153
|
-
return `${this[Symbol.toStringTag]} ${
|
|
150
|
+
[Symbol.for("nodejs.util.inspect.custom")]() {
|
|
151
|
+
return `${this[Symbol.toStringTag]} ${JSON.stringify(this.toObject())}`;
|
|
154
152
|
}
|
|
155
153
|
get [Symbol.toStringTag]() {
|
|
156
154
|
return "RezoHeaders";
|
package/dist/utils/headers.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import util from "node:util";
|
|
2
|
-
|
|
3
1
|
class RezoHeaders extends Headers {
|
|
4
2
|
constructor(init) {
|
|
5
3
|
if (init instanceof RezoHeaders) {
|
|
@@ -149,8 +147,8 @@ class RezoHeaders extends Headers {
|
|
|
149
147
|
[Symbol.iterator]() {
|
|
150
148
|
return Object.entries(this.toObject())[Symbol.iterator]();
|
|
151
149
|
}
|
|
152
|
-
[util.inspect.custom](
|
|
153
|
-
return `${this[Symbol.toStringTag]} ${
|
|
150
|
+
[Symbol.for("nodejs.util.inspect.custom")]() {
|
|
151
|
+
return `${this[Symbol.toStringTag]} ${JSON.stringify(this.toObject())}`;
|
|
154
152
|
}
|
|
155
153
|
get [Symbol.toStringTag]() {
|
|
156
154
|
return "RezoHeaders";
|
|
@@ -2,8 +2,7 @@ const { RezoCookieJar } = require('./cookies.cjs');
|
|
|
2
2
|
const RezoFormData = require('./form-data.cjs');
|
|
3
3
|
const { RezoHeaders } = require('./headers.cjs');
|
|
4
4
|
const { RezoURLSearchParams } = require('./data-operations.cjs');
|
|
5
|
-
const
|
|
6
|
-
const { parseProxyString } = require('../proxy/index.cjs');
|
|
5
|
+
const { parseProxyString } = require('../proxy/parse.cjs');
|
|
7
6
|
const { createDefaultHooks, mergeHooks, serializeHooks } = require('../core/hooks.cjs');
|
|
8
7
|
const ERROR_INFO = exports.ERROR_INFO = {
|
|
9
8
|
ECONNREFUSED: {
|
|
@@ -642,13 +641,21 @@ As a workaround, process.env.NODE_TLS_REJECT_UNAUTHORIZED is being set to '0'.
|
|
|
642
641
|
} else if (!fs) {
|
|
643
642
|
throw new Error(`You can only use this feature in nodejs module, not in Edge module.`);
|
|
644
643
|
}
|
|
645
|
-
const
|
|
646
|
-
|
|
647
|
-
const
|
|
644
|
+
const basename = (p) => p.split(/[/\\]/).pop() || "";
|
|
645
|
+
const dirname = (p) => {
|
|
646
|
+
const parts = p.split(/[/\\]/);
|
|
647
|
+
parts.pop();
|
|
648
|
+
return parts.join("/") || ".";
|
|
649
|
+
};
|
|
650
|
+
const join = (...parts) => parts.join("/").replace(/\/+/g, "/");
|
|
651
|
+
const name = basename(saveTo);
|
|
652
|
+
const cwd = typeof process !== "undefined" && process.cwd ? process.cwd() : ".";
|
|
653
|
+
if (checkISPermission && checkISPermission(saveTo.length ? dirname(saveTo) : cwd, fs)) {
|
|
654
|
+
const dir = name.length < saveTo.length ? dirname(saveTo) : join(cwd, "download");
|
|
648
655
|
if (!fs.existsSync(dir)) {
|
|
649
656
|
fs.mkdirSync(dir, { recursive: true });
|
|
650
657
|
}
|
|
651
|
-
fileName =
|
|
658
|
+
fileName = join(dir, name);
|
|
652
659
|
config.fileName = fileName;
|
|
653
660
|
} else {
|
|
654
661
|
throw new Error(`Permission denied to save to ${saveTo}`);
|
|
@@ -2,8 +2,7 @@ import { RezoCookieJar } from './cookies.js';
|
|
|
2
2
|
import RezoFormData from './form-data.js';
|
|
3
3
|
import { RezoHeaders } from './headers.js';
|
|
4
4
|
import { RezoURLSearchParams } from './data-operations.js';
|
|
5
|
-
import
|
|
6
|
-
import { parseProxyString } from '../proxy/index.js';
|
|
5
|
+
import { parseProxyString } from '../proxy/parse.js';
|
|
7
6
|
import { createDefaultHooks, mergeHooks, serializeHooks } from '../core/hooks.js';
|
|
8
7
|
export const ERROR_INFO = {
|
|
9
8
|
ECONNREFUSED: {
|
|
@@ -642,13 +641,21 @@ As a workaround, process.env.NODE_TLS_REJECT_UNAUTHORIZED is being set to '0'.
|
|
|
642
641
|
} else if (!fs) {
|
|
643
642
|
throw new Error(`You can only use this feature in nodejs module, not in Edge module.`);
|
|
644
643
|
}
|
|
645
|
-
const
|
|
646
|
-
|
|
647
|
-
const
|
|
644
|
+
const basename = (p) => p.split(/[/\\]/).pop() || "";
|
|
645
|
+
const dirname = (p) => {
|
|
646
|
+
const parts = p.split(/[/\\]/);
|
|
647
|
+
parts.pop();
|
|
648
|
+
return parts.join("/") || ".";
|
|
649
|
+
};
|
|
650
|
+
const join = (...parts) => parts.join("/").replace(/\/+/g, "/");
|
|
651
|
+
const name = basename(saveTo);
|
|
652
|
+
const cwd = typeof process !== "undefined" && process.cwd ? process.cwd() : ".";
|
|
653
|
+
if (checkISPermission && checkISPermission(saveTo.length ? dirname(saveTo) : cwd, fs)) {
|
|
654
|
+
const dir = name.length < saveTo.length ? dirname(saveTo) : join(cwd, "download");
|
|
648
655
|
if (!fs.existsSync(dir)) {
|
|
649
656
|
fs.mkdirSync(dir, { recursive: true });
|
|
650
657
|
}
|
|
651
|
-
fileName =
|
|
658
|
+
fileName = join(dir, name);
|
|
652
659
|
config.fileName = fileName;
|
|
653
660
|
} else {
|
|
654
661
|
throw new Error(`Permission denied to save to ${saveTo}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rezo",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.30",
|
|
4
4
|
"description": "Lightning-fast, enterprise-grade HTTP client for modern JavaScript. Full HTTP/2 support, intelligent cookie management, multiple adapters (HTTP, Fetch, cURL, XHR), streaming, proxy support (HTTP/HTTPS/SOCKS), and cross-environment compatibility.",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|