File tree Expand file tree Collapse file tree 1 file changed +10
-11
lines changed
Expand file tree Collapse file tree 1 file changed +10
-11
lines changed Original file line number Diff line number Diff line change 44*/
55"use strict" ;
66
7- const BULK_SIZE = 10000 ;
7+ const BULK_SIZE = 1000 ;
88
99class BulkUpdateDecorator {
1010 constructor ( hash ) {
@@ -14,26 +14,25 @@ class BulkUpdateDecorator {
1414
1515 update ( data , inputEncoding ) {
1616 if ( inputEncoding !== undefined || typeof data !== "string" || data . length > BULK_SIZE ) {
17- if ( this . buffer . length > 0 )
18- this . _flush ( ) ;
17+ if ( this . buffer . length > 0 ) {
18+ this . hash . update ( this . buffer ) ;
19+ this . buffer = "" ;
20+ }
1921 this . hash . update ( data , inputEncoding ) ;
2022 } else {
2123 this . buffer += data ;
2224 if ( this . buffer . length > BULK_SIZE ) {
23- this . _flush ( ) ;
25+ this . hash . update ( this . buffer ) ;
26+ this . buffer = "" ;
2427 }
2528 }
2629 return this ;
2730 }
2831
29- _flush ( ) {
30- this . hash . update ( this . buffer ) ;
31- this . buffer = "" ;
32- }
33-
3432 digest ( encoding ) {
35- if ( this . buffer . length > 0 )
36- this . _flush ( ) ;
33+ if ( this . buffer . length > 0 ) {
34+ this . hash . update ( this . buffer ) ;
35+ }
3736 return this . hash . digest ( encoding ) ;
3837 }
3938}
You can’t perform that action at this time.
0 commit comments