mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-18 08:56:20 +00:00
feature(hash) add handling old node versions
This commit is contained in:
parent
ece4742e9b
commit
62546f1eae
3 changed files with 20 additions and 14 deletions
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
util.inherits(HashProto, Writable);
|
||||
|
||||
object.Hash = new HashProto();
|
||||
object.create = new HashProto().create;
|
||||
|
||||
function HashProto() {
|
||||
var shasum,
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@
|
|||
exports.auth = srvrequire('auth').auth,
|
||||
exports.appcache = srvrequire('appcache'),
|
||||
exports.dir = srvrequire('dir'),
|
||||
exports.hash = srvrequire('hash').Hash;
|
||||
exports.hash = srvrequire('hash'),
|
||||
diffPatch = librequire('diff/diff-match-patch').diff_match_patch,
|
||||
exports.diff = new (librequire('diff').DiffProto)(diffPatch),
|
||||
exports.rest = srvrequire('rest').api,
|
||||
|
|
|
|||
|
|
@ -117,18 +117,24 @@
|
|||
});
|
||||
});
|
||||
else if (Util.strCmp(lQuery, 'hash')) {
|
||||
hash = Hash.create();
|
||||
|
||||
pipe.create({
|
||||
from : p.name,
|
||||
write : hash,
|
||||
callback : function (error) {
|
||||
checkSendError(error, p, function() {
|
||||
var hex = hash.get();
|
||||
sendResponse(p, hex);
|
||||
});
|
||||
}
|
||||
});
|
||||
if (!Hash) {
|
||||
lMsg = 'not suported, try update node';
|
||||
lMsg = CloudFunc.formatMsg('hash', lMsg, 'error');
|
||||
sendError(p, lMsg);
|
||||
} else {
|
||||
hash = Hash.create();
|
||||
|
||||
pipe.create({
|
||||
from : p.name,
|
||||
write : hash,
|
||||
callback : function (error) {
|
||||
checkSendError(error, p, function() {
|
||||
var hex = hash.get();
|
||||
sendResponse(p, hex);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
} else
|
||||
fs.stat(p.name, function(pError, pStat) {
|
||||
checkSendError(pError, p, function() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue