File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -100,21 +100,23 @@ module.exports = function (options) {
100
100
}
101
101
} )
102
102
. on ( 'file' , function ( name , file ) {
103
+ counter ++ ;
103
104
var fileInfo = map [ path . basename ( file . path ) ] ;
104
105
fs . exists ( file . path , function ( exists ) {
105
106
if ( exists ) {
106
107
fileInfo . size = file . size ;
107
108
if ( ! fileInfo . validate ( ) ) {
108
109
fs . unlink ( file . path ) ;
110
+ counter -- ;
109
111
return ;
110
112
}
111
113
112
114
var generatePreviews = function ( ) {
113
115
if ( options . imageTypes . test ( fileInfo . name ) ) {
114
116
_ . each ( options . imageVersions , function ( value , version ) {
117
+ counter ++ ;
115
118
// creating directory recursive
116
119
mkdirp ( options . uploadDir ( ) + '/' + version + '/' , function ( err , made ) {
117
- counter ++ ;
118
120
var opts = options . imageVersions [ version ] ;
119
121
imageMagick . resize ( {
120
122
width : opts . width ,
@@ -129,7 +131,6 @@ module.exports = function (options) {
129
131
}
130
132
131
133
mkdirp ( options . uploadDir ( ) + '/' , function ( err , made ) {
132
- counter ++ ;
133
134
fs . rename ( file . path , options . uploadDir ( ) + '/' + fileInfo . name , function ( err ) {
134
135
if ( ! err ) {
135
136
generatePreviews ( ) ;
@@ -149,6 +150,7 @@ module.exports = function (options) {
149
150
} ) ;
150
151
} ) ;
151
152
}
153
+ else counter -- ;
152
154
} ) ;
153
155
} )
154
156
. on ( 'aborted' , function ( ) {
You can’t perform that action at this time.
0 commit comments