From 8645cac892760382a3dc9ee0de177a77bedecf0a Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Sun, 27 Mar 2016 23:19:18 -0600 Subject: [PATCH] Use fs-extra for move vs fs.rename(), start replace of mkdirp --- core/scanner_tossers/ftn_bso.js | 10 +++++----- package.json | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/core/scanner_tossers/ftn_bso.js b/core/scanner_tossers/ftn_bso.js index 2582c279..18ef9f45 100644 --- a/core/scanner_tossers/ftn_bso.js +++ b/core/scanner_tossers/ftn_bso.js @@ -15,13 +15,13 @@ let Message = require('../message.js'); let moment = require('moment'); let _ = require('lodash'); let paths = require('path'); -let mkdirp = require('mkdirp'); let async = require('async'); let fs = require('fs'); let later = require('later'); let temp = require('temp').track(); // track() cleans up temp dir/files for us let assert = require('assert'); let gaze = require('gaze'); +let fse = require('fs-extra'); exports.moduleInfo = { name : 'FTN BSO', @@ -627,7 +627,7 @@ function FTNMessageScanTossModule() { async.waterfall( [ function createOutgoingDir(callback) { - mkdirp(outgoingDir, err => { + fse.mkdirs(outgoingDir, err => { callback(err); }); }, @@ -680,13 +680,13 @@ function FTNMessageScanTossModule() { outgoingDir, `${paths.basename(oldPath, 'pk_')}${ext}`); - fs.rename(oldPath, newPath, nextFile); + fse.move(oldPath, newPath, nextFile); } else { const newPath = paths.join(outgoingDir, paths.basename(oldPath)); - fs.rename(oldPath, newPath, err => { + fse.move(oldPath, newPath, err => { if(err) { Log.warn( - { oldPath : oldPath, newPath : newPath }, + { oldPath : oldPath, newPath : newPath, error : err.toString() }, 'Failed moving temporary bundle file!'); return nextFile(); diff --git a/package.json b/package.json index 0d1389ff..244bcaf5 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,8 @@ "sqlite3": "^3.1.1", "ssh2": "^0.4.13", "string-format": "davidchambers/string-format#mini-language", - "temp": "^0.8.3" + "temp": "^0.8.3", + "fs-extra" : "0.26.x" }, "engines": { "node": ">=0.12.2"