Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/webtorrent/webtorrent.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFeross Aboukhadijeh <feross@feross.org>2015-03-01 00:56:36 +0300
committerFeross Aboukhadijeh <feross@feross.org>2015-03-01 00:56:36 +0300
commita44506e679b5c4ac7341bbb3ef277e2c092362e9 (patch)
treea4f98434c0642f4abbb4d5e10be033b4304e3d2e /bin/cmd.js
parentf252d16df4a6142cb2a65d02b5014e92bb88b53c (diff)
parse-torrent@4
Diffstat (limited to 'bin/cmd.js')
-rwxr-xr-xbin/cmd.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/bin/cmd.js b/bin/cmd.js
index bada74a..0218ec0 100755
--- a/bin/cmd.js
+++ b/bin/cmd.js
@@ -142,7 +142,14 @@ function runHelp () {
}
function runInfo (torrentId) {
- var parsedTorrent = parseTorrent(torrentId)
+ var parsedTorrent
+ try {
+ parsedTorrent = parseTorrent(torrentId)
+ } catch (err) {
+ // If torrent fails to parse, it could be a filesystem path, so don't consider it
+ // an error yet.
+ }
+
if (!parsedTorrent || !parsedTorrent.infoHash) {
try {
parsedTorrent = parseTorrent(fs.readFileSync(torrentId))
@@ -150,7 +157,6 @@ function runInfo (torrentId) {
errorAndExit(err)
}
}
- if (!parsedTorrent) errorAndExit('Invalid torrent identifier')
delete parsedTorrent.info
delete parsedTorrent.infoBuffer