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

strange behavior when seeding directories #349

Closed
madd512 opened this issue Jun 7, 2015 · 2 comments
Closed

strange behavior when seeding directories #349

madd512 opened this issue Jun 7, 2015 · 2 comments

Comments

@madd512
Copy link

@madd512 madd512 commented Jun 7, 2015

Seeding a directory with one file in it:

Same script as above

Expected:
$ node seed.js 
[ 'a.txt' ]
Actual:
$ node seed.js 
[ 'www' ]

Seeding a directory with two files in it:

var WebTorrent = require('webtorrent-hybrid');

var client = new WebTorrent();

client.seed('./www', function(torrent){
  console.log(torrent.files.map(file => file.path));
});
Expected:
$ node seed.js 
[ 'a.txt', 'b.txt' ]
Actual:
$ node seed.js 
[ 'www/a.txt', 'www/b.txt' ]
feross added a commit to webtorrent/create-torrent that referenced this issue Jun 11, 2015
@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Jun 11, 2015

Thanks for reporting. There was indeed a bug when seeding a directory with one file in it. That's fixed in create-torrent 3.13.0 now. 👍 That was actually quite tricky to debug! webtorrent/create-torrent@b459298

The path property on the file automatically includes the directory name that should be created when saving the file to the filesystem. So, your second example of seeding a directory with two files is actually behaving as expected. Maybe we shouldn't do that, but it's actually expected behavior. If you want to discuss that further, open a new issue. :)

@feross feross closed this Jun 11, 2015
feross added a commit that referenced this issue Jun 11, 2015
@madd512

This comment has been minimized.

Copy link
Author

@madd512 madd512 commented Jun 11, 2015

Awesome, thanks :)

@lock lock bot locked as resolved and limited conversation to collaborators May 6, 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
2 participants
You can’t perform that action at this time.