Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/webtorrent/webtorrent.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorDiego R. B <diegorbaquero@gmail.com>2017-06-25 18:39:13 +0300
committerGitHub <noreply@github.com>2017-06-25 18:39:13 +0300
commitf980be0093a20f9411090e098a9353f34b420bf6 (patch)
treef15020bd96e70daac2d17f8bfd299b7a9a94a24d /docs
parent45ebe4c3efd0d175fda23b58e5ff930a331c2d41 (diff)
parent526ec9a44980e95274b29e66278ea488f2681728 (diff)
Merge pull request #1096 from webtorrent/feross/cors
Add `origin` option for torrent.createServer()
Diffstat (limited to 'docs')
-rw-r--r--docs/api.md12
1 files changed, 9 insertions, 3 deletions
diff --git a/docs/api.md b/docs/api.md
index cb713d8..e0c4b94 100644
--- a/docs/api.md
+++ b/docs/api.md
@@ -85,7 +85,7 @@ If `opts` is specified, then the default options (shown below) will be overridde
```js
{
- announce: [], // Torrent trackers to use (added to list in .torrent or magnet uri)
+ announce: [String], // Torrent trackers to use (added to list in .torrent or magnet uri)
getAnnounceOpts: Function, // Custom callback to allow sending extra parameters to the tracker
maxWebConns: Number, // Max number of simultaneous connections per web seed [default=4]
path: String, // Folder to download files to (default=`/tmp/webtorrent/`)
@@ -316,13 +316,19 @@ 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([requestListener])`
+## `torrent.createServer([opts])`
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
-`requestListener` is specified, it is added to the 'request' event.
+`opts` is specified, it can have the following properties:
+
+```js
+{
+ origin: String // Allow requests from specific origin. `false` for same-origin. [default: '*']
+}
+```
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