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/lib
diff options
context:
space:
mode:
authorAsh <ashlesscinder@gmail.com>2017-06-01 22:28:10 +0300
committerAsh <ashlesscinder@gmail.com>2017-06-01 22:28:10 +0300
commit33397267f84eff456cc585aae86a58b52a6854b8 (patch)
tree7ca3475e48f2459c12df8d6d75c9a1fee552393f /lib
parent0774a2c816283d23ee6abd4e941f771efc66287a (diff)
added file.progress property, along with documentation
Diffstat (limited to 'lib')
-rw-r--r--lib/file.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/file.js b/lib/file.js
index d1e72bb..d912faa 100644
--- a/lib/file.js
+++ b/lib/file.js
@@ -56,6 +56,10 @@ Object.defineProperty(File.prototype, 'downloaded', {
}
})
+Object.defineProperty(File.prototype, 'progress', {
+ get: function () { return this.length ? this.downloaded / this.length : 0 }
+})
+
File.prototype.select = function (priority) {
if (this.length === 0) return
this._torrent.select(this._startPiece, this._endPiece, priority)