-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconstants.js
More file actions
60 lines (53 loc) · 2.03 KB
/
constants.js
File metadata and controls
60 lines (53 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
require('dotenv').config()
const path = require('path')
const fs = require('fs');
const SamplePath = path.join(__dirname, './Resources/SampleFiles')
const ImagesPath = path.join(__dirname, './Resources/SampleFiles/Images')
const FontsPath = path.join(__dirname, './Resources/Fonts')
const OutputPath = path.join(__dirname, 'testResults');
//exports = module.exports
module.exports = {
LicensePath: (process.env.PATH_TO_LICS + process.env.PRODUCT_LIC) || '',
SamplePath,
FontsPath,
InDocumentDocx: SamplePath + '/document.docx',
SampleDocx: SamplePath + '/sample.docx',
InDocumentPdf: SamplePath + '/document.pdf',
SamplePdf: SamplePath + '/sample.pdf',
InDiagramVsdx: SamplePath + '/diagram.vsdx',
InMessageMsg: SamplePath + '/test.msg',
SampleMsg: SamplePath + '/empty.msg',
ImageTiff: SamplePath + '/image.tiff',
InPresentationPptx: SamplePath + '/presentation.pptx',
InDocumentXlsx: SamplePath + '/sample.xlsx',
InSpreadsheetXlsx: SamplePath + '/document.xlsx',
SampleXlsx: SamplePath + '/sample.xlsx',
InProtectedDocumentDocx: SamplePath + '/protected-document.docx',
InSourceDocx: SamplePath + '/source.docx',
InImagePng: SamplePath + '/image.png',
ImageHandwrite : ImagesPath + '/signature_handwrite.jpg',
ImageStamp : ImagesPath + '/stamp.png',
LogoPng : ImagesPath + '/logo.png',
ProtectJpg: ImagesPath + '/protect.jpg',
WatermarkJpg: ImagesPath + '/watermark.jpg',
LogoJpg : ImagesPath + '/logo.jpg',
LogoBmp : ImagesPath + '/logo.bmp',
createOutputFilePath,
createOutputFolder
}
function createOutputFilePath(documentPath, outFolderName) {
const outputFolderPath = createOutputFolder(outFolderName);
const fileName = path.basename(documentPath);
const outputFilePath = path.join(outputFolderPath, fileName);
return outputFilePath;
}
function createOutputFolder(folderName) {
if (!fs.existsSync(OutputPath)) {
fs.mkdirSync(OutputPath);
}
const folderPath = path.join(OutputPath, folderName);
if (!fs.existsSync(folderPath)) {
fs.mkdirSync(folderPath);
}
return folderPath;
}