Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#download !== #add ? #140

Closed
Latrasis opened this issue Sep 22, 2014 · 1 comment
Closed

#download !== #add ? #140

Latrasis opened this issue Sep 22, 2014 · 1 comment

Comments

@Latrasis
Copy link

@Latrasis Latrasis commented Sep 22, 2014

When using a separate listener the files aren't loaded for some reason?

// Usual Stuff
var webtorrent = require('webtorrent'),
    fs = require('fs'),
    progressbar = require('progress');

var client = new webtorrent();

This Works:

var torrent = client.download(process.argv[2], function(torrent) {
    // Got torrent metadata!
    console.log('Torrent info hash:', torrent.infoHash);
    torrent.files.forEach(function(file) {
        console.log(file.name + ' : ' + file.length);
        var filestream = file.createReadStream();
        filestream.pipe(fs.createWriteStream('./torrents/' + file.name));
    });
});

...But this doesn't (°□°)??

var torrent = client.download(process.argv[2]);
torrent.on('torrent', function(torrent) {
    // Got torrent metadata!
    console.log('Torrent info hash:', torrent.infoHash);
    torrent.files.forEach(function(file) {
        console.log(file.name + ' : ' + file.length);
        var filestream = file.createReadStream();
        filestream.pipe(fs.createWriteStream('./torrents/' + file.name));
    });
});
@Latrasis

This comment has been minimized.

Copy link
Author

@Latrasis Latrasis commented Sep 22, 2014

Whoops just noticed it's only an alias. My mistake 👍

@Latrasis Latrasis closed this Sep 22, 2014
@lock lock bot locked as resolved and limited conversation to collaborators May 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.