diff options
author | Feross Aboukhadijeh <feross@feross.org> | 2017-03-17 02:20:43 +0300 |
---|---|---|
committer | Feross Aboukhadijeh <feross@feross.org> | 2017-03-17 02:20:43 +0300 |
commit | acf3580e44ac32abe46347357ab4a261005bb14b (patch) | |
tree | cb011e61296b2c83ee4c8e1c8fb2bb299594cffc /docs | |
parent | d2d8c860dd265cb9431ddbb3426f671538c6483d (diff) |
doc: torrent.createServer() takes a function argument
Diffstat (limited to 'docs')
-rw-r--r-- | docs/api.md | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/docs/api.md b/docs/api.md index 3ecb957..453e374 100644 --- a/docs/api.md +++ b/docs/api.md @@ -314,12 +314,13 @@ Deprioritizes a range of previously selected pieces. Marks a range of pieces as critical priority to be downloaded ASAP. From `start` to `end` (both inclusive). -## `torrent.createServer([opts])` +## `torrent.createServer([requestListener])` Create an http server to serve the contents of this torrent, dynamically fetching the needed torrent pieces to satisfy http requests. Range requests are supported. -Returns an `http.Server` instance (got from calling `http.createServer`). If `opts` is specified, it is passed to the `http.createServer` function. +Returns an `http.Server` instance (got from calling `http.createServer`). If +`requestListener` is specified, it is added to the 'request' event. Visiting the root of the server `/` will show a list of links to individual files. Access individual files at `/<index>` where `<index>` is the index in the `torrent.files` array |