diff options
author | Ash <ashlesscinder@gmail.com> | 2017-06-01 22:28:10 +0300 |
---|---|---|
committer | Ash <ashlesscinder@gmail.com> | 2017-06-01 22:28:10 +0300 |
commit | 33397267f84eff456cc585aae86a58b52a6854b8 (patch) | |
tree | 7ca3475e48f2459c12df8d6d75c9a1fee552393f /lib | |
parent | 0774a2c816283d23ee6abd4e941f771efc66287a (diff) |
added file.progress property, along with documentation
Diffstat (limited to 'lib')
-rw-r--r-- | lib/file.js | 4 |
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) |