File tree 2 files changed +7
-20
lines changed
2 files changed +7
-20
lines changed Original file line number Diff line number Diff line change 1
1
'use strict'
2
2
3
- var crc = require ( 'sse4_crc32 ' )
3
+ var crc = require ( 'fast-crc32c ' )
4
4
var crypto = require ( 'crypto' )
5
5
var through = require ( 'through2' )
6
6
@@ -11,31 +11,18 @@ module.exports = function (cfg) {
11
11
var md5 = cfg . md5 !== false
12
12
13
13
var hashes = { }
14
-
15
- if ( md5 ) {
16
- hashes . md5 = crypto . createHash ( 'md5' )
17
- }
14
+ if ( md5 ) hashes . md5 = crypto . createHash ( 'md5' )
18
15
19
16
var onData = function ( chunk , enc , done ) {
20
- if ( crc32c ) {
21
- hashes . crc32c = crc . calculate ( chunk , hashes . crc32c )
22
- }
23
-
24
- if ( md5 ) {
25
- hashes . md5 . update ( chunk )
26
- }
17
+ if ( crc32c ) hashes . crc32c = crc . calculate ( chunk , hashes . crc32c )
18
+ if ( md5 ) hashes . md5 . update ( chunk )
27
19
28
20
done ( null , chunk )
29
21
}
30
22
31
23
var onFlush = function ( done ) {
32
- if ( crc32c ) {
33
- hashes . crc32c = new Buffer ( [ hashes . crc32c ] ) . toString ( 'base64' )
34
- }
35
-
36
- if ( md5 ) {
37
- hashes . md5 = hashes . md5 . digest ( 'base64' )
38
- }
24
+ if ( crc32c ) hashes . crc32c = new Buffer ( [ hashes . crc32c ] ) . toString ( 'base64' )
25
+ if ( md5 ) hashes . md5 = hashes . md5 . digest ( 'base64' )
39
26
40
27
done ( )
41
28
}
Original file line number Diff line number Diff line change 19
19
"standard" : " ^5.1.0"
20
20
},
21
21
"dependencies" : {
22
- "sse4_crc32 " : " ^4. 0.1" ,
22
+ "fast-crc32c " : " ^0.1.5 " ,
23
23
"through2" : " ^2.0.0"
24
24
},
25
25
"standard" : {
You can’t perform that action at this time.
0 commit comments