|
@@ -181,7 +181,11 @@ async function downloadUrl(url,options) {
|
|
let fileDir = path.dirname(filepath);
|
|
let fileDir = path.dirname(filepath);
|
|
let abc = String.fromCharCode(96+(index+1)); // 字母顺序不会出现 把 1 10 11 12 放在一起的情况
|
|
let abc = String.fromCharCode(96+(index+1)); // 字母顺序不会出现 把 1 10 11 12 放在一起的情况
|
|
let num = index+110; // 数字顺序从百位开始,避免首数字排序错乱
|
|
let num = index+110; // 数字顺序从百位开始,避免首数字排序错乱
|
|
- let fileName = num + "_" + path.basename(filepath)
|
|
|
|
|
|
+
|
|
|
|
+ let md5 = crypto.createHash('md5');
|
|
|
|
+ let outmd5 = md5.update(path.basename(filepath)).digest('hex');
|
|
|
|
+ let fileName = num + "_" + outmd5 + path.extname(filepath);
|
|
|
|
+
|
|
let orderPath = path.join(fileDir,fileName)
|
|
let orderPath = path.join(fileDir,fileName)
|
|
fs.cpSync(filepath,orderPath);
|
|
fs.cpSync(filepath,orderPath);
|
|
fs.readFileSync(filepath);
|
|
fs.readFileSync(filepath);
|
|
@@ -241,7 +245,9 @@ async function downloadUrl(url,options) {
|
|
convertOpts.files = [files[0]];
|
|
convertOpts.files = [files[0]];
|
|
console.log(convertOpts)
|
|
console.log(convertOpts)
|
|
let mainPdfBuffer = await LibreOffice.convert(convertOpts);
|
|
let mainPdfBuffer = await LibreOffice.convert(convertOpts);
|
|
- mainPdfPath = path.dirname(docxPath)+"/109_"+path.basename(docxPath)+".pdf"
|
|
|
|
|
|
+ let md5 = crypto.createHash('md5');
|
|
|
|
+ let outmd5 = md5.update(path.basename(docxPath)).digest('hex');
|
|
|
|
+ mainPdfPath = path.dirname(docxPath)+"/109_"+outmd5+".pdf"
|
|
fs.writeFileSync(mainPdfPath,mainPdfBuffer)
|
|
fs.writeFileSync(mainPdfPath,mainPdfBuffer)
|
|
}
|
|
}
|
|
|
|
|