libreoffice-convert 1.7.0 → 1.8.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/index.js +1 -1
- package/package.json +1 -1
- package/tests/convert.test.js +8 -1
package/index.js
CHANGED
|
@@ -72,7 +72,7 @@ const convertWithOptions = (document, format, filter, options, callback) => {
|
|
|
72
72
|
async.retry({
|
|
73
73
|
times: asyncOptions.times || 3,
|
|
74
74
|
interval: asyncOptions.interval || 200
|
|
75
|
-
}, (callback) => fs.readFile(path.join(tempDir.name, `${fileName}.${format.split(":")[0]}`), callback), callback)
|
|
75
|
+
}, (callback) => fs.readFile(path.join(tempDir.name, `${fileName.slice(0, fileName.length - path.extname(fileName).length)}.${format.split(":")[0]}`), callback), callback)
|
|
76
76
|
]
|
|
77
77
|
}).then( (res) => {
|
|
78
78
|
return callback(null, res.loadDestination);
|
package/package.json
CHANGED
package/tests/convert.test.js
CHANGED
|
@@ -2,7 +2,8 @@ var _jest = require('jest'),
|
|
|
2
2
|
_fs = require('fs'),
|
|
3
3
|
_path = require('path'),
|
|
4
4
|
{ exec } = require('child_process'),
|
|
5
|
-
convert = require('../index').convert
|
|
5
|
+
convert = require('../index').convert
|
|
6
|
+
convertWithOptions = require('../index').convertWithOptions;
|
|
6
7
|
|
|
7
8
|
describe('convert', () => {
|
|
8
9
|
function expectHello(done) {
|
|
@@ -22,6 +23,12 @@ describe('convert', () => {
|
|
|
22
23
|
});
|
|
23
24
|
|
|
24
25
|
|
|
26
|
+
it('should convert a word document to text with options', (done) => {
|
|
27
|
+
const docx = _fs.readFileSync(_path.join(__dirname, '/resources/hello.docx'));
|
|
28
|
+
convertWithOptions(docx, 'txt', undefined, { fileName: 'hello.docx' }, expectHello(done));
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
|
|
25
32
|
it('if an another instance of soffice exists, should convert a word document to text', (done) => {
|
|
26
33
|
exec("soffice --headless")
|
|
27
34
|
// this command create an instance of soffice. This instance will get a failure "Error: source file could not be loaded"
|