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] Is it possible to save the file using the stream? #109

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

[CLOSED] Is it possible to save the file using the stream? #109

feross opened this issue Sep 21, 2014 · 6 comments

Comments

@feross
Copy link
Member

@feross feross commented Sep 21, 2014

Issue by shemer77
Wednesday May 14, 2014 at 18:35 GMT
Originally opened as https://github.com/feross/bittorrent-client/issues/13


Hey I'm new to node and not very familiar with streams. I'm trying out your code and I can see that you can use

var stream = file.createReadStream()

To get a stream of the file but what if I just want to download the whole file and save it on my computer. Is it possible to do that?

@feross

This comment has been minimized.

Copy link
Member Author

@feross feross commented Sep 21, 2014

Comment by feross
Wednesday May 14, 2014 at 19:02 GMT


The createReadStream function hasn't been implemented yet. I'll update this issue when it's ready to use (hopefully within no more than a few days).

When it's ready, this is how you would use it:

var fs = require('fs')
file.createReadStream()
    .pipe(fs.createWriteStream('~/downloads/movie.mp4'))
    .on('close', function () { console.log('done!') })
@feross

This comment has been minimized.

Copy link
Member Author

@feross feross commented Sep 21, 2014

Comment by shemer77
Thursday May 15, 2014 at 18:38 GMT


Very cool, excited to try it out.

@feross

This comment has been minimized.

Copy link
Member Author

@feross feross commented Sep 21, 2014

Comment by fisch0920
Sunday May 18, 2014 at 09:32 GMT


This should be working now using feross' code sample.

@feross

This comment has been minimized.

Copy link
Member Author

@feross feross commented Sep 21, 2014

Comment by shemer77
Monday May 19, 2014 at 22:41 GMT


Tried it out, works great. Thanks.

One thing though, I noticed that it is significantly slow downloading files ( I compared the same file to using something like vuse or utorrent). Is that because of the protocol the torrent client is built on or just certain features such as port forwarding,upnp, etc haven't been added in yet?

@feross

This comment has been minimized.

Copy link
Member Author

@feross feross commented Sep 21, 2014

Comment by fisch0920
Monday May 19, 2014 at 23:00 GMT


It could be any number of reasons depending on the torrent. Vuze/uTorrent are significantly more mature than webtorrent. Would you mind including your relative speeds for Vuze vs webtorrent and a link to the torrent? (e.g. using the webtorrent executable)

@feross

This comment has been minimized.

Copy link
Member Author

@feross feross commented Sep 21, 2014

Comment by feross
Friday Jun 06, 2014 at 05:24 GMT


User's issue (saving file as a stream) is fixed now. Closing.

@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.