diff options
author | Jimmy Wärting <jimmy@warting.se> | 2018-08-19 07:28:00 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-19 07:28:00 +0300 |
commit | 6386a6e75d260929098f68ccdc59603554e6bc3b (patch) | |
tree | 4662bf88282413723d6f890d55bda9e123fec44b /lib | |
parent | 36d4e076bb050f21a58873d1abe5f8788fed11cc (diff) |
wrapped in parentheses
Diffstat (limited to 'lib')
-rw-r--r-- | lib/file.js | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/file.js b/lib/file.js index f9adb06..4d7d71a 100644 --- a/lib/file.js +++ b/lib/file.js @@ -1,12 +1,12 @@ -const eos = require('end-of-stream') const {EventEmitter} = require('events') -const FileStream = require('./file-stream') +const {PassThrough} = require('readable-stream') +const eos = require('end-of-stream') const path = require('path') const render = require('render-media') -const stream = require('readable-stream') const streamToBlob = require('stream-to-blob') const streamToBlobURL = require('stream-to-blob-url') const streamToBuffer = require('stream-with-known-length-to-buffer') +const FileStream = require('./file-stream') class File extends EventEmitter { constructor (torrent, file) { @@ -40,7 +40,7 @@ class File extends EventEmitter { for (let index = this._startPiece; index <= this._endPiece; ++index) { if (this._torrent.bitfield.get(index)) { // verified data - downloaded += index === this._endPiece ? this._torrent.lastPieceLength : this._torrent.pieceLength + downloaded += (index === this._endPiece) ? this._torrent.lastPieceLength : this._torrent.pieceLength } else { // "in progress" data const piece = this._torrent.pieces[index] @@ -66,7 +66,7 @@ class File extends EventEmitter { createReadStream (opts) { if (this.length === 0) { - const empty = new stream.PassThrough() + const empty = new PassThrough() process.nextTick(() => { empty.end() }) |