{"id":15467901,"url":"https://github.com/rangermauve/bt-fetch","last_synced_at":"2025-05-02T15:54:20.976Z","repository":{"id":38317687,"uuid":"352744840","full_name":"RangerMauve/bt-fetch","owner":"RangerMauve","description":"Interact with Bittorrent the same way you would websites via fetch()","archived":false,"fork":false,"pushed_at":"2023-06-29T21:04:54.000Z","size":160,"stargazers_count":22,"open_issues_count":2,"forks_count":4,"subscribers_count":3,"default_branch":"default","last_synced_at":"2025-05-01T15:06:14.703Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RangerMauve.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":"2021-03-29T18:26:46.000Z","updated_at":"2024-11-30T19:36:28.000Z","dependencies_parsed_at":"2024-10-23T06:22:52.557Z","dependency_job_id":"e052a624-dcdb-4cc0-bb13-8a808c229aa2","html_url":"https://github.com/RangerMauve/bt-fetch","commit_stats":{"total_commits":109,"total_committers":5,"mean_commits":21.8,"dds":0.3211009174311926,"last_synced_commit":"244e1d104abc6aba5c989b9912109d722891e8be"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RangerMauve%2Fbt-fetch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RangerMauve%2Fbt-fetch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RangerMauve%2Fbt-fetch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RangerMauve%2Fbt-fetch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RangerMauve","download_url":"https://codeload.github.com/RangerMauve/bt-fetch/tar.gz/refs/heads/default","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251895480,"owners_count":21661345,"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-10-02T01:30:07.557Z","updated_at":"2025-05-01T15:06:30.115Z","avatar_url":"https://github.com/RangerMauve.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bt-fetch\nInteract with Bittorrent the same way you would websites via fetch() and `bittorrent://` or `bt://` URLs\n\n## How it works\n\n- Uses WebTorrent to load torrents\n- `bittorrent://` URLs put the `infohash` of a torrent into the `hostname` portion\n- `bittorrent://` URLs can contain an individual file to prioritize downloading\n- `bittorrent://` URLs can point to a folder path to get a listing\n\n## API\n\n```JavaScript\nimport makeBTFetch from 'bt-fetch'\n\nconst fetch = makeBTFetch({\n  // Use this if you want things to be downloaded somewhere specific\n  folder: '~/.local/data/bt-fetch/'\n  // You can also pass any arguments from `new WebTorrent` and `client.add`\n})\n\n// Get a file as text\nconst res = fetch('bittorrent://08ada5a7a6183aae1e09d831df6748d566095a10/example.html')\n\nconst content = await res.text()\n\n// How big is the file in bytes (useful in HEAD requests)\nconst length = res.headers.get('Content-Length')\n// How much of the file has been downloaded in bytes\nconst downloaded = res.headers.get('X-Downloaded')\n\n// List files / subfolders as JSON\nconst res = await fetch('bittorrent://infohash/path/')\n\nconst files = await res.json()\n\n// List the contents as a web page\nconst res = await fetch('bittorrent://infohash/path/', {headers: {\n  Accept: 'text/html'\n})\n\nconst page = await res.text()\n\n// now also supports public keys bittorrent://64CharacterPublicKeyHere\nconst pubRes = fetch('bittorrent://1e267e045c1abcb9af26df782a048a1cfd2d26e6db23ff5026b213ce037301bf')\n```\n\n## TODO\n\n- Pass querystring params from magnet link info (trackers, etc)\n- Support `index.html` resolution (with opt-out)\n- Creating torrents using POST\n- Mutable torrent record exchange (updates without DHT polling)\n- Support some sort of DNS based on DNSLink\n- Extension messages with EventSource a-la hypercore-fetch\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frangermauve%2Fbt-fetch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frangermauve%2Fbt-fetch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frangermauve%2Fbt-fetch/lists"}