@nxtedition/nxt-undici 7.1.2 → 7.1.3

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.
@@ -28,9 +28,17 @@ class FactoryStream extends Readable {
28
28
 
29
29
  if (this.#body != null) {
30
30
  this.#body
31
- .on('readable', () => this._read())
32
- .on('end', () => this.push(null))
33
- .on('error', (err) => this.destroy(err))
31
+ .on('data', (data) => {
32
+ if (!this.push(data)) {
33
+ this.pause()
34
+ }
35
+ })
36
+ .on('end', () => {
37
+ this.push(null)
38
+ })
39
+ .on('error', (err) => {
40
+ this.destroy(err)
41
+ })
34
42
  }
35
43
 
36
44
  callback(null)
@@ -43,10 +51,7 @@ class FactoryStream extends Readable {
43
51
  }
44
52
 
45
53
  _read() {
46
- const chunk = this.#body?.read()
47
- if (chunk !== null) {
48
- this.push(chunk)
49
- }
54
+ this.resume()
50
55
  }
51
56
 
52
57
  _destroy(err, callback) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/nxt-undici",
3
- "version": "7.1.2",
3
+ "version": "7.1.3",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "main": "lib/index.js",