Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upCould you make parseTorrent available? #1457
Comments
This comment has been minimized.
This comment has been minimized.
|
Ummmm, but if you add an invalid torrent, you get an error, isn't that enough? |
This comment has been minimized.
This comment has been minimized.
|
I would prefer if it was syncron, I have a input where they can add two different things. Atm i have ripped out the thing I'm most interested from that package which is if (
/^(stream-)?magnet:/.test(str) ||
/^[a-f0-9]{40}$/i.test(str) ||
/^[a-z2-7]{32}$/i.test(str) {
) {
// Do something torrent related
} else {
// Do something completely different
}Which i just combined into one regex: Edit: And I don't want url's to be tested by |
This comment has been minimized.
This comment has been minimized.
|
Can't you just require it separately and use browserify? const WebTorrent = require('webtorrent')
const parseTorrent = require('parse-torrent')
const client = new WebTorrent()
function isTorrent (id) {
try {
parseTorrent(id)
return true
} catch (e) {
return false
}
}
if (isTorrent(x)) {
client.add(x)
} |
This comment has been minimized.
This comment has been minimized.
|
Rather use my one regex |
This comment has been minimized.
This comment has been minimized.
|
Are you using the hosted minified version? Trying to understand the use case |
This comment has been minimized.
This comment has been minimized.
|
Yes |
This comment has been minimized.
This comment has been minimized.
|
I don't see no harm, I'll take a PR |
This comment has been minimized.
This comment has been minimized.
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
What browser and version? (if using WebTorrent in the browser)
0.100.0
Hi, I was wondering if the
parseTorrentcould be publicly available throughtwebtorrentI'm looking for a way to identify if what the client are adding is a torrent or not. would be useful to have something like
.isTorrent(x)