{"id":18356683,"url":"https://github.com/aaravmalani/bencoder","last_synced_at":"2025-04-10T01:49:30.559Z","repository":{"id":168322299,"uuid":"644009480","full_name":"AaravMalani/bencoder","owner":"AaravMalani","description":"A parser for BitTorrent .torrent files","archived":false,"fork":false,"pushed_at":"2023-05-22T16:25:29.000Z","size":10,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-15T17:46:58.621Z","etag":null,"topics":["bencode","bencode-parser","bencoder","bencoding","bittorent","c","cmake","collaborate","library","torrent"],"latest_commit_sha":null,"homepage":"","language":"C","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/AaravMalani.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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":"2023-05-22T16:03:11.000Z","updated_at":"2024-02-08T11:37:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"f8ff76df-8b60-48aa-bc2d-1c9cf2eef103","html_url":"https://github.com/AaravMalani/bencoder","commit_stats":null,"previous_names":["aaravmalani/bencoder"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AaravMalani%2Fbencoder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AaravMalani%2Fbencoder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AaravMalani%2Fbencoder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AaravMalani%2Fbencoder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AaravMalani","download_url":"https://codeload.github.com/AaravMalani/bencoder/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248142807,"owners_count":21054667,"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":["bencode","bencode-parser","bencoder","bencoding","bittorent","c","cmake","collaborate","library","torrent"],"created_at":"2024-11-05T22:11:13.083Z","updated_at":"2025-04-10T01:49:30.530Z","avatar_url":"https://github.com/AaravMalani.png","language":"C","readme":"# bencoder: A parser for BitTorrent .torrent files\n\n## Installation\n- Go to the [latest release](https://github.com/AaravMalani/bencoder/releases/latest)\n- Download the RPM file for Red-Hat based Linux Systems, DEB file for Debian based systems or the DLL or LIB file for Windows\n```sh\n# Ubuntu/Debian\nsudo dpkg -i \u003cfile\u003e.deb\n\n# RedHat Based Linux\nsudo rpm -i \u003cfile\u003e.rpm\n```\nFor Windows, you have to link it into the Visual Studio Project using the Linker menu in the Properties of the Project.\nThen download the [`bencoder.h`](https://raw.githubusercontent.com/AaravMalani/bencoder/main/include/bencoder.h) file and include that as a header file.\n\n## Usage\n```c\n#include \u003cbencoder.h\u003e\n\nchar* bencodeTypes[4] = {\n    \"INTEGER\", // data = long long* (A pointer not a constant value)\n    \"STRING\", // data = char*\n    \"LIST\", // data = struct BencodeStructure* (contiguous structs not to be confused with array of pointers)\n    \"DICTIONARY\" // data = struct BencodeMap* (contiguous structs not to be confused with array of pointers)\n};\n\n\nint main(int argc, char **argv)\n{\n    if (argc != 2){\n        printf(\"Usage: %s \u003ctorrentfile\u003e\\n\", argv[0]);\n        return 1;\n    }\n    // Load file\n    FILE *f = fopen(argv[1], \"r\");\n    if (f == NULL)\n    {\n        perror(argv[1]);\n        return 1;\n    }\n    fseek(f, 0, SEEK_END);\n    size_t fsize = ftell(f);\n    rewind(f);\n    char *data = malloc(fsize);\n    fread(data, fsize, 1, f);\n    fclose(f);\n\n    // Parse bencode\n    struct BencodeStructure* struc = parseBencode(data, fsize);\n    free(data);\n    if (!struc) // Error\n    {\n        printf(\"Error parsing file\\n\");\n        return 1;\n    }\n    printf(\"Type: %s\\n\", bencodeTypes[struc-\u003etype]);\n    freeBencode(struc);\n}   \n```\n\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faaravmalani%2Fbencoder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faaravmalani%2Fbencoder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faaravmalani%2Fbencoder/lists"}