DOWNLOADFILEPATH : AADHAVAN

This commit is contained in:
aadhavan 2023-12-12 15:46:06 +05:30
parent 69bc96d7db
commit ae9e8fac90
3 changed files with 22 additions and 2 deletions

View File

@ -322,6 +322,8 @@ margin-left: -16px;
<script>
var configObject = convertBaseToString();
// configObject.DOWNLOAD_XML_FILE_PATH = homeDirectory+configObject.DOWNLOAD_XML_FILE_PATH;
console.log(configObject);
const Swal = require('sweetalert2');
@ -461,6 +463,7 @@ function validateFile(input) {
function downloadFile(filename) {
// console.log(xmlPath);
const xmlFilePath = `${xmlPath}${filename}`;
// console.log(xmlFilePath)
@ -478,8 +481,17 @@ var fileList = findFile(jsonFilePath);
// const downloadsPath = process.env.DOWNLOAD_XML_FILE_PATH;
// const downloadsPath = '/varr/www/html';
// const isEncrypted = process.env.ENCRYPTED;
const os = require('os')
var homeDirectory = os.homedir();
// console.log(configObject);
const downloadsPathTemp = configObject.DOWNLOAD_XML_FILE_PATH.trim();
const homeDir = require('os').homedir();
const downloadsPath = `${homeDir}/${downloadsPathTemp}`;
console.log(downloadsPath);
const downloadsPath = configObject.DOWNLOAD_XML_FILE_PATH.trim();
// console.log(downloadsPath,'downloadpath');
const isEncrypted = configObject.ENCRYPTED.trim();
@ -526,7 +538,8 @@ if(fileList !== false)
try {
const content = fs.readFileSync(xmlFilePath, 'utf-8');
console.log('xml', content);
// console.log('xml', content);
console.log(filePathToSave);
fs.writeFileSync(filePathToSave, content, 'utf-8');
Swal.fire({
title: "File Downloaded",

6
package-lock.json generated
View File

@ -35,6 +35,7 @@
"mathjax": "^3.2.2",
"mathjax-node": "^2.1.1",
"mathlive": "^0.95.5",
"os": "^0.1.2",
"quill": "^1.3.7",
"quill-better-table": "^1.1.0",
"quill-better-table-picker": "^1.0.2",
@ -3361,6 +3362,11 @@
"node": ">= 0.8.0"
}
},
"node_modules/os": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/os/-/os-0.1.2.tgz",
"integrity": "sha512-ZoXJkvAnljwvc56MbvhtKVWmSkzV712k42Is2mA0+0KTSRakq5XXuXpjZjgAt9ctzl51ojhQWakQQpmOvXWfjQ=="
},
"node_modules/p-any": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/p-any/-/p-any-4.0.0.tgz",

View File

@ -43,6 +43,7 @@
"mathjax": "^3.2.2",
"mathjax-node": "^2.1.1",
"mathlive": "^0.95.5",
"os": "^0.1.2",
"quill": "^1.3.7",
"quill-better-table": "^1.1.0",
"quill-better-table-picker": "^1.0.2",