libreoffice-convert 1.3.5 → 1.3.8

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.
Files changed (3) hide show
  1. package/index.d.ts +19 -0
  2. package/index.js +2 -1
  3. package/package.json +5 -3
package/index.d.ts ADDED
@@ -0,0 +1,19 @@
1
+ /// <reference types="node" />
2
+ declare module "libreoffice-convert" {
3
+ function convert(
4
+ document: Buffer,
5
+ format: string,
6
+ filter: string | undefined,
7
+ callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void
8
+ ): void;
9
+ function convertWithOptions(
10
+ document: Buffer,
11
+ format: string,
12
+ filter: string | undefined,
13
+ options: {
14
+ tmpOptions?: Record<string | number | symbol, unknown>;
15
+ asyncOptions?: { times?: number; interval?: number };
16
+ },
17
+ callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void
18
+ ): void;
19
+ }
package/index.js CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  const fs = require('fs');
4
4
  const path = require('path');
5
+ const url = require('url');
5
6
  const async = require('async');
6
7
  const tmp = require('tmp');
7
8
  const { execFile } = require('child_process');
@@ -43,7 +44,7 @@ const convertWithOptions = (document, format, filter, options, callback) => {
43
44
  },
44
45
  saveSource: callback => fs.writeFile(path.join(tempDir.name, 'source'), document, callback),
45
46
  convert: ['soffice', 'saveSource', (results, callback) => {
46
- let command = `-env:UserInstallation=file://${installDir.name} --headless --convert-to ${format}`;
47
+ let command = `-env:UserInstallation=${url.pathToFileURL(installDir.name)} --headless --convert-to ${format}`;
47
48
  if (filter !== undefined) {
48
49
  command += `:"${filter}"`;
49
50
  }
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "libreoffice-convert",
3
- "version": "1.3.5",
3
+ "version": "1.3.8",
4
4
  "description": "A simple and fast node.js module for converting office documents to different formats",
5
5
  "main": "index.js",
6
+ "types": "index.d.ts",
6
7
  "repository": "https://github.com/elwerene/libreoffice-convert",
7
8
  "keywords": [
8
9
  "Libreoffice",
@@ -23,11 +24,12 @@
23
24
  ],
24
25
  "license": "MIT",
25
26
  "dependencies": {
26
- "async": "^2.6.2",
27
+ "async": "^3.2.3",
27
28
  "tmp": "^0.2.1"
28
29
  },
29
30
  "devDependencies": {
30
- "jest": "^24.7.1"
31
+ "@types/node": "^17.0.23",
32
+ "jest": "^27.5.1"
31
33
  },
32
34
  "engines": {
33
35
  "node": ">=6"