diff options
author | William Blankenship <william.jblankenship@gmail.com> | 2016-02-09 03:50:26 +0300 |
---|---|---|
committer | William Blankenship <william.jblankenship@gmail.com> | 2016-02-09 03:50:26 +0300 |
commit | db8fb6da54f8144be087340c735674a1b6e4ddbb (patch) | |
tree | f6463a926b2e6008a3faebdab239402ffa7d112e /README.md | |
parent | 331913eb1e6c755dca1a53a9c8663b7506e4db6c (diff) |
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.
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -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 |