{"id":21969568,"url":"https://github.com/cinderblock/node-deluge-rpc","last_synced_at":"2025-04-28T10:15:37.791Z","repository":{"id":33288385,"uuid":"157283429","full_name":"cinderblock/node-deluge-rpc","owner":"cinderblock","description":"Node.js API for Deluge's RPC API","archived":false,"fork":false,"pushed_at":"2023-01-04T21:53:19.000Z","size":1158,"stargazers_count":6,"open_issues_count":10,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-07T02:06:51.773Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/cinderblock.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}},"created_at":"2018-11-12T22:04:13.000Z","updated_at":"2023-11-07T12:50:07.000Z","dependencies_parsed_at":"2023-01-15T00:23:59.557Z","dependency_job_id":null,"html_url":"https://github.com/cinderblock/node-deluge-rpc","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cinderblock%2Fnode-deluge-rpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cinderblock%2Fnode-deluge-rpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cinderblock%2Fnode-deluge-rpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cinderblock%2Fnode-deluge-rpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cinderblock","download_url":"https://codeload.github.com/cinderblock/node-deluge-rpc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227141232,"owners_count":17736775,"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":[],"created_at":"2024-11-29T14:22:21.760Z","updated_at":"2024-11-29T14:22:22.462Z","avatar_url":"https://github.com/cinderblock.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Node.js Deluge RPC Socket\n\nNode.js API for Deluge's RPC API\n\n[![](https://github.com/cinderblock/node-deluge-rpc/workflows/Main/badge.svg?branch=master)](https://github.com/cinderblock/node-deluge-rpc/actions?query=branch%3Amaster)\n[![Coverage Status](https://coveralls.io/repos/github/cinderblock/node-deluge-rpc/badge.svg?branch=master)](https://coveralls.io/github/cinderblock/node-deluge-rpc?branch=master)\n\n## Setup\n\n```bash\nyarn add deluge-rpc-socket\n```\n\n## Usage\n\n```ts\nimport Deluge, { isRPCError } from 'deluge-rpc-socket';\nimport { connect } from 'tls';\n\nconst socket = tls.connect(58846, {\n  // Deluge often runs with self-signed certificates\n  rejectUnauthorized: false,\n});\n\nconst rpc = DelugeRPC(socket);\n\n// Listen for asynchronous events from daemon\nrpc.events.on('delugeEvent', console.log);\n\n// Non fatal decoding errors that indicate something is wrong with the protocol...\nrpc.events.on('decodingError', console.log);\n\n// Wait for socket.on('secureConnect', ...) event before running the following example functions\n\nasync function login(username: string, password: string): Promise\u003cboolean\u003e {\n  // `sent` monitors if the request was actually sent to Deluge or if there was some error on our end\n  // `result` resolves when we get a response from the remote server\n  const { result, sent } = rpc.daemon.login(username, password);\n\n  try {\n    await sent;\n  } catch (e) {\n    console.log('Login message not sent');\n    return false;\n  }\n\n  console.log('Login message sent');\n\n  // If message was not sent, this will never resolve.\n  const res = await result;\n\n  if (isRPCError(res)) {\n    console.log('Error result!');\n    console.log(res.error);\n    return false;\n  }\n\n  console.log('Login result:');\n  console.log(res);\n\n  return true;\n}\n\nasync function addTorrent(url: string): Promise\u003cboolean\u003e {\n  // `sent` monitors if the request was actually sent to Deluge or if there was some error on our end\n  // `result` resolves when we get a response from the remote server\n  const { result, sent } = rpc.core.addTorrentUrl(url);\n\n  try {\n    await sent;\n  } catch (e) {\n    console.log('Add Torrent message not sent');\n    return false;\n  }\n\n  console.log('Add Torrent message sent');\n\n  // If message was not sent, this will never resolve.\n  const res = await result;\n\n  if (isRPCError(res)) {\n    console.log('Error result from Add Torrent!');\n    console.log(res.error);\n    return false;\n  }\n\n  console.log('Add Torrent result:', res);\n\n  return true;\n}\n```\n\n### Arguments\n\nAll arguments to API functions at any depth can be Promises.\n\n#### camelCase vs snake_case\n\nAll of Deluge's arguments are snake_case.\nAny named arguments will be converted to Deluge's snake_keys convention.\n\n## Change Log\n\n### v0.5.0 (WIP)\n\n#### Breaking changes\n\n- Removed \"Alternate API\" and made it default\n\n#### New Features\n\n- Automatic detection of remote version\n- Automated testing against versions\n- Consistent Typings on API\n- Made new Alternate API that is more like the original but has stricter types (WIP)\n\n### v0.4.0\n\n_TODO_\n\n\u003c!-- NOPUBLISH --\u003e\n\n## Development\n\n```bash\nyarn setup\n# Launch a REPL with `DelugeRPC` and `config` available in the context and useful commands in history\nyarn start\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcinderblock%2Fnode-deluge-rpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcinderblock%2Fnode-deluge-rpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcinderblock%2Fnode-deluge-rpc/lists"}