{"id":21700395,"url":"https://github.com/articulate/asyncios","last_synced_at":"2025-07-04T12:32:19.058Z","repository":{"id":57098959,"uuid":"197809983","full_name":"articulate/asyncios","owner":"articulate","description":null,"archived":false,"fork":false,"pushed_at":"2025-04-10T15:26:00.000Z","size":211,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":56,"default_branch":"master","last_synced_at":"2025-05-30T05:08:42.023Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/articulate.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-19T16:39:50.000Z","updated_at":"2025-04-10T15:25:27.000Z","dependencies_parsed_at":"2022-08-20T17:30:37.288Z","dependency_job_id":null,"html_url":"https://github.com/articulate/asyncios","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/articulate/asyncios","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/articulate%2Fasyncios","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/articulate%2Fasyncios/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/articulate%2Fasyncios/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/articulate%2Fasyncios/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/articulate","download_url":"https://codeload.github.com/articulate/asyncios/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/articulate%2Fasyncios/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263061403,"owners_count":23407606,"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-25T20:14:12.277Z","updated_at":"2025-07-04T12:32:19.028Z","avatar_url":"https://github.com/articulate.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# asyncios\n\nA [crocks Async](https://crocks.dev/docs/crocks/Async.html) wrapper for [axios](https://github.com/axios/axios). Allows consumers to take advantage of the \"lazy\" data type while keeping a familiar API.\n\n## How to Use\n\n`asyncios` accepts the same configuration arguments as the underlying axios function. [See the axios documentation for more details](https://github.com/axios/axios#request-config).\n\n```js\n// GET request\nasyncios({ method: 'GET', url: '/user?ID=12345' })\n  .fork(\n    error =\u003e console.log(error),\n    response =\u003e console.log(response)\n  )\n```\n\n```js\n// same GET request, but using `params` configuration\nasyncios({ method: 'GET', url: '/user', params: { ID: 12345 } })\n  .fork(\n    error =\u003e console.log(error),\n    response =\u003e console.log(response)\n  )\n```\n\n```js\n// POST request\nasyncios({\n  method: 'POST',\n  url: '/user?ID=12345',\n  data: { firstName: 'Fred', lastName: 'Flinstone' },\n})\n  .fork(\n    error =\u003e console.log(error),\n    response =\u003e console.log(response)\n  )\n```\n\n### Cancellation\n`Async`-style cancellation is supported. See the [crocks doucmentation for more details](https://crocks.dev/docs/crocks/Async.html).\n\n```js\nconst cancel = asyncios({ method: 'GET', url: '/user?ID=12345' })\n  .fork(\n    error =\u003e console.log(error),\n    response =\u003e console.log(response),\n    () =\u003e console.log('cancelled!')\n  )\n\ncancel()\n```\n\n`axios`'s cancellation token is also supported. Take note of the different behaviors--while cancelling via crocks will invoke `fork`'s third \"cancel\" callback, cancelling via axios will invoke `fork`'s first \"rejected\" callback. [See axios's documentation for more details](https://github.com/axios/axios#cancellation).\n\n```js\nconst source = axios.CancelToken.source()\n\nasyncios({\n  method: 'GET',\n  url: '/user?ID=12345',\n  cancelToken: source.token\n})\n  .fork(\n    error =\u003e {\n      if (axios.isCancel(error)) console.log(error.message)\n      else { /* handle error */ }\n    },\n    response =\u003e console.log(response)\n  )\n\nsource.cancel('My cancel message')\n\n```\n\n## Thanks\n\nThanks to the fine people who work on both [axios](https://github.com/axios/axios) \u0026 [crocks](https://crocks.dev/).\n\n\n## The Name\n\nPretty sure is [spencerfdavis](https://github.com/spencerfdavis)'s fault.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farticulate%2Fasyncios","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farticulate%2Fasyncios","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farticulate%2Fasyncios/lists"}