question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Torrent-stream does not detect files

See original GitHub issue

Hi.

I have a simple function:

function play(magnet) {
    var torrentStream = require('torrent-stream');
    console.log("Creating torrent stream for " + magnet);
    var engine = torrentStream(magnet);

    engine.on('ready', function() {
        engine.files.forEach(function(file) {
            console.log('filename:', file.name);
            var stream = file.createReadStream();
            // stream is readable stream to containing the file content
        });
    });
}

to which I pass this link: magnet:?xt=urn:btih:02b6b3ed991edb7f173469f5bf8d8267 7380ea53&tr=http://tracker.torrentleech.org:2710/a/xxxxxx6xxexx44xxa01X772601xxdfc/announce. (login token hidden)

The link works If i open it manually in a torrent program, but console.log('filename:', file.name); does not print anything. Nothing happens, execution stops and nothing gets printed. Why?

Issue Analytics

  • State:open
  • Created 8 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
williamsbscommented, Mar 7, 2019

hi i still have this probleme, some magnets don’t trigger the engine.on(‘ready’, fn), does anyone have a solution ?

0reactions
tsoernescommented, Nov 2, 2015

Take a look: DHT Off: tlscrape1 DHT On (never finishes): tlscrape2

This is a very strange issue. If I try the magnet link in peerflix-cli, it does not work, but if I download the torrent-file and put it in the cli, it works. Do you have any idea what it could be? I can email you a torrent if that would help.

This is a possible workaround, but it’s not pretty:

// Torrent location is relative to the location of this script
    var spawn = require('child_process').spawn;
    var child = spawn('cmd', ['/c', 'peerflix', torrentFilePath, "--mpchc"]);
    child.on('error', function (err) {
        console.log('Failed to start child process.');
    });
Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to download torrent files and stream videos
Which application are you using to download torrents? Try these steps and check if it helps: Step 1: Temporarily disable security software.
Read more >
What To Do With Torrents Not Downloading? - Setapp
1. Firewall blocking torrent connections · 2. Incorrect torrent preferences · 3. Torrent connection issues · 4. File on torrent not working ·...
Read more >
How to Stream Torrent Files Without Downloading on Android
To stream a torrent, open WebTor and simply paste the torrent's magnet link or info hash in the URL field. WebTor will load...
Read more >
Torrent-stream require is not defined - Stack Overflow
Trying to stream a torrent file in the browser ...
Read more >
What are peers? What happens if there aren't enough peers?
If you run into problems with the quality of the stream, or the media cannot play at all, it may be due to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found