From c49ae22d52417e976533e364fbf98ce8c41df384 Mon Sep 17 00:00:00 2001 From: Kaylee <34007889+KayleePop@users.noreply.github.com> Date: Thu, 17 May 2018 12:57:17 -0500 Subject: [PATCH 1/2] Don't call torrent.load when a FS path is seeded --- index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 7466a9e540..887c47396f 100644 --- a/index.js +++ b/index.js @@ -257,13 +257,17 @@ class WebTorrent extends EventEmitter { this._debug('seed') opts = opts ? Object.assign({}, opts) : {} + const isFilePath = typeof input === 'string' + // When seeding from fs path, initialize store from that path to avoid a copy - if (typeof input === 'string') opts.path = path.dirname(input) + if (isFilePath) opts.path = path.dirname(input) if (!opts.createdBy) opts.createdBy = `WebTorrent/${VERSION_STR}` const onTorrent = torrent => { const tasks = [ cb => { + // when a filesystem path is specified, files are already in the FS store + if (isFilePath) return cb() torrent.load(streams, cb) } ] From 5883e59167474b6572cf53095f31778d70f24075 Mon Sep 17 00:00:00 2001 From: Kaylee <34007889+KayleePop@users.noreply.github.com> Date: Fri, 18 May 2018 15:48:40 -0500 Subject: [PATCH 2/2] Don't verify files in client.seed() --- index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/index.js b/index.js index 887c47396f..3b5e6f721c 100644 --- a/index.js +++ b/index.js @@ -257,6 +257,9 @@ class WebTorrent extends EventEmitter { this._debug('seed') opts = opts ? Object.assign({}, opts) : {} + // no need to verify the hashes we create + opts.skipVerify = true + const isFilePath = typeof input === 'string' // When seeding from fs path, initialize store from that path to avoid a copy