{"id":28364352,"url":"https://github.com/dcposch/webtorrent-remote","last_synced_at":"2025-06-24T03:31:45.716Z","repository":{"id":65990024,"uuid":"73336651","full_name":"dcposch/webtorrent-remote","owner":"dcposch","description":"Run WebTorrent in one process, control it from another process or even another machine","archived":false,"fork":false,"pushed_at":"2017-12-26T23:15:31.000Z","size":46,"stargazers_count":40,"open_issues_count":2,"forks_count":9,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-05-27T16:06:45.010Z","etag":null,"topics":["brave","electron","torrent","webtorrent"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dcposch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-11-10T01:35:58.000Z","updated_at":"2024-08-31T06:48:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"7613463a-4f1e-4d6a-ada6-6aad25210e17","html_url":"https://github.com/dcposch/webtorrent-remote","commit_stats":{"total_commits":47,"total_committers":4,"mean_commits":11.75,"dds":0.3191489361702128,"last_synced_commit":"b971779acf90f3d661fca92a41d98339eb300eb7"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcposch%2Fwebtorrent-remote","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcposch%2Fwebtorrent-remote/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcposch%2Fwebtorrent-remote/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcposch%2Fwebtorrent-remote/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dcposch","download_url":"https://codeload.github.com/dcposch/webtorrent-remote/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcposch%2Fwebtorrent-remote/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":258017914,"owners_count":22637263,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["brave","electron","torrent","webtorrent"],"created_at":"2025-05-28T20:44:01.637Z","updated_at":"2025-06-24T03:31:45.703Z","avatar_url":"https://github.com/dcposch.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# webtorrent-remote [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url]\n\n[npm-image]: https://img.shields.io/npm/v/webtorrent-remote.svg\n[npm-url]: https://npmjs.org/package/webtorrent-remote\n[downloads-image]: https://img.shields.io/npm/dm/webtorrent-remote.svg\n[downloads-url]: https://npmjs.org/package/webtorrent-remote\n[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg\n[standard-url]: https://standardjs.com\n\nrun WebTorrent in one process, control it from another process or even another machine.\n\nplain Javascript, no es6\n\n## server process\n\n```js\nvar WebTorrentRemoteServer = require('webtorrent-remote/server')\n\nvar opts = null\nvar server = new WebTorrentRemoteServer(send, opts)\n\nfunction send (message) {\n  // Send `message` to the correct client. It's JSON serializable.\n  // Use TCP, some kind of IPC, whatever.\n  // If there are multiple clients, look at message.clientKey\n}\n\n// When messages come back from the IPC channel, call:\nserver.receive(message)\n```\n\n### server options\n\n#### `opts.heartbeatTimeout`\n\nremove clients if we don't hear a heartbeat for this many milliseconds. default\n30000 (30 seconds). set to 0 to disable the heartbeat check. once a torrent has no\nremaining clients, it will be removed. once there are no remaining torrents, the\nwhole webtorrent   instance will be destroyed. the webtorrent instance is created\nlazily the first time a client   calls `add()`.\n\n#### `opts.updateInterval`\n\nsend progress updates every x milliseconds to all clients of all torrents. default\n1000 (1 second). set to 0 to disable progress updates.\n\n#### other options\n\nall WebTorrent options. the options object is passed to the constructor for the\nunderlying WebTorrent instance.\n\n#### debugging\n\nThis package uses [`debug`](https://www.npmjs.com/package/debug) for debug logging. Set the environment variable `DEBUG=webtorrent-remote` for detailed debug logs.\n\n## client process(es)\n\n```js\nvar WebTorrentRemoteClient = require('webtorrent-remote/client')\n\nvar opts = null\nvar client = new WebTorrentRemoteClient(send, opts)\n\nfunction send (message) {\n  // Same as above, except send the message to the server process\n}\n\n// When messages come back from the server, call:\nclient.receive(message)\n\n// Now `client` is a drop-in replacement for the normal WebTorrent object!\nvar torrentId = 'magnet:?xt=urn:btih:6a9759bffd5c0af65319979fb7832189f4f3c35d'\nclient.add(torrentId, function (err, torrent) {\n  torrent.on('metadata', function () {\n    console.log(JSON.stringify(torrent.files))\n    // Prints [{name:'sintel.mp4'}]\n  })\n\n  var server = torrent.createServer()\n  server.listen(function () {\n    console.log('http://localhost:' + server.address().port)\n    // Paste that into your browser to stream Sintel!\n  })\n})\n```\n\n### client options\n\n#### `opts.heartbeat`\n\nsend a heartbeat once every x milliseconds. default 5000 (5 seconds). set to 0 to\ndisable heartbeats.\n\n### client methods\n\n#### `client.add(torrentID, [options], callback)`\n\nlike `WebTorrent.add`, but only async. calls back with `(err, torrent)`. The\n`torrent` is a torrent object (see below for methods).\n\n#### `client.get(torrentID, callback)`\n\nlike `WebTorrent.get`, but async. calls back with `(err, torrent)`. if the\ntorrentId is not yet in the client, `err.name` will be `'TorrentMissingError'`.\n\n#### `client.destroy()`\n\nlike `WebTorrent.destroy`, but destroys only this client. if a given torrent has\nno clients left, it will be destroyed too. if all torrents are gone, the whole\nWebTorrent instance will be destroyed on the server side.\n\n### client events, from webtorrent\n\n- `client.on('error', () =\u003e {...})`\n- `client.on('warning', () =\u003e {...})`\n\n### torrent methods\n\nthe client gives you a torrent object in the callback to `get` or `add`. this\nsupports a subset of the WebTorrent API, forwarding commands to the\nWebTorrentRemoteServer and emitting events:\n\n#### `torrent.createServer()`\n\ncreate a local torrent-to-HTTP streaming server.\n\n### torrent events, unique to webtorrent-remote, not in webtorrent\n\n- `torrent.on('update', () =\u003e {...})`: fires periodically, see `updateInterval`\n\n### torrent events, from webtorrent\n\n- `torrent.on('infohash', () =\u003e {...})`\n- `torrent.on('metadata', () =\u003e {...})`\n- `torrent.on('download', () =\u003e {...})`\n- `torrent.on('upload', () =\u003e {...})`\n- `torrent.on('done', () =\u003e {...})`\n- `torrent.on('error', () =\u003e {...})`\n- `torrent.on('warning', () =\u003e {...})`\n\n### torrent props unique to webtorrent-remote, not in webtorrent\n\n- `torrent.client`: the WebTorrentRemoteClient\n- `torrent.key`: the clientKey used for messaging\n\n### torrent props, from webtorrent (updated once on `infohash` or `metadata`)\n\n- `torrent.infoHash`\n- `torrent.name`\n- `torrent.length`\n- `torrent.files`\n\n### torrent props, from webtorrent (updated on every `progress` event)\n\n- `torrent.progress`\n- `torrent.downloaded`\n- `torrent.uploaded`\n- `torrent.downloadSpeed`\n- `torrent.uploadSpeed`\n- `torrent.numPeers`\n- `torrent.progress`\n- `torrent.timeRemaining`\n\n### server methods\n\n#### `server.address()`\n\ngets an address object like `{ address: '::', family: 'IPv6', port: 52505 }` that\nshows what host and port the server is listening on.\n\n#### `server.listen(onlistening)`\n\ntells the server to start listening. the `onlistening` function is called when the server starts listening.\n\n### server events\n\n- `server.on('listening', () =\u003e {...})`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcposch%2Fwebtorrent-remote","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdcposch%2Fwebtorrent-remote","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcposch%2Fwebtorrent-remote/lists"}