Skip to content

Commit

Permalink
Merge pull request #1398 from KayleePop/seed-verify
Browse files Browse the repository at this point in the history
Optimize seeding
  • Loading branch information
DiegoRBaquero committed Nov 28, 2018
2 parents 0b2ddda + 5883e59 commit c32790d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion index.js
Expand Up @@ -257,13 +257,20 @@ 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
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)
}
]
Expand Down

0 comments on commit c32790d

Please sign in to comment.