{"id":13452464,"url":"https://github.com/scttcper/qbittorrent","last_synced_at":"2025-04-04T17:08:29.427Z","repository":{"id":37500741,"uuid":"174934613","full_name":"scttcper/qbittorrent","owner":"scttcper","description":"qBittorrent api wrapper","archived":false,"fork":false,"pushed_at":"2025-02-13T02:20:15.000Z","size":1494,"stargazers_count":46,"open_issues_count":2,"forks_count":17,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-29T10:37:19.016Z","etag":null,"topics":["qbittorrent","torrent-clients"],"latest_commit_sha":null,"homepage":"https://qbittorrent.vercel.app","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/scttcper.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2019-03-11T05:55:38.000Z","updated_at":"2025-02-25T16:07:37.000Z","dependencies_parsed_at":"2023-01-26T15:16:32.754Z","dependency_job_id":"2cb52454-0e73-4e51-a8b7-cb0df00311f8","html_url":"https://github.com/scttcper/qbittorrent","commit_stats":{"total_commits":199,"total_committers":11,"mean_commits":18.09090909090909,"dds":0.371859296482412,"last_synced_commit":"ca3b457ee584a0f866a69fbda1857e7929e63865"},"previous_names":["typectrl/qbittorrent"],"tags_count":53,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scttcper%2Fqbittorrent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scttcper%2Fqbittorrent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scttcper%2Fqbittorrent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scttcper%2Fqbittorrent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scttcper","download_url":"https://codeload.github.com/scttcper/qbittorrent/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247217184,"owners_count":20903009,"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":["qbittorrent","torrent-clients"],"created_at":"2024-07-31T07:01:24.828Z","updated_at":"2025-04-04T17:08:29.410Z","avatar_url":"https://github.com/scttcper.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# qBittorrent [![npm](https://badgen.net/npm/v/@ctrl/qbittorrent)](https://www.npmjs.com/package/@ctrl/qbittorrent) [![coverage](https://badgen.net/codecov/c/github/scttcper/qbittorrent)](https://codecov.io/gh/scttcper/qbittorrent)\n\n\u003e TypeScript api wrapper for [qBittorrent](https://www.qbittorrent.org/) using [ofetch](https://github.com/unjs/ofetch)\n\n### Install\n\n```console\nnpm install @ctrl/qbittorrent\n```\n\n### Use\n\n```ts\nimport { QBittorrent } from '@ctrl/qbittorrent';\n\nconst client = new QBittorrent({\n  baseUrl: 'http://localhost:8080/',\n  username: 'admin',\n  password: 'adminadmin',\n});\n\nasync function main() {\n  const res = await client.getAllData();\n  console.log(res);\n}\n```\n\n### API\n\nDocs: https://qbittorrent.vercel.app  \nqBittorrent Api Docs: https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)  \n\n### Normalized API\n\nThese functions have been normalized between torrent clients to easily support switching between multiple torrent clients. See [below](#see-also) for alternative supported torrent clients\n\n##### getAllData\n\nReturns all torrent data and an array of label objects. Data has been normalized and does not match the output of native `listTorrents()`.\n\n```ts\nconst data = await client.getAllData();\nconsole.log(data.torrents);\n```\n\n##### getTorrent\n\nReturns one torrent data from torrent hash\n\n```ts\nconst data = await client.getTorrent('torrent-hash');\nconsole.log(data);\n```\n\n##### pauseTorrent and resumeTorrent\n\nPause or resume a torrent\n\n```ts\nconst paused = await client.pauseTorrent();\nconsole.log(paused);\nconst resumed = await client.resumeTorrent();\nconsole.log(resumed);\n```\n\n##### removeTorrent\n\nRemove a torrent. Does not remove data on disk by default.\n\n```ts\n// does not remove data on disk\nconst result = await client.removeTorrent('torrent_id', false);\nconsole.log(result);\n\n// remove data on disk\nconst res = await client.removeTorrent('torrent_id', true);\nconsole.log(res);\n```\n\n##### addTorrent\n\nAdd a torrent, has client specific options. Also see normalizedAddTorrent\n\n```ts\nconst result = await client.addTorrent(fs.readFileSync(torrentFile));\nconsole.log(result);\n```\n\n##### normalizedAddTorrent\n\nAdd a torrent and return normalized torrent data, can start a torrent paused and add label\n\n```ts\nconst result = await client.normalizedAddTorrent(fs.readFileSync(torrentFile), {\n    startPaused: false;\n    label: 'linux';\n});\nconsole.log(result);\n```\n\n##### export and create from state\n\nIf you're shutting down the server often (serverless?) you can export the state\n\n```ts\nconst state = client.exportState()\nconst client = QBittorrent.createFromState(config, state);\n```\n\n### See Also\n\nAll of the following npm modules provide the same normalized functions along with supporting the unique apis for each client.\n\ndeluge - https://github.com/scttcper/deluge  \ntransmission - https://github.com/scttcper/transmission  \nutorrent - https://github.com/scttcper/utorrent\n\n### Start a test docker container\n\n```\ndocker run -d \\\n  --name=qbittorrent \\\n  -e PUID=1000 \\\n  -e PGID=1000 \\\n  -e TZ=Etc/UTC \\\n  -e WEBUI_PORT=8080 \\\n  -p 8080:8080 \\\n  -p 6881:6881 \\\n  -p 6881:6881/udp \\\n  --restart unless-stopped \\\n  lscr.io/linuxserver/qbittorrent:latest\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscttcper%2Fqbittorrent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscttcper%2Fqbittorrent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscttcper%2Fqbittorrent/lists"}