mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 06:06:01 +00:00
improt into archive improvement
This commit is contained in:
@@ -1,11 +1,16 @@
|
||||
const path = require('path');
|
||||
const { archivedir, ensureDirectory } = require('../utility/directories');
|
||||
const fs = require('fs');
|
||||
const { archivedir } = require('../utility/directories');
|
||||
// const socket = require('../utility/socket');
|
||||
const jsonLinesWriter = require('./jsonLinesWriter');
|
||||
|
||||
function archiveWriter({ folderName, fileName }) {
|
||||
if (folderName == 'default') ensureDirectory(path.join(archivedir(), folderName));
|
||||
const jsonlFile = path.join(archivedir(), folderName, `${fileName}.jsonl`);
|
||||
const dir = path.join(archivedir(), folderName);
|
||||
if (!fs.existsSync(dir)) {
|
||||
console.log(`Creating directory ${dir}`);
|
||||
fs.mkdirSync(dir);
|
||||
}
|
||||
const jsonlFile = path.join(dir, `${fileName}.jsonl`);
|
||||
const res = jsonLinesWriter({ fileName: jsonlFile });
|
||||
// socket.emitChanged(`archive-files-changed-${folderName}`);
|
||||
return res;
|
||||
|
||||
Reference in New Issue
Block a user