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

Clarify `opts.name` default behaviour #603

Merged
merged 1 commit into from Feb 9, 2016
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Clarify `opts.name` default behaviour

First attempt at documenting the behaviour of `create-torrent` when `opts.name` isn't defined.

This could use some work.
  • Loading branch information
retrohacker committed Feb 9, 2016
commit db8fb6da54f8144be087340c735674a1b6e4ddbb
@@ -306,6 +306,11 @@ If `opts` is specified, it should contain the following types of options:

If `onseed` is specified, it will be called when the client has begun seeding the file.

> Note: The torrent specification requires that every torrent have a name. If one is not explicitly provided through `opts`, WebTorrent will determine the torrent name with the following logic:
> * If all of the files share a common prefix, that prefix will become the torrent name. For example, if all of the files start with `/imgs/` the torrent name will be `imgs`
> * Otherwise, the name of the first file passed in to `client.seed`, for example if the first file is `/foo/bar/baz.txt`, the torrent name will be `baz.txt`
> The `torrent` object will contain a list of files, whose names are prefixed with the torrent name. When creating a nameless torrent in Node, this will be intuitive. When doing the same in the browser, this may lead to confusing results.
#### `client.on('torrent', function (torrent) {})`

Emitted when a torrent is ready to be used (i.e. metadata is available and store is
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.