Merge pull request #46 from pierotofy/rename

Replaced fs.rename with mv
pull/48/head
Piero Toffanin 2018-09-12 16:34:10 -04:00 zatwierdzone przez GitHub
commit da151f013c
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
2 zmienionych plików z 10 dodań i 8 usunięć

Wyświetl plik

@ -40,6 +40,7 @@ let odmOptions = require('./libs/odmOptions');
let Directories = require('./libs/Directories'); let Directories = require('./libs/Directories');
let unzip = require('node-unzip-2'); let unzip = require('node-unzip-2');
let si = require('systeminformation'); let si = require('systeminformation');
let mv = require('mv');
let auth = require('./libs/auth/factory').fromConfig(config); let auth = require('./libs/auth/factory').fromConfig(config);
const authCheck = auth.getMiddleware(); const authCheck = auth.getMiddleware();
@ -197,7 +198,7 @@ app.post('/task/new', authCheck, addRequestId, upload.array('images'), (req, res
cb => fs.mkdir(destPath, undefined, cb), cb => fs.mkdir(destPath, undefined, cb),
cb => fs.mkdir(destGpcPath, undefined, cb), cb => fs.mkdir(destGpcPath, undefined, cb),
cb => fs.rename(srcPath, destImagesPath, cb), cb => mv(srcPath, destImagesPath, cb),
cb => { cb => {
@ -233,7 +234,7 @@ app.post('/task/new', authCheck, addRequestId, upload.array('images'), (req, res
else { else {
async.eachSeries(entries, (entry, cb) => { async.eachSeries(entries, (entry, cb) => {
if (/\.txt$/gi.test(entry)) { if (/\.txt$/gi.test(entry)) {
fs.rename(path.join(destImagesPath, entry), path.join(destGpcPath, entry), cb); mv(path.join(destImagesPath, entry), path.join(destGpcPath, entry), cb);
}else if (/\.zip$/gi.test(entry)){ }else if (/\.zip$/gi.test(entry)){
fs.unlink(path.join(destImagesPath, entry), cb); fs.unlink(path.join(destImagesPath, entry), cb);
} else cb(); } else cb();

Wyświetl plik

@ -22,17 +22,18 @@
"dependencies": { "dependencies": {
"archiver": "^1.0.0", "archiver": "^1.0.0",
"async": "^2.0.0-rc.6", "async": "^2.0.0-rc.6",
"body-parser": "^1.15.2", "body-parser": "^1.18.3",
"express": "^4.14.0", "express": "^4.16.3",
"glob": "^7.1.1", "glob": "^7.1.1",
"mime": "^1.3.4", "mime": "^1.3.4",
"minimist": "^1.2.0", "minimist": "^1.2.0",
"morgan": "^1.7.0", "morgan": "^1.9.1",
"multer": "^1.1.0", "multer": "^1.1.0",
"mv": "^2.1.1",
"node-schedule": "^1.1.1", "node-schedule": "^1.1.1",
"node-unzip-2": "^0.2.7", "node-unzip-2": "^0.2.7",
"node-uuid": "^1.4.7", "node-uuid": "^1.4.7",
"request": "^2.81.0", "request": "^2.88.0",
"rimraf": "^2.5.3", "rimraf": "^2.5.3",
"swagger-jsdoc": "^1.3.1", "swagger-jsdoc": "^1.3.1",
"systeminformation": "^3.42.0", "systeminformation": "^3.42.0",
@ -40,9 +41,9 @@
"winston": "^2.2.0" "winston": "^2.2.0"
}, },
"devDependencies": { "devDependencies": {
"grunt": "^1.0.1", "grunt": "^1.0.3",
"grunt-contrib-jshint": "^1.0.0", "grunt-contrib-jshint": "^1.0.0",
"nodemon": "^1.9.2", "nodemon": "^1.18.4",
"time-grunt": "^1.4.0" "time-grunt": "^1.4.0"
} }
} }