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

Commit

Permalink
use fs.exists
Browse files Browse the repository at this point in the history
  • Loading branch information
fent committed Jul 4, 2012
1 parent 1e3c85e commit 658c651
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/youtube-dl.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
var spawn = require('child_process').spawn
, EventEmitter = require('events').EventEmitter
, fs = require('fs')
, path = require('path')
, exists = fs.exists || path.exists
;


// arguments we dont want users to use with youtube-dl
Expand Down Expand Up @@ -33,11 +36,11 @@ var parseOpts = function(args) {

// check that youtube-dl file exists
var file = path.join(__dirname, '..', 'bin', 'youtube-dl');
path.exists(file, function(exists) {
exists(file, function(exists) {
if (exists) return;

require(__dirname + '/../scripts/download');
path.exists(file, function(exists) {
exists(file, function(exists) {
if (!exists) {
throw new Error('youtube-dl file does not exist. tried to download it but failed.');
}
Expand Down

0 comments on commit 658c651

Please sign in to comment.