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

[CLOSED] Path option not working #137

Closed
feross opened this issue Sep 21, 2014 · 8 comments
Closed

[CLOSED] Path option not working #137

feross opened this issue Sep 21, 2014 · 8 comments

Comments

@feross
Copy link
Member

@feross feross commented Sep 21, 2014

Issue by Fr3aKkK
Friday Aug 22, 2014 at 06:00 GMT
Originally opened as https://github.com/feross/bittorrent-client/issues/41


Hello guys,
I wanted to use bittorrent client, but upon adding torrent, the CPU usage goes crazy, but this is already reported. The problem for me is that something is being downloaded, but I can't find it anywhere and after a minute or two I am getting "Wire not speaking BitTorrent protocol" a lot of it, until I just stop the script.

@feross

This comment has been minimized.

Copy link
Member Author

@feross feross commented Sep 21, 2014

Comment by feross
Friday Aug 22, 2014 at 07:01 GMT


Thanks for the report. Can you share the code you're using? Also, can you check which version of bittorrent-client you're using? There were a lot of improvements recently.

@feross

This comment has been minimized.

Copy link
Member Author

@feross feross commented Sep 21, 2014

Comment by Fr3aKkK
Friday Aug 22, 2014 at 08:14 GMT


The version is 0.8.0
As for the code I wanted to start with something simpler to test before moving on.

var client = BitTorrentClient({
path: '/var/www/public/movies'
})
client.add('super-long-magnet')
client.on('torrent', function (torrent) {
console.log(torrent.name)
torrent.files.forEach(function (file) {
console.log(file.name)
var stream = file.createReadStream()
})
})

@feross

This comment has been minimized.

Copy link
Member Author

@feross feross commented Sep 21, 2014

Comment by feross
Friday Aug 22, 2014 at 08:48 GMT


Can you share the magnet uri you're using? Email works: feross@gmail.com

@feross

This comment has been minimized.

Copy link
Member Author

@feross feross commented Sep 21, 2014

Comment by Fr3aKkK
Friday Aug 22, 2014 at 09:00 GMT


Yea of course.

@feross

This comment has been minimized.

Copy link
Member Author

@feross feross commented Sep 21, 2014

Comment by feross
Friday Aug 22, 2014 at 09:09 GMT


So, the issue is that the path option is not supported (and actually never was). You need to save the files to disk for yourself using fs. Here's how:

var BitTorrentClient = require('./')
var fs = require('fs')

var client = BitTorrentClient({})
client.add('<magnet>')
client.on('torrent', function (torrent) {
  console.log(torrent.name)
  torrent.files.forEach(function (file) {
    console.log(file.name)
    file.createReadStream().pipe(fs.createWriteStream('/path/to/folder/that/exists/' + file.name))
  })
})

Let me know if that code works for you.

@feross

This comment has been minimized.

Copy link
Member Author

@feross feross commented Sep 21, 2014

Comment by Fr3aKkK
Friday Aug 22, 2014 at 09:36 GMT


Yes, now the files are there, although I am still getting this error multiple times in the console.

@feross

This comment has been minimized.

Copy link
Member Author

@feross feross commented Sep 21, 2014

Comment by feross
Friday Aug 22, 2014 at 09:38 GMT


The message about "Wire not speaking BitTorrent protocol" is not really an error. It just means that one of the peers the client tried to connect to didn't send the expected handshake and so the connection with this peer was closed. I updated the underlying module to not spew this debugging message onto the console. If you run npm update the message should disappear :)

@feross

This comment has been minimized.

Copy link
Member Author

@feross feross commented Sep 21, 2014

Comment by feross
Friday Aug 22, 2014 at 09:39 GMT


Closing this issue for now, but let me know (via a new issue) if you have any more issues!

@lock lock bot locked as resolved and limited conversation to collaborators May 7, 2018
This issue was closed.
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.