diff options
author | Kaylee <34007889+KayleePop@users.noreply.github.com> | 2018-05-17 20:57:17 +0300 |
---|---|---|
committer | KayleePop <34007889+KayleePop@users.noreply.github.com> | 2018-08-29 21:14:34 +0300 |
commit | c49ae22d52417e976533e364fbf98ce8c41df384 (patch) | |
tree | 26e527f6b8ad600b7c672b95db2292def1bce2bf /index.js | |
parent | b14d36fe80192e600ed6ab8372c27d061762d6ad (diff) |
Don't call torrent.load when a FS path is seeded
Diffstat (limited to 'index.js')
-rw-r--r-- | index.js | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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) } ] |