diff options
-rw-r--r-- | index.js | 4 | ||||
-rw-r--r-- | lib/concat-stream.js | 14 | ||||
-rw-r--r-- | package.json | 1 |
3 files changed, 3 insertions, 16 deletions
@@ -1,5 +1,6 @@ module.exports = WebTorrent +var concat = require('simple-concat') var createTorrent = require('create-torrent') var debug = require('debug')('webtorrent') var DHT = require('bittorrent-dht/client') // browser exclude @@ -15,7 +16,6 @@ var Peer = require('simple-peer') var speedometer = require('speedometer') var zeroFill = require('zero-fill') -var concatStream = require('./lib/concat-stream') var TCPPool = require('./lib/tcp-pool') // browser exclude var Torrent = require('./lib/torrent') @@ -274,7 +274,7 @@ WebTorrent.prototype.seed = function (input, opts, onseed) { if (!Array.isArray(input)) input = [ input ] parallel(input.map(function (item) { return function (cb) { - if (isReadable(item)) concatStream(item, cb) + if (isReadable(item)) concat(item, cb) else cb(null, item) } }), function (err, input) { diff --git a/lib/concat-stream.js b/lib/concat-stream.js deleted file mode 100644 index c2d8860..0000000 --- a/lib/concat-stream.js +++ /dev/null @@ -1,14 +0,0 @@ -module.exports = function (stream, cb) { - var chunks = [] - stream.on('data', function (chunk) { - chunks.push(chunk) - }) - stream.once('end', function () { - if (cb) cb(null, Buffer.concat(chunks)) - cb = null - }) - stream.once('error', function (err) { - if (cb) cb(err) - cb = null - }) -} diff --git a/package.json b/package.json index 699c50c..97dc8e4 100644 --- a/package.json +++ b/package.json @@ -53,6 +53,7 @@ "render-media": "^2.0.0", "run-parallel": "^1.0.0", "run-parallel-limit": "^1.0.2", + "simple-concat": "^1.0.0", "simple-get": "^2.0.0", "simple-peer": "^6.0.0", "simple-sha1": "^2.0.0", |