{"id":32709091,"url":"https://github.com/can-acar/bun-cancellation-token","last_synced_at":"2026-05-18T14:35:01.663Z","repository":{"id":320387799,"uuid":"1081830672","full_name":"can-acar/bun-cancellation-token","owner":"can-acar","description":"Lightweight cancellation tokens built on top of AbortController for Bun/TypeScript.","archived":false,"fork":false,"pushed_at":"2025-10-23T13:11:16.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-23T15:14:07.164Z","etag":null,"topics":["bun","typescript"],"latest_commit_sha":null,"homepage":"","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/can-acar.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-23T10:55:40.000Z","updated_at":"2025-10-23T13:11:22.000Z","dependencies_parsed_at":"2025-10-23T15:16:25.164Z","dependency_job_id":"88aa5dd3-1b72-4da2-8990-af7828ab3739","html_url":"https://github.com/can-acar/bun-cancellation-token","commit_stats":null,"previous_names":["can-acar/bun-cancellation-token"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/can-acar/bun-cancellation-token","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/can-acar%2Fbun-cancellation-token","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/can-acar%2Fbun-cancellation-token/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/can-acar%2Fbun-cancellation-token/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/can-acar%2Fbun-cancellation-token/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/can-acar","download_url":"https://codeload.github.com/can-acar/bun-cancellation-token/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/can-acar%2Fbun-cancellation-token/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33181149,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-18T09:27:30.708Z","status":"ssl_error","status_checked_at":"2026-05-18T09:27:28.300Z","response_time":71,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["bun","typescript"],"created_at":"2025-11-02T04:00:49.838Z","updated_at":"2026-05-18T14:35:01.658Z","avatar_url":"https://github.com/can-acar.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bun-cancellation-token\n\nLightweight cancellation tokens built on top of AbortController for Bun/TypeScript.\n\n## Install\n\n```bash\nbun add bun-cancellation-token\n```\n\n## Usage\n\n```ts\nimport { CancellationTokenSource, abortableDelay } from \"bun-cancellation-token\";\n\nconst src = new CancellationTokenSource();\n\n// cancel after 50ms\nsetTimeout(() =\u003e src.cancel(\"timeout\"), 50);\n\ntry {\n\tawait abortableDelay(500, src.token);\n} catch (err) {\n\tconsole.log(\"aborted:\", err);\n}\n```\n\n## Scripts\n\n- Dev: runs the entry module locally\n\n```bash\nbun run dev\n```\n\n- Test: runs unit tests with Bun's test runner\n\n```bash\nbun test\n```\n\n- Build: bundles to `dist/` for Bun target\n\n```bash\nbun run build\n```\n\nThis package is designed primarily as a Bun module and ships TypeScript sources for first-class Bun support.\n\n## Bun API Examples\n\nRun these examples to see integration with Bun runtime APIs:\n\n- Fetch with timeout (AbortSignal from token passed to fetch)\n\n```bash\nbun run ex:fetch\n```\n\n- Simple HTTP server with per-request timeouts and graceful shutdown\n\n```bash\nbun run ex:serve\n```\n\n- Concurrency with linked tokens (overall deadline cancels slower tasks)\n\n```bash\nbun run ex:concurrency\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcan-acar%2Fbun-cancellation-token","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcan-acar%2Fbun-cancellation-token","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcan-acar%2Fbun-cancellation-token/lists"}