diff options
author | Feross Aboukhadijeh <feross@feross.org> | 2016-05-08 23:44:57 +0300 |
---|---|---|
committer | Feross Aboukhadijeh <feross@feross.org> | 2016-05-08 23:44:57 +0300 |
commit | a2f3d63ec0c6c567f0cab5d46c6f43cbfd5c3d41 (patch) | |
tree | 638de10a6199f12d252334d7a7179ded77d46cfe /lib | |
parent | 54663e4fe646b77feeed3c20cfd7f04ba1cfb81e (diff) |
remove path-exists
Diffstat (limited to 'lib')
-rw-r--r-- | lib/torrent.js | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/torrent.js b/lib/torrent.js index e29c38f..a765ef8 100644 --- a/lib/torrent.js +++ b/lib/torrent.js @@ -21,7 +21,6 @@ var parallel = require('run-parallel') var parallelLimit = require('run-parallel-limit') var parseTorrent = require('parse-torrent') var path = require('path') -var pathExists = require('path-exists') // browser exclude var Piece = require('torrent-piece') var pump = require('pump') var randomIterate = require('random-iterate') @@ -51,9 +50,12 @@ var FILESYSTEM_CONCURRENCY = 2 var RECONNECT_WAIT = [ 1000, 5000, 15000 ] -var TMP = typeof pathExists.sync === 'function' - ? path.join(pathExists.sync('/tmp') ? '/tmp' : os.tmpDir(), 'webtorrent') - : '/tmp/webtorrent' +var TMP +try { + TMP = path.join(fs.statSync('/tmp') && '/tmp', 'webtorrent') +} catch (err) { + TMP = path.join(typeof os.tmpDir === 'function' ? os.tmpDir() : '/', 'webtorrent') +} inherits(Torrent, EventEmitter) |