From a090dc52db769c5766ba3322f24c3e6727e1390b Mon Sep 17 00:00:00 2001 From: ansuz Date: Thu, 19 Jul 2018 10:33:01 +0200 Subject: [PATCH] flow compliance --- package.json | 2 +- rpc.js | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index e4bfa80fd..c685c8efe 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "dependencies": { "chainpad-server": "~2.1.0", "express": "~4.16.0", - "mkdirp": "^0.5.1", + "fs-extra": "^7.0.0", "nthen": "~0.1.0", "pull-stream": "^3.6.1", "replify": "^1.2.0", diff --git a/rpc.js b/rpc.js index b13d1c9ad..18cafc65d 100644 --- a/rpc.js +++ b/rpc.js @@ -7,15 +7,14 @@ var Nacl = require("tweetnacl"); /* globals process */ var Fs = require("fs"); -Fs.move = require('fs-extra').move; -Fs.moveSync = require('fs-extra').moveSync; + +var Fse = require("fs-extra"); var Path = require("path"); var Https = require("https"); const Package = require('./package.json'); const Pinned = require('./pinned'); const Saferphore = require("saferphore"); const nThen = require("nthen"); -const Mkdirp = require("mkdirp"); var RPC = module.exports; @@ -1056,7 +1055,7 @@ var upload_complete = function (Env, publicKey, id, cb) { } // lol wut handle ur errors - Fs.move(oldPath, newPath, function (e) { + Fse.move(oldPath, newPath, function (e) { if (e) { WARN('rename', e); return void cb('RENAME_ERR'); @@ -1220,13 +1219,13 @@ var owned_upload_complete = function (Env, safeKey, id, cb) { var finalOwnPath; nThen(function (w) { // make the requisite directory structure using Mkdirp - Mkdirp(filePath, w(function (e /*, path */) { + Fse.mkdirp(filePath, w(function (e /*, path */) { if (e) { // does not throw error if the directory already existed w.abort(); return void cb(e.code); } })); - Mkdirp(ownPath, w(function (e /*, path */) { + Fse.mkdirp(ownPath, w(function (e /*, path */) { if (e) { // does not throw error if the directory already existed w.abort(); return void cb(e.code); @@ -1256,7 +1255,7 @@ var owned_upload_complete = function (Env, safeKey, id, cb) { // flow is dumb and I need to guard against this which will never happen /*:: if (typeof(oldPath) === 'object') { throw new Error('should never happen'); } */ - Fs.move(oldPath, finalPath, w(function (e) { + Fse.move(oldPath, finalPath, w(function (e) { if (e) { // Remove the ownership file Fs.unlink(finalOwnPath, function (e) {