diff --git a/lib/server/flop.js b/lib/server/flop.js index 87b96607..f8b6732f 100644 --- a/lib/server/flop.js +++ b/lib/server/flop.js @@ -13,7 +13,6 @@ dir = require(DIR + 'dir'), commander = require(DIR + 'commander'), time = require(DIR + 'time'), - Hash = require(DIR + 'hash'), pipe = require(DIR + 'pipe'), ncp = tryRequire('ncp'), @@ -43,8 +42,6 @@ }; exports.read = function(path, type, callback) { - var hash, error; - Util.checkArgs(arguments, ['path', 'callback']); if (!callback) @@ -66,23 +63,6 @@ }); break; - case 'hash': - hash = Hash.create(); - - if (!hash) { - error = 'hash: not suported, try update node'; - callback(new Error(error)); - } else - pipe.create(path, hash, function (error) { - var hex; - - if (!error) - hex = hash.get(); - - callback(error, hex); - }); - break; - default: commander.getDirContent(path, callback); break; diff --git a/lib/server/rest/fs/get.js b/lib/server/rest/fs/get.js index e75d3eaf..1652fcf9 100644 --- a/lib/server/rest/fs/get.js +++ b/lib/server/rest/fs/get.js @@ -4,14 +4,17 @@ var path = require('path'), DIR = path.resolve(__dirname + '/../../../') + '/', DIR_SERVER = DIR + 'server/', + pipe = require(DIR_SERVER + 'pipe'), flop = require(DIR_SERVER + 'flop'), + Hash = require(DIR_SERVER + 'hash'), CloudFunc = require(DIR + 'cloudfunc'), Util = require(DIR + 'util'); exports.onGet = onGet; function onGet(query, name, callback) { - var func = Util.exec.ret(callback); + var hash, error, + func = Util.exec.ret(callback); switch (query) { case 'size': @@ -28,7 +31,21 @@ break; case 'hash': - flop.read(name, 'hash', func); + hash = Hash.create(); + + if (!hash) { + error = 'hash: not suported, try update node'; + callback(new Error(error)); + } else + pipe.create(name, hash, function (error) { + var hex; + + if (!error) + hex = hash.get(); + + callback(error, hex); + }); + break; default: