Updated fs, only read files.

This commit is contained in:
Chris 2018-04-03 20:14:57 -04:00
parent ce384799ae
commit 969315dacc
3 changed files with 2 additions and 25 deletions

View File

@ -11,7 +11,6 @@
"dependencies": { "dependencies": {
"checkenv": "^1.2.2", "checkenv": "^1.2.2",
"discord.js": "^11.3.0", "discord.js": "^11.3.0",
"fs-extra": "^5.0.0",
"ip": "^1.1.5", "ip": "^1.1.5",
"logdna": "^1.2.3", "logdna": "^1.2.3",
"node-schedule": "^1.2.3", "node-schedule": "^1.2.3",

View File

@ -1,11 +1,10 @@
const fs = require('fs-extra'); const fs = require('fs');
const state = require('./state.js'); const state = require('./state.js');
const logger = require('./logging.js'); const logger = require('./logging.js');
function readWarnings() { function readWarnings() {
// Load the warnings file into the application state. // Load the warnings file into the application state.
var readFilePath = '/data/discordWarnings.json'; var readFilePath = '/data/discordWarnings.json';
fs.ensureFileSync(readFilePath);
fs.readFile(readFilePath, 'utf8', function (err, data) { fs.readFile(readFilePath, 'utf8', function (err, data) {
if (err) { throw err; } if (err) { throw err; }
if (data) { if (data) {
@ -20,7 +19,6 @@ function readWarnings() {
function readBans() { function readBans() {
// Load the ban file into the application state. // Load the ban file into the application state.
var readFilePath = '/data/discordBans.json'; var readFilePath = '/data/discordBans.json';
fs.ensureFileSync(readFilePath);
fs.readFile(readFilePath, 'utf8', function (err, data) { fs.readFile(readFilePath, 'utf8', function (err, data) {
if (err) { throw err; } if (err) { throw err; }
if (data) { if (data) {
@ -35,8 +33,6 @@ function readBans() {
function readCustomResponses() { function readCustomResponses() {
// Load the responses file into the responses variable. // Load the responses file into the responses variable.
var readFilePath = '/data/responses.json'; var readFilePath = '/data/responses.json';
fs.ensureFileSync(readFilePath);
fs.readFile(readFilePath, 'utf8', function (err, data) { fs.readFile(readFilePath, 'utf8', function (err, data) {
if (err) { throw err; } if (err) { throw err; }
if (data) { if (data) {

View File

@ -602,14 +602,6 @@ form-data@~2.3.1:
combined-stream "1.0.6" combined-stream "1.0.6"
mime-types "^2.1.12" mime-types "^2.1.12"
fs-extra@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-5.0.0.tgz#414d0110cdd06705734d055652c5411260c31abd"
dependencies:
graceful-fs "^4.1.2"
jsonfile "^4.0.0"
universalify "^0.1.0"
fs.realpath@^1.0.0: fs.realpath@^1.0.0:
version "1.0.0" version "1.0.0"
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
@ -654,7 +646,7 @@ globby@^5.0.0:
pify "^2.0.0" pify "^2.0.0"
pinkie-promise "^2.0.0" pinkie-promise "^2.0.0"
graceful-fs@^4.1.2, graceful-fs@^4.1.6: graceful-fs@^4.1.2:
version "4.1.11" version "4.1.11"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658"
@ -857,12 +849,6 @@ json-stringify-safe@^5.0.1, json-stringify-safe@~5.0.1:
version "5.0.1" version "5.0.1"
resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb"
jsonfile@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb"
optionalDependencies:
graceful-fs "^4.1.6"
jsprim@^1.2.2: jsprim@^1.2.2:
version "1.4.1" version "1.4.1"
resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2" resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2"
@ -1480,10 +1466,6 @@ typedarray@^0.0.6:
version "0.0.6" version "0.0.6"
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
universalify@^0.1.0:
version "0.1.1"
resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.1.tgz#fa71badd4437af4c148841e3b3b165f9e9e590b7"
util-deprecate@~1.0.1: util-deprecate@~1.0.1:
version "1.0.2" version "1.0.2"
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"