ConvertDocX.js 764 B

12345678910111213141516171819202122232425262728293031
  1. const ConvertBase = require('./ConvertBase');
  2. class ConvertDocX extends ConvertBase {
  3. check(data, opts) {
  4. const {inputFiles} = opts;
  5. if (this.config.useExternalBookConverter &&
  6. inputFiles.sourceFileType && inputFiles.sourceFileType.ext == 'zip') {
  7. //ищем файл '[Content_Types].xml'
  8. for (const file of inputFiles.fileList) {
  9. if (file == '[Content_Types].xml') {
  10. return true;
  11. }
  12. }
  13. }
  14. return false;
  15. }
  16. async run(data, opts) {
  17. if (!this.check(data, opts))
  18. return false;
  19. await this.checkExternalConverterPresent();
  20. return false;
  21. }
  22. }
  23. module.exports = ConvertDocX;