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-10-22 10:20:28 +0400
committerFeross Aboukhadijeh <feross@feross.org>2014-10-22 10:20:28 +0400
commit4c1bbb6b1d91757071f253ad0ece6186c4bc7333 (patch)
tree58b0ef1ab152776a56373188b216eb6f925975e0 /lib/storage.js
parentf5e70ef4ef248149298c6498c48cb0dfad34cd9b (diff)
add torrent.createServer() method
Diffstat (limited to 'lib/storage.js')
-rw-r--r--lib/storage.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/storage.js b/lib/storage.js
index 69f4bd5..5c96402 100644
--- a/lib/storage.js
+++ b/lib/storage.js
@@ -10,6 +10,7 @@ var extend = require('extend.js')
var FileStream = require('./file-stream')
var inherits = require('inherits')
var MultiStream = require('multistream')
+var once = require('once')
var sha1 = require('git-sha1')
var stream = require('stream')
@@ -325,6 +326,9 @@ Storage.BLOCK_LENGTH = BLOCK_LENGTH
Storage.prototype.load = function (streams, cb) {
var self = this
if (!Array.isArray(streams)) streams = [ streams ]
+ if (!cb) cb = function () {}
+ cb = once(cb)
+
var pieceIndex = 0
;(new MultiStream(streams))
.pipe(new BlockStream(self.pieceLength, { nopad: true }))