webtorrent / webtorrent-hybrid

WebTorrent (with WebRTC support in Node.js)
https://webtorrent.io
MIT License
519 stars 98 forks source link

Downloading torrent file to particular path using client.add() #61

Closed Mookambika closed 7 years ago

Mookambika commented 7 years ago

Hi,

Is it possible to download the torrent file directly to a specified folder. i am using the bellow function client.add(torrentId, { path: 'http://localhost/projname/path' }, function (torrent) { ..... ...... }); torrent id is magnet url, but i am not able to get downloads in that folder and no error also. can you please check is that what i am doing is right?

DiegoRBaquero commented 7 years ago

You cannot download to an http path. You must use a disk path.

Mookambika commented 7 years ago

Hi

Even i tried with disk path also its also not worked, can you please tell me after converting magnet url to torrent file how can i save the torrent file directly to a folder is there any other methods.

DiegoRBaquero commented 7 years ago

Try './', it should download to whatever directory you run the command on.

Can you also provide which OS, Node version, and webtorrent-hybrid versions are you using?

feross commented 7 years ago

Sorry, this isn't really a support forum. I'm going to close this. If you and others wish to continue discussion, don't let this stop you. 😄

Mookambika commented 7 years ago

Hi

thanks for the reply, sorry i forgot to inform you that i am using web torrent for the browser not desktop, i want to download torrent file directly to specified path after conversion from magnet url.

feross commented 7 years ago

@Mookambika Sorry, you can't download directly to the user's file system from a browser. This isn't allowed by the browser for security reasons, or any website could just save files randomly on your drive, overwriting important files.

You will need to use the file.getBlob or file.getBlobURL methods, documented here: https://webtorrent.io/docs to create a link to the file that the user can click to trigger a download. There is a code sample at the very bottom of the page.

Mookambika commented 7 years ago

Hi

okay, thanks for the information to direct download to a path issue.