urllib 3.14.1 → 3.16.0

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/README.md CHANGED
@@ -75,6 +75,7 @@ console.log('status: %s, body size: %d, headers: %j', res.status, data.length, r
75
75
  - ***compressed*** Boolean - Accept `gzip, br` response content and auto decode it, default is `false`.
76
76
  - ***timing*** Boolean - Enable timing or not, default is `false`.
77
77
  - ***socketPath*** String | null - request a unix socket service, default is `null`.
78
+ - ***highWaterMark*** Number - default is `67108864`, 64 KiB.
78
79
 
79
80
  #### Options: `options.data`
80
81
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "urllib",
3
- "version": "3.14.1",
3
+ "version": "3.16.0",
4
4
  "publishConfig": {
5
5
  "tag": "latest"
6
6
  },
@@ -42,10 +42,12 @@
42
42
  },
43
43
  "scripts": {
44
44
  "lint": "eslint src test --ext .ts --cache",
45
- "build": "npm run clean && npm run build:dist",
45
+ "prebuild": "npm run clean",
46
+ "build": "tsc --version && npm run build:cjs && npm run build:esm && npm run build:version",
47
+ "postbuild": "rm -rf src/*.tsbuildinfo",
46
48
  "build:cjs": "tsc -p ./tsconfig.build.cjs.json",
47
49
  "build:esm": "tsc -p ./tsconfig.build.esm.json && node ./scripts/esm_import_fix.js",
48
- "build:dist": "tsc --version && npm run build:cjs && npm run build:esm",
50
+ "build:version": "node ./scripts/replace_urllib_version.js",
49
51
  "build:cjs:test": "cd test/cjs && rm -rf node_modules && npm link ../.. && node index.js",
50
52
  "build:esm:test": "cd test/esm && rm -rf node_modules && npm link ../.. && node index.js",
51
53
  "build:test": "npm run build && npm run build:cjs:test && npm run build:esm:test && npm run test-tsc",
@@ -55,7 +57,7 @@
55
57
  "ci": "npm run lint && npm run cov && npm run build:test",
56
58
  "contributor": "git-contributor",
57
59
  "clean": "rm -rf src/*.tsbuildinfo src/cjs/*.ts src/cjs/*.js src/esm/*.ts src/esm/*.js",
58
- "prepack": "npm run build && rm -rf src/*.tsbuildinfo"
60
+ "prepublishOnly": "npm run build"
59
61
  },
60
62
  "dependencies": {
61
63
  "default-user-agent": "^1.0.0",
@@ -71,7 +73,7 @@
71
73
  "@types/busboy": "^1.5.0",
72
74
  "@types/default-user-agent": "^1.0.0",
73
75
  "@types/mime-types": "^2.1.1",
74
- "@types/node": "^18.11.18",
76
+ "@types/node": "^20.2.1",
75
77
  "@types/pump": "^1.1.1",
76
78
  "@types/selfsigned": "^2.0.1",
77
79
  "@types/tar-stream": "^2.2.2",
package/src/HttpClient.ts CHANGED
@@ -121,7 +121,7 @@ class HttpClientRequestTimeoutError extends Error {
121
121
  }
122
122
  }
123
123
 
124
- export const HEADER_USER_AGENT = createUserAgent('node-urllib', '3.0.0');
124
+ export const HEADER_USER_AGENT = createUserAgent('node-urllib', 'VERSION');
125
125
 
126
126
  function getFileName(stream: Readable) {
127
127
  const filePath: string = (stream as any).path;
@@ -316,10 +316,12 @@ export class HttpClient extends EventEmitter {
316
316
  opaque: internalOpaque,
317
317
  dispatcher: args.dispatcher ?? this.#dispatcher,
318
318
  };
319
+ if (typeof args.highWaterMark === 'number') {
320
+ requestOptions.highWaterMark = args.highWaterMark;
321
+ }
319
322
  if (typeof args.reset === 'boolean') {
320
323
  requestOptions.reset = args.reset;
321
324
  }
322
-
323
325
  if (args.followRedirect === false) {
324
326
  requestOptions.maxRedirections = 0;
325
327
  }
package/src/Request.ts CHANGED
@@ -125,11 +125,12 @@ export type RequestOptions = {
125
125
  * request dispatcher, default is getGlobalDispatcher()
126
126
  */
127
127
  dispatcher?: Dispatcher;
128
-
129
128
  /**
130
129
  * unix domain socket file path
131
130
  */
132
131
  socketPath?: string | null;
133
132
  /** Whether the request should stablish a keep-alive or not. Default `undefined` */
134
133
  reset?: boolean;
134
+ /** Default: `64 KiB` */
135
+ highWaterMark?: number;
135
136
  };
@@ -69,7 +69,7 @@ class HttpClientRequestTimeoutError extends Error {
69
69
  Error.captureStackTrace(this, this.constructor);
70
70
  }
71
71
  }
72
- exports.HEADER_USER_AGENT = (0, default_user_agent_1.default)('node-urllib', '3.0.0');
72
+ exports.HEADER_USER_AGENT = (0, default_user_agent_1.default)('node-urllib', '3.16.0');
73
73
  function getFileName(stream) {
74
74
  const filePath = stream.path;
75
75
  if (filePath) {
@@ -253,6 +253,9 @@ class HttpClient extends node_events_1.EventEmitter {
253
253
  opaque: internalOpaque,
254
254
  dispatcher: args.dispatcher ?? this.#dispatcher,
255
255
  };
256
+ if (typeof args.highWaterMark === 'number') {
257
+ requestOptions.highWaterMark = args.highWaterMark;
258
+ }
256
259
  if (typeof args.reset === 'boolean') {
257
260
  requestOptions.reset = args.reset;
258
261
  }
@@ -129,4 +129,6 @@ export type RequestOptions = {
129
129
  socketPath?: string | null;
130
130
  /** Whether the request should stablish a keep-alive or not. Default `undefined` */
131
131
  reset?: boolean;
132
+ /** Default: `64 KiB` */
133
+ highWaterMark?: number;
132
134
  };
@@ -63,7 +63,7 @@ class HttpClientRequestTimeoutError extends Error {
63
63
  Error.captureStackTrace(this, this.constructor);
64
64
  }
65
65
  }
66
- export const HEADER_USER_AGENT = createUserAgent('node-urllib', '3.0.0');
66
+ export const HEADER_USER_AGENT = createUserAgent('node-urllib', '3.16.0');
67
67
  function getFileName(stream) {
68
68
  const filePath = stream.path;
69
69
  if (filePath) {
@@ -247,6 +247,9 @@ export class HttpClient extends EventEmitter {
247
247
  opaque: internalOpaque,
248
248
  dispatcher: args.dispatcher ?? this.#dispatcher,
249
249
  };
250
+ if (typeof args.highWaterMark === 'number') {
251
+ requestOptions.highWaterMark = args.highWaterMark;
252
+ }
250
253
  if (typeof args.reset === 'boolean') {
251
254
  requestOptions.reset = args.reset;
252
255
  }
@@ -129,4 +129,6 @@ export type RequestOptions = {
129
129
  socketPath?: string | null;
130
130
  /** Whether the request should stablish a keep-alive or not. Default `undefined` */
131
131
  reset?: boolean;
132
+ /** Default: `64 KiB` */
133
+ highWaterMark?: number;
132
134
  };