mindee 4.36.2 → 4.36.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## v4.36.3 - 2026-01-20
4
+ ### Fixes
5
+ * :bug: fix streams not loading properly
6
+
7
+
3
8
  ## v4.36.2 - 2026-01-05
4
9
  ### Changes
5
10
  * :wastebasket: deprecate docFromXxx methods
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mindee",
3
- "version": "4.36.2",
3
+ "version": "4.36.3",
4
4
  "description": "Mindee Client Library for Node.js",
5
5
  "main": "src/index.js",
6
6
  "bin": "bin/mindee.js",
@@ -11,7 +11,7 @@
11
11
  "clean": "rm -rf ./dist ./docs/_build",
12
12
  "test": "mocha \"tests/**/*.spec.ts\" --config .mocharc.json",
13
13
  "test-integration": "mocha \"tests/**/*.integration.ts\"",
14
- "lint": "eslint './src/**/*.ts' --report-unused-disable-directives && echo 'Your .ts files look good.'",
14
+ "lint": "eslint './src/**/*.ts' --report-unused-disable-directives && echo 'Your .ts files look good.'",
15
15
  "lint-fix": "eslint './src/**/*.ts' --fix",
16
16
  "docs": "typedoc --out docs/_build ./src/index.ts",
17
17
  "docs-for-dist": "typedoc --out docs/_build ./src/index.ts && cp -r ./docs/code_samples ./docs/_build/"
@@ -40,20 +40,20 @@
40
40
  },
41
41
  "homepage": "https://mindee.com/",
42
42
  "devDependencies": {
43
- "@types/chai": "^4.3.20",
43
+ "@types/chai": "^5.2.3",
44
44
  "@types/mocha": "^10.0.10",
45
- "@types/node": "^18.15.13",
45
+ "@types/node": "^18.19.130",
46
46
  "@types/tmp": "^0.2.6",
47
- "@typescript-eslint/eslint-plugin": "^8.42.1",
48
- "@typescript-eslint/parser": "^8.42.1",
49
- "chai": "^4.4.1",
47
+ "@typescript-eslint/eslint-plugin": "^8.52.0",
48
+ "@typescript-eslint/parser": "^8.52.0",
49
+ "chai": "^4.5.0",
50
50
  "eslint": "^9.20.1",
51
51
  "eslint-plugin-jsdoc": "^50.6.17",
52
- "mocha": "^11.7.4",
52
+ "mocha": "^11.7.5",
53
53
  "nock": "^13.5.6",
54
54
  "ts-node": "^10.9.2",
55
- "typedoc": "~0.28.14",
56
- "typescript": "^5.7.3"
55
+ "typedoc": "~0.28.15",
56
+ "typescript": "^5.9.3"
57
57
  },
58
58
  "dependencies": {
59
59
  "@cantoo/pdf-lib": "^2.3.2",
@@ -4,6 +4,7 @@ exports.StreamInput = void 0;
4
4
  const localInputSource_1 = require("./localInputSource");
5
5
  const inputSource_1 = require("./inputSource");
6
6
  const logger_1 = require("../../logger");
7
+ const errors_1 = require("../../errors");
7
8
  class StreamInput extends localInputSource_1.LocalInputSource {
8
9
  constructor({ inputStream, filename }) {
9
10
  super({
@@ -24,10 +25,15 @@ class StreamInput extends localInputSource_1.LocalInputSource {
24
25
  }
25
26
  async stream2buffer(stream) {
26
27
  return new Promise((resolve, reject) => {
27
- const _buf = Array();
28
+ if (stream.closed || stream.destroyed) {
29
+ return reject(new errors_1.MindeeError("Stream is already closed"));
30
+ }
31
+ const _buf = [];
32
+ stream.pause();
28
33
  stream.on("data", (chunk) => _buf.push(chunk));
29
34
  stream.on("end", () => resolve(Buffer.concat(_buf)));
30
- stream.on("error", (err) => reject(`Error converting stream - ${err}`));
35
+ stream.on("error", (err) => reject(new Error(`Error converting stream - ${err}`)));
36
+ stream.resume();
31
37
  });
32
38
  }
33
39
  }