Skip to content

Commit 18cf9f7

Browse files
Fixing download and permissioning issue
1 parent 9be6381 commit 18cf9f7

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

.github/workflows/release-binaries.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
issues: write
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@v2
16+
- uses: actions/checkout@v4
1717

1818
- name: Download Binaries
1919
run: sh ./build/index.sh

install.js

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,13 @@ function downloadFile(url, destinationPath, progressCallback = noop) {
135135
return promise;
136136
}
137137

138-
let progressBar = null;
139-
function onProgress(deltaBytes, totalBytes) {
138+
139+
function newProgressListener(name) {
140+
let progressBar = undefined
141+
return function onProgress(deltaBytes, totalBytes) {
140142
if (totalBytes === null) return;
141143
if (!progressBar) {
142-
progressBar = new ProgressBar(`Downloading ffmpeg ${releaseName} [:bar] :percent :etas `, {
144+
progressBar = new ProgressBar(`Downloading ${name} ${releaseName} [:bar] :percent :etas `, {
143145
complete: "|",
144146
incomplete: " ",
145147
width: 20,
@@ -150,6 +152,11 @@ function onProgress(deltaBytes, totalBytes) {
150152
progressBar.tick(deltaBytes);
151153
}
152154

155+
156+
157+
}
158+
159+
153160
const release = (
154161
process.env.FFMPEG_BINARY_RELEASE ||
155162
pkg['ffmpeg-static']['binary-release-tag']
@@ -169,20 +176,20 @@ const ffprobeUrl = `${baseUrl}/ffprobe-${platform}-${arch}`
169176
const readmeUrl = `${baseUrl}/${platform}-${arch}.README`
170177
const licenseUrl = `${baseUrl}/${platform}-${arch}.LICENSE`
171178

172-
downloadFile(ffmpegUrl, ffmpegPath, onProgress)
179+
downloadFile(ffmpegUrl, ffmpegPath,newProgressListener('ffmpeg'))
173180
.then(() => {
174181
fs.chmodSync(ffmpegPath, 0o755) // make executable
175182
})
176183
.catch(exitOnError)
177184

178-
.then(() => downloadFile(ffprobeUrl, ffprobePath, onProgress))
185+
.then(() => downloadFile(ffprobeUrl, ffprobePath,newProgressListener('ffprobe'))
179186
.then(() => {
180187
fs.chmodSync(ffprobePath, 0o755) // make executable
181188
})
182189
.catch(exitOnError)
183190

184-
.then(() => downloadFile(readmeUrl, `${ffmpegPath}.README`))
191+
.then(() => downloadFile(readmeUrl, `${ffmpegPath}.README`,newProgressListener('README')))
185192
.catch(warnWith('Failed to download the ffmpeg README.'))
186193

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

Comments
 (0)