From 019596d709523f3b50c079ba1c596f2a63d88e04 Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Fri, 19 May 2017 21:20:19 -0600 Subject: [PATCH] Convert to using graceful-fs vs vanilla fs module --- core/archive_util.js | 2 +- core/art.js | 2 +- core/bbs.js | 2 +- core/config.js | 2 +- core/config_cache.js | 2 +- core/dropfile.js | 2 +- core/file_area_web.js | 2 +- core/file_base_area.js | 2 +- core/file_transfer.js | 2 +- core/ftn_mail_packet.js | 2 +- core/logger.js | 2 +- core/module_util.js | 2 +- core/multi_line_edit_text_view.js | 2 +- core/oputil/oputil_config.js | 2 +- core/oputil/oputil_file_base.js | 2 +- core/scanner_tossers/ftn_bso.js | 2 +- core/servers/content/web.js | 2 +- core/servers/login/ssh.js | 2 +- core/string_util.js | 2 +- core/system_view_validate.js | 2 +- core/theme.js | 2 +- core/tic_file_info.js | 2 +- core/web_password_reset.js | 2 +- core/word_wrap.js | 2 +- package.json | 3 ++- util/exiftool2desc.js | 2 +- 26 files changed, 27 insertions(+), 26 deletions(-) diff --git a/core/archive_util.js b/core/archive_util.js index 0d4ae05c..6d2644c8 100644 --- a/core/archive_util.js +++ b/core/archive_util.js @@ -8,7 +8,7 @@ const Errors = require('./enig_error.js').Errors; const resolveMimeType = require('./mime_util.js').resolveMimeType; // base/modules -const fs = require('fs'); +const fs = require('graceful-fs'); const _ = require('lodash'); const pty = require('ptyw.js'); diff --git a/core/art.js b/core/art.js index 3d3febe1..b07665a7 100644 --- a/core/art.js +++ b/core/art.js @@ -9,7 +9,7 @@ const aep = require('./ansi_escape_parser.js'); const sauce = require('./sauce.js'); // deps -const fs = require('fs'); +const fs = require('graceful-fs'); const paths = require('path'); const assert = require('assert'); const iconv = require('iconv-lite'); diff --git a/core/bbs.js b/core/bbs.js index f2ab58ba..ea351480 100644 --- a/core/bbs.js +++ b/core/bbs.js @@ -17,7 +17,7 @@ const async = require('async'); const util = require('util'); const _ = require('lodash'); const mkdirs = require('fs-extra').mkdirs; -const fs = require('fs'); +const fs = require('graceful-fs'); const paths = require('path'); // our main entry point diff --git a/core/config.js b/core/config.js index 06b95124..148c9aa0 100644 --- a/core/config.js +++ b/core/config.js @@ -5,7 +5,7 @@ const miscUtil = require('./misc_util.js'); // deps -const fs = require('fs'); +const fs = require('graceful-fs'); const paths = require('path'); const async = require('async'); const _ = require('lodash'); diff --git a/core/config_cache.js b/core/config_cache.js index fa80c19d..9df08316 100644 --- a/core/config_cache.js +++ b/core/config_cache.js @@ -5,7 +5,7 @@ var Config = require('./config.js').config; var Log = require('./logger.js').log; var paths = require('path'); -var fs = require('fs'); +var fs = require('graceful-fs'); var Gaze = require('gaze').Gaze; var events = require('events'); var util = require('util'); diff --git a/core/dropfile.js b/core/dropfile.js index 517bc36e..20c027e3 100644 --- a/core/dropfile.js +++ b/core/dropfile.js @@ -4,7 +4,7 @@ var Config = require('./config.js').config; const StatLog = require('./stat_log.js'); -var fs = require('fs'); +var fs = require('graceful-fs'); var paths = require('path'); var _ = require('lodash'); var moment = require('moment'); diff --git a/core/file_area_web.js b/core/file_area_web.js index 061af055..b4d93d81 100644 --- a/core/file_area_web.js +++ b/core/file_area_web.js @@ -20,7 +20,7 @@ const hashids = require('hashids'); const moment = require('moment'); const paths = require('path'); const async = require('async'); -const fs = require('fs'); +const fs = require('graceful-fs'); const mimeTypes = require('mime-types'); const _ = require('lodash'); diff --git a/core/file_base_area.js b/core/file_base_area.js index 9ad03023..7fb123d4 100644 --- a/core/file_base_area.js +++ b/core/file_base_area.js @@ -17,7 +17,7 @@ const wordWrapText = require('./word_wrap.js').wordWrapText; // deps const _ = require('lodash'); const async = require('async'); -const fs = require('fs'); +const fs = require('graceful-fs'); const crypto = require('crypto'); const paths = require('path'); const temptmp = require('temptmp').createTrackedSession('file_area'); diff --git a/core/file_transfer.js b/core/file_transfer.js index 9735abe7..4e81bf72 100644 --- a/core/file_transfer.js +++ b/core/file_transfer.js @@ -17,7 +17,7 @@ const _ = require('lodash'); const pty = require('ptyw.js'); const temptmp = require('temptmp').createTrackedSession('transfer_file'); const paths = require('path'); -const fs = require('fs'); +const fs = require('graceful-fs'); const fse = require('fs-extra'); // some consts diff --git a/core/ftn_mail_packet.js b/core/ftn_mail_packet.js index 86609d5b..5e0bf581 100644 --- a/core/ftn_mail_packet.js +++ b/core/ftn_mail_packet.js @@ -11,7 +11,7 @@ const Log = require('./logger.js').log; const _ = require('lodash'); const assert = require('assert'); const binary = require('binary'); -const fs = require('fs'); +const fs = require('graceful-fs'); const async = require('async'); const iconv = require('iconv-lite'); const moment = require('moment'); diff --git a/core/logger.js b/core/logger.js index 0d71a2fe..9ea283fd 100644 --- a/core/logger.js +++ b/core/logger.js @@ -4,7 +4,7 @@ // deps const bunyan = require('bunyan'); const paths = require('path'); -const fs = require('fs'); +const fs = require('graceful-fs'); const _ = require('lodash'); module.exports = class Log { diff --git a/core/module_util.js b/core/module_util.js index 3e51207c..1cd4bed3 100644 --- a/core/module_util.js +++ b/core/module_util.js @@ -5,7 +5,7 @@ const Config = require('./config.js').config; // deps -const fs = require('fs'); +const fs = require('graceful-fs'); const paths = require('path'); const _ = require('lodash'); const assert = require('assert'); diff --git a/core/multi_line_edit_text_view.js b/core/multi_line_edit_text_view.js index 532c8acf..94bd2f77 100644 --- a/core/multi_line_edit_text_view.js +++ b/core/multi_line_edit_text_view.js @@ -996,7 +996,7 @@ MultiLineEditTextView.prototype.setFocus = function(focused) { }; MultiLineEditTextView.prototype.setText = function(text) { - //text = require('fs').readFileSync('/home/nuskooler/Downloads/test_text.txt', { encoding : 'utf-8'}); + //text = require('graceful-fs').readFileSync('/home/nuskooler/Downloads/test_text.txt', { encoding : 'utf-8'}); this.textLines = [ ]; this.addText(text); diff --git a/core/oputil/oputil_config.js b/core/oputil/oputil_config.js index dc918917..4d1eb54b 100644 --- a/core/oputil/oputil_config.js +++ b/core/oputil/oputil_config.js @@ -16,7 +16,7 @@ const Errors = require('../../core/enig_error.js').Errors; const async = require('async'); const inq = require('inquirer'); const mkdirsSync = require('fs-extra').mkdirsSync; -const fs = require('fs'); +const fs = require('graceful-fs'); const hjson = require('hjson'); const paths = require('path'); const _ = require('lodash'); diff --git a/core/oputil/oputil_file_base.js b/core/oputil/oputil_file_base.js index 09b07548..b18577d0 100644 --- a/core/oputil/oputil_file_base.js +++ b/core/oputil/oputil_file_base.js @@ -11,7 +11,7 @@ const getAreaAndStorage = require('./oputil_common.js').getAreaAndStorage; const Errors = require('../../core/enig_error.js').Errors; const async = require('async'); -const fs = require('fs'); +const fs = require('graceful-fs'); const paths = require('path'); const _ = require('lodash'); const moment = require('moment'); diff --git a/core/scanner_tossers/ftn_bso.js b/core/scanner_tossers/ftn_bso.js index 0239176c..645c4b5f 100644 --- a/core/scanner_tossers/ftn_bso.js +++ b/core/scanner_tossers/ftn_bso.js @@ -26,7 +26,7 @@ const moment = require('moment'); const _ = require('lodash'); const paths = require('path'); const async = require('async'); -const fs = require('fs'); +const fs = require('graceful-fs'); const later = require('later'); const temptmp = require('temptmp').createTrackedSession('ftn_bso'); const assert = require('assert'); diff --git a/core/servers/content/web.js b/core/servers/content/web.js index c8733ea9..9ec194a0 100644 --- a/core/servers/content/web.js +++ b/core/servers/content/web.js @@ -10,7 +10,7 @@ const Config = require('../../config.js').config; const http = require('http'); const https = require('https'); const _ = require('lodash'); -const fs = require('fs'); +const fs = require('graceful-fs'); const paths = require('path'); const mimeTypes = require('mime-types'); diff --git a/core/servers/login/ssh.js b/core/servers/login/ssh.js index 51a2da2f..cd9ca1a9 100644 --- a/core/servers/login/ssh.js +++ b/core/servers/login/ssh.js @@ -13,7 +13,7 @@ const stringFormat = require('../../string_format.js'); // deps const ssh2 = require('ssh2'); -const fs = require('fs'); +const fs = require('graceful-fs'); const util = require('util'); const _ = require('lodash'); const assert = require('assert'); diff --git a/core/string_util.js b/core/string_util.js index 0c296da8..05cdd0d7 100644 --- a/core/string_util.js +++ b/core/string_util.js @@ -509,7 +509,7 @@ function createCleanAnsi(input, options, cb) { } /* -const fs = require('fs'); +const fs = require('graceful-fs'); let data = fs.readFileSync('/home/nuskooler/Downloads/art3.ans'); data = iconv.decode(data, 'cp437'); createCleanAnsi(data, { width : 79, height : 25 }, (out) => { diff --git a/core/system_view_validate.js b/core/system_view_validate.js index a0844869..63c7b2bc 100644 --- a/core/system_view_validate.js +++ b/core/system_view_validate.js @@ -7,7 +7,7 @@ const Config = require('./config.js').config; const Log = require('./logger.js').log; // deps -const fs = require('fs'); +const fs = require('graceful-fs'); exports.validateNonEmpty = validateNonEmpty; exports.validateMessageSubject = validateMessageSubject; diff --git a/core/theme.js b/core/theme.js index 2e02cbca..6359d461 100644 --- a/core/theme.js +++ b/core/theme.js @@ -11,7 +11,7 @@ const asset = require('./asset.js'); const ViewController = require('./view_controller.js').ViewController; const Errors = require('./enig_error.js').Errors; -const fs = require('fs'); +const fs = require('graceful-fs'); const paths = require('path'); const async = require('async'); const _ = require('lodash'); diff --git a/core/tic_file_info.js b/core/tic_file_info.js index af9b7dfd..730155e6 100644 --- a/core/tic_file_info.js +++ b/core/tic_file_info.js @@ -7,7 +7,7 @@ const Errors = require('./enig_error.js').Errors; const EnigAssert = require('./enigma_assert.js'); // deps -const fs = require('fs'); +const fs = require('graceful-fs'); const CRC32 = require('./crc.js').CRC32; const _ = require('lodash'); const async = require('async'); diff --git a/core/web_password_reset.js b/core/web_password_reset.js index 56e6b598..c2d6852d 100644 --- a/core/web_password_reset.js +++ b/core/web_password_reset.js @@ -15,7 +15,7 @@ const Log = require('./logger.js').log; const async = require('async'); const _ = require('lodash'); const crypto = require('crypto'); -const fs = require('fs'); +const fs = require('graceful-fs'); const url = require('url'); const querystring = require('querystring'); diff --git a/core/word_wrap.js b/core/word_wrap.js index 39439cce..f3c3c5d5 100644 --- a/core/word_wrap.js +++ b/core/word_wrap.js @@ -245,7 +245,7 @@ function wordWrapText(text, options) { /* const iconv = require('iconv-lite'); -const input = iconv.decode(require('fs').readFileSync('/home/nuskooler/Downloads/msg_out.txt'), 'cp437'); +const input = iconv.decode(require('graceful-fs').readFileSync('/home/nuskooler/Downloads/msg_out.txt'), 'cp437'); const opts = { width : 80, diff --git a/package.json b/package.json index 62e69dc4..47ab69d5 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,8 @@ "temptmp": "^1.0.0", "uuid": "^3.0.1", "uuid-parse": "^1.0.0", - "ws" : "^2.3.1" + "ws" : "^2.3.1", + "graceful-fs" : "^4.1.11" }, "devDependencies": {}, "engines": { diff --git a/util/exiftool2desc.js b/util/exiftool2desc.js index 311daa2b..5c828718 100755 --- a/util/exiftool2desc.js +++ b/util/exiftool2desc.js @@ -7,7 +7,7 @@ // :TODO: Make this it's own sep tool/repo const exiftool = require('exiftool'); -const fs = require('fs'); +const fs = require('graceful-fs'); const moment = require('moment'); const TOOL_VERSION = '1.0.0.0';