Начата переделка FileDecompressor - отказ от использования багнутого пакета decompress
This commit is contained in:
@@ -18,13 +18,13 @@ class ConvertDoc extends ConvertDocX {
|
||||
|
||||
const {inputFiles, callback} = opts;
|
||||
|
||||
const outFile = `${inputFiles.fileListDir}/${path.basename(inputFiles.sourceFile)}`;
|
||||
const outFile = `${inputFiles.filesDir}/${path.basename(inputFiles.sourceFile)}`;
|
||||
const docFile = `${outFile}.doc`;
|
||||
const docxFile = `${outFile}.docx`;
|
||||
const fb2File = `${outFile}.fb2`;
|
||||
|
||||
await fs.copy(inputFiles.sourceFile, docFile);
|
||||
await this.execConverter(this.sofficePath, ['--headless', '--convert-to', 'docx', '--outdir', inputFiles.fileListDir, docFile]);
|
||||
await this.execConverter(this.sofficePath, ['--headless', '--convert-to', 'docx', '--outdir', inputFiles.filesDir, docFile]);
|
||||
|
||||
return await super.convert(docxFile, fb2File, callback);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ class ConvertDocX extends ConvertBase {
|
||||
if (this.config.useExternalBookConverter &&
|
||||
inputFiles.sourceFileType && inputFiles.sourceFileType.ext == 'zip') {
|
||||
//ищем файл '[Content_Types].xml'
|
||||
for (const file of inputFiles.fileList) {
|
||||
for (const file of inputFiles.files) {
|
||||
if (file == '[Content_Types].xml') {
|
||||
return true;
|
||||
}
|
||||
@@ -37,7 +37,7 @@ class ConvertDocX extends ConvertBase {
|
||||
|
||||
const {inputFiles, callback} = opts;
|
||||
|
||||
const outFile = `${inputFiles.fileListDir}/${path.basename(inputFiles.sourceFile)}`;
|
||||
const outFile = `${inputFiles.filesDir}/${path.basename(inputFiles.sourceFile)}`;
|
||||
const docxFile = `${outFile}.docx`;
|
||||
const fb2File = `${outFile}.fb2`;
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ class ConvertPdf extends ConvertHtml {
|
||||
|
||||
const {inputFiles, callback} = opts;
|
||||
|
||||
const outFile = `${inputFiles.fileListDir}/${utils.randomHexString(10)}.xml`;
|
||||
const outFile = `${inputFiles.filesDir}/${utils.randomHexString(10)}.xml`;
|
||||
|
||||
//конвертируем в xml
|
||||
let perc = 0;
|
||||
|
||||
@@ -18,13 +18,13 @@ class ConvertRtf extends ConvertDocX {
|
||||
|
||||
const {inputFiles, callback} = opts;
|
||||
|
||||
const outFile = `${inputFiles.fileListDir}/${path.basename(inputFiles.sourceFile)}`;
|
||||
const outFile = `${inputFiles.filesDir}/${path.basename(inputFiles.sourceFile)}`;
|
||||
const rtfFile = `${outFile}.rtf`;
|
||||
const docxFile = `${outFile}.docx`;
|
||||
const fb2File = `${outFile}.fb2`;
|
||||
|
||||
await fs.copy(inputFiles.sourceFile, rtfFile);
|
||||
await this.execConverter(this.sofficePath, ['--headless', '--convert-to', 'docx', '--outdir', inputFiles.fileListDir, rtfFile]);
|
||||
await this.execConverter(this.sofficePath, ['--headless', '--convert-to', 'docx', '--outdir', inputFiles.filesDir, rtfFile]);
|
||||
|
||||
return await super.convert(docxFile, fb2File, callback);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user