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
diff options
context:
space:
mode:
authorFeross Aboukhadijeh <feross@feross.org>2014-12-30 07:41:47 +0300
committerFeross Aboukhadijeh <feross@feross.org>2014-12-30 07:41:47 +0300
commit7a8790a8f0a7803be732b26eea34ae92e8ba92f5 (patch)
tree8147160c2b9cfdbd9dc4134342f56db26dc3351f /README.md
parentffcb0700e73a2fb21ff7d2a1bd3a19340823fcfa (diff)
New API: Add file.getURL()
Fixes #217
Diffstat (limited to 'README.md')
-rw-r--r--README.md27
1 files changed, 27 insertions, 0 deletions
diff --git a/README.md b/README.md
index f4ceed1..31713ff 100644
--- a/README.md
+++ b/README.md
@@ -311,6 +311,14 @@ Seed ratio for all torrents in the client.
### torrent api
+#### `torrent.infoHash`
+
+Get the info hash of the torrent.
+
+#### `torrent.magnetURI`
+
+Get the magnet URI of the torrent.
+
#### `torrent.files[...]`
An array of all files in the torrent. See the file section for more info on what methods
@@ -415,6 +423,25 @@ You can pass `opts` to stream only a slice of a file.
Both `start` and `end` are inclusive.
+#### `file.getBlobURL(function callback (err, url) {})`
+
+Get a url which can be used in the browser to refer to the file.
+
+The file will be fetched from the network with highest priority, and `callback` will be
+called when it is ready. `callback` must be specified and may be called with a an `Error`
+or the blob url (`String`) when the file data is available and ready to be used.
+
+```js
+file.getBlobURL(function (err, url) {
+ if (err) throw err
+ var a = document.createElement('a')
+ a.download = file.name
+ a.href = url
+ a.textContent = 'Download ' + file.name
+ body.appendChild(a)
+})
+```
+
### Modules
Most of the active development is happening inside of small npm modules which are used by WebTorrent.