Skip to content
This repository has been archived by the owner on Dec 3, 2023. It is now read-only.

Commit

Permalink
fix: avoid destructure under error
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Oct 29, 2019
1 parent e0a380c commit 8fb0e20
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/youtube-dl.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ let ytdlBinary = require('./get-binary')()
const execa = universalify.fromPromise(require('execa'))

function youtubeDl (args, options, cb) {
return execa(ytdlBinary, args, options, function done (err, { stdout }) {
return execa(ytdlBinary, args, options, function done (err, output) {
if (err) return cb(err)
return cb(null, stdout.trim().split(/\r?\n/))
return cb(null, output.stdout.trim().split(/\r?\n/))
})
}

Expand All @@ -47,7 +47,12 @@ function processData (data, options, stream) {
headers.Range = 'bytes=' + options.start + '-' + options.end
}

const req = request({ url: item.url, headers: headers, ecdhCurve: 'auto', timeout: 30000 })
const req = request({
url: item.url,
headers: headers,
ecdhCurve: 'auto',
timeout: 30000
})

req.on('response', function response (res) {
const size = parseInt(res.headers['content-length'], 10)
Expand Down

0 comments on commit 8fb0e20

Please sign in to comment.