mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-19 09:24:51 +00:00
chore(hash) cr-lf -> lf
This commit is contained in:
parent
1a6a1ca3b5
commit
fa2e947a9c
1 changed files with 39 additions and 39 deletions
|
|
@ -1,39 +1,39 @@
|
|||
(function (object) {
|
||||
'use strict';
|
||||
|
||||
var util = require('util'),
|
||||
Writable = require('stream').Writable;
|
||||
|
||||
util.inherits(HashProto, Writable);
|
||||
|
||||
object.Hash = new HashProto();
|
||||
|
||||
function HashProto() {
|
||||
var shasum,
|
||||
crypto = require('crypto');
|
||||
|
||||
Writable.call(this);
|
||||
this.create = function() {
|
||||
var ws = new Writable();
|
||||
|
||||
ws._write = write;
|
||||
ws.get = get;
|
||||
|
||||
shasum = crypto.createHash('sha1');
|
||||
|
||||
return ws;
|
||||
};
|
||||
|
||||
function get() {
|
||||
var hex = shasum.digest('hex');
|
||||
|
||||
return hex;
|
||||
}
|
||||
|
||||
function write (chunk, enc, next) {
|
||||
shasum.update(chunk);
|
||||
next();
|
||||
}
|
||||
}
|
||||
|
||||
})(this);
|
||||
(function (object) {
|
||||
'use strict';
|
||||
|
||||
var util = require('util'),
|
||||
Writable = require('stream').Writable;
|
||||
|
||||
util.inherits(HashProto, Writable);
|
||||
|
||||
object.Hash = new HashProto();
|
||||
|
||||
function HashProto() {
|
||||
var shasum,
|
||||
crypto = require('crypto');
|
||||
|
||||
Writable.call(this);
|
||||
this.create = function() {
|
||||
var ws = new Writable();
|
||||
|
||||
ws._write = write;
|
||||
ws.get = get;
|
||||
|
||||
shasum = crypto.createHash('sha1');
|
||||
|
||||
return ws;
|
||||
};
|
||||
|
||||
function get() {
|
||||
var hex = shasum.digest('hex');
|
||||
|
||||
return hex;
|
||||
}
|
||||
|
||||
function write (chunk, enc, next) {
|
||||
shasum.update(chunk);
|
||||
next();
|
||||
}
|
||||
}
|
||||
|
||||
})(this);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue