@@ -135,11 +135,13 @@ function downloadFile(url, destinationPath, progressCallback = noop) {
135
135
return promise ;
136
136
}
137
137
138
- let progressBar = null ;
139
- function onProgress ( deltaBytes , totalBytes ) {
138
+
139
+ function newProgressListener ( name ) {
140
+ let progressBar = undefined
141
+ return function onProgress ( deltaBytes , totalBytes ) {
140
142
if ( totalBytes === null ) return ;
141
143
if ( ! progressBar ) {
142
- progressBar = new ProgressBar ( `Downloading ffmpeg ${ releaseName } [:bar] :percent :etas ` , {
144
+ progressBar = new ProgressBar ( `Downloading ${ name } ${ releaseName } [:bar] :percent :etas ` , {
143
145
complete : "|" ,
144
146
incomplete : " " ,
145
147
width : 20 ,
@@ -150,6 +152,11 @@ function onProgress(deltaBytes, totalBytes) {
150
152
progressBar . tick ( deltaBytes ) ;
151
153
}
152
154
155
+
156
+
157
+ }
158
+
159
+
153
160
const release = (
154
161
process . env . FFMPEG_BINARY_RELEASE ||
155
162
pkg [ 'ffmpeg-static' ] [ 'binary-release-tag' ]
@@ -169,20 +176,20 @@ const ffprobeUrl = `${baseUrl}/ffprobe-${platform}-${arch}`
169
176
const readmeUrl = `${ baseUrl } /${ platform } -${ arch } .README`
170
177
const licenseUrl = `${ baseUrl } /${ platform } -${ arch } .LICENSE`
171
178
172
- downloadFile ( ffmpegUrl , ffmpegPath , onProgress )
179
+ downloadFile ( ffmpegUrl , ffmpegPath , newProgressListener ( 'ffmpeg' ) )
173
180
. then ( ( ) => {
174
181
fs . chmodSync ( ffmpegPath , 0o755 ) // make executable
175
182
} )
176
183
. catch ( exitOnError )
177
184
178
- . then ( ( ) => downloadFile ( ffprobeUrl , ffprobePath , onProgress ) )
185
+ . then ( ( ) => downloadFile ( ffprobeUrl , ffprobePath , newProgressListener ( 'ffprobe' ) )
179
186
. then ( ( ) => {
180
187
fs . chmodSync ( ffprobePath , 0o755 ) // make executable
181
188
} )
182
189
. catch ( exitOnError )
183
190
184
- . then ( ( ) => downloadFile ( readmeUrl , `${ ffmpegPath } .README` ) )
191
+ . then ( ( ) => downloadFile ( readmeUrl , `${ ffmpegPath } .README` , newProgressListener ( 'README' ) ) )
185
192
. catch ( warnWith ( 'Failed to download the ffmpeg README.' ) )
186
193
187
- . then ( ( ) => downloadFile ( licenseUrl , `${ ffmpegPath } .LICENSE` ) )
188
- . catch ( warnWith ( 'Failed to download the ffmpeg LICENSE.' ) )
194
+ . then ( ( ) => downloadFile ( licenseUrl , `${ ffmpegPath } .LICENSE` , newProgressListener ( 'LICENSE' ) ) )
195
+ . catch ( warnWith ( 'Failed to download the ffmpeg LICENSE.' ) ) )
0 commit comments