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 | |
parent | 54663e4fe646b77feeed3c20cfd7f04ba1cfb81e (diff) |
remove path-exists
-rw-r--r-- | lib/torrent.js | 10 | ||||
-rw-r--r-- | package.json | 2 |
2 files changed, 6 insertions, 6 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) diff --git a/package.json b/package.json index 842c76d..6b9c5d6 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,6 @@ "load-ip-set": false, "net": false, "os": false, - "path-exists": false, "ut_pex": false }, "browserify": { @@ -45,7 +44,6 @@ "multistream": "^2.0.2", "package-json-versionify": "^1.0.1", "parse-torrent": "^5.1.0", - "path-exists": "^2.1.0", "pump": "^1.0.0", "random-iterate": "^1.0.1", "range-parser": "^1.0.2", |