node-poppler 9.1.0 → 9.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-poppler",
3
- "version": "9.1.0",
3
+ "version": "9.1.1",
4
4
  "description": "Asynchronous Node.js wrapper for the Poppler PDF rendering library",
5
5
  "keywords": [
6
6
  "async",
package/src/index.js CHANGED
@@ -1311,7 +1311,7 @@ class Poppler {
1311
1311
  * @param {(Buffer|string)} file - PDF file as Buffer, or filepath of the PDF file to read.
1312
1312
  * @param {PdfInfoOptions} [options] - Options to pass to pdfinfo binary.
1313
1313
  * @param {PopplerExtraOptions} [extras] - Extra options.
1314
- * @returns {Promise<object|string>} A promise that resolves with a stdout string or JSON object if
1314
+ * @returns {Promise<Record<string, string>|string>} A promise that resolves with a stdout string or JSON object if
1315
1315
  * `options.printAsJson` is `true`, or rejects with an `Error` object.
1316
1316
  */
1317
1317
  async pdfInfo(file, options = {}, extras = {}) {
@@ -1371,6 +1371,7 @@ class Poppler {
1371
1371
  }
1372
1372
 
1373
1373
  if (options.printAsJson === true) {
1374
+ /** @type {Record<string, string>} */
1374
1375
  const info = {};
1375
1376
  const stdOutLines = stdOut.split("\n");
1376
1377
  const stdOutLinesLength = stdOutLines.length;
@@ -1378,7 +1379,6 @@ class Poppler {
1378
1379
  const line = stdOutLines[i];
1379
1380
  const lines = line.split(": ");
1380
1381
  if (lines.length > 1) {
1381
- // @ts-ignore: Creating dynamic object keys
1382
1382
  info[camelCase(lines[0])] = lines[1].trim();
1383
1383
  }
1384
1384
  }
package/types/index.d.ts CHANGED
@@ -1180,10 +1180,10 @@ export class Poppler {
1180
1180
  * @param {(Buffer|string)} file - PDF file as Buffer, or filepath of the PDF file to read.
1181
1181
  * @param {PdfInfoOptions} [options] - Options to pass to pdfinfo binary.
1182
1182
  * @param {PopplerExtraOptions} [extras] - Extra options.
1183
- * @returns {Promise<object|string>} A promise that resolves with a stdout string or JSON object if
1183
+ * @returns {Promise<Record<string, string>|string>} A promise that resolves with a stdout string or JSON object if
1184
1184
  * `options.printAsJson` is `true`, or rejects with an `Error` object.
1185
1185
  */
1186
- pdfInfo(file: (Buffer | string), options?: PdfInfoOptions, extras?: PopplerExtraOptions): Promise<object | string>;
1186
+ pdfInfo(file: (Buffer | string), options?: PdfInfoOptions, extras?: PopplerExtraOptions): Promise<Record<string, string> | string>;
1187
1187
  /**
1188
1188
  * @author Frazer Smith
1189
1189
  * @description Extracts single pages from a PDF file,