Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize seeding #1398

Merged
merged 2 commits into from Nov 28, 2018
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -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)
}
]
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.