Use fs-extra for move vs fs.rename(), start replace of mkdirp
This commit is contained in:
parent
38a96f53da
commit
8645cac892
|
@ -15,13 +15,13 @@ let Message = require('../message.js');
|
||||||
let moment = require('moment');
|
let moment = require('moment');
|
||||||
let _ = require('lodash');
|
let _ = require('lodash');
|
||||||
let paths = require('path');
|
let paths = require('path');
|
||||||
let mkdirp = require('mkdirp');
|
|
||||||
let async = require('async');
|
let async = require('async');
|
||||||
let fs = require('fs');
|
let fs = require('fs');
|
||||||
let later = require('later');
|
let later = require('later');
|
||||||
let temp = require('temp').track(); // track() cleans up temp dir/files for us
|
let temp = require('temp').track(); // track() cleans up temp dir/files for us
|
||||||
let assert = require('assert');
|
let assert = require('assert');
|
||||||
let gaze = require('gaze');
|
let gaze = require('gaze');
|
||||||
|
let fse = require('fs-extra');
|
||||||
|
|
||||||
exports.moduleInfo = {
|
exports.moduleInfo = {
|
||||||
name : 'FTN BSO',
|
name : 'FTN BSO',
|
||||||
|
@ -627,7 +627,7 @@ function FTNMessageScanTossModule() {
|
||||||
async.waterfall(
|
async.waterfall(
|
||||||
[
|
[
|
||||||
function createOutgoingDir(callback) {
|
function createOutgoingDir(callback) {
|
||||||
mkdirp(outgoingDir, err => {
|
fse.mkdirs(outgoingDir, err => {
|
||||||
callback(err);
|
callback(err);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -680,13 +680,13 @@ function FTNMessageScanTossModule() {
|
||||||
outgoingDir,
|
outgoingDir,
|
||||||
`${paths.basename(oldPath, 'pk_')}${ext}`);
|
`${paths.basename(oldPath, 'pk_')}${ext}`);
|
||||||
|
|
||||||
fs.rename(oldPath, newPath, nextFile);
|
fse.move(oldPath, newPath, nextFile);
|
||||||
} else {
|
} else {
|
||||||
const newPath = paths.join(outgoingDir, paths.basename(oldPath));
|
const newPath = paths.join(outgoingDir, paths.basename(oldPath));
|
||||||
fs.rename(oldPath, newPath, err => {
|
fse.move(oldPath, newPath, err => {
|
||||||
if(err) {
|
if(err) {
|
||||||
Log.warn(
|
Log.warn(
|
||||||
{ oldPath : oldPath, newPath : newPath },
|
{ oldPath : oldPath, newPath : newPath, error : err.toString() },
|
||||||
'Failed moving temporary bundle file!');
|
'Failed moving temporary bundle file!');
|
||||||
|
|
||||||
return nextFile();
|
return nextFile();
|
||||||
|
|
|
@ -30,7 +30,8 @@
|
||||||
"sqlite3": "^3.1.1",
|
"sqlite3": "^3.1.1",
|
||||||
"ssh2": "^0.4.13",
|
"ssh2": "^0.4.13",
|
||||||
"string-format": "davidchambers/string-format#mini-language",
|
"string-format": "davidchambers/string-format#mini-language",
|
||||||
"temp": "^0.8.3"
|
"temp": "^0.8.3",
|
||||||
|
"fs-extra" : "0.26.x"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.12.2"
|
"node": ">=0.12.2"
|
||||||
|
|
Loading…
Reference in New Issue