{"id":16993767,"url":"https://github.com/rwv/get-cloudflare-location","last_synced_at":"2025-03-22T15:31:01.683Z","repository":{"id":180558350,"uuid":"665323595","full_name":"rwv/get-cloudflare-location","owner":"rwv","description":"☁ A JavaScript function to get user's location based on Cloudflare /cdn-cgi/trace","archived":true,"fork":false,"pushed_at":"2025-02-17T06:30:40.000Z","size":298,"stargazers_count":13,"open_issues_count":7,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-01T17:11:52.826Z","etag":null,"topics":["browser","cloudflare","javascript","location","network"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/get-cloudflare-location","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/rwv.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":"2023-07-12T00:49:09.000Z","updated_at":"2025-02-17T06:32:54.000Z","dependencies_parsed_at":"2024-06-10T07:38:26.151Z","dependency_job_id":"d401c0a4-6161-4063-993b-393003e9b4e0","html_url":"https://github.com/rwv/get-cloudflare-location","commit_stats":null,"previous_names":["rwv/get-cloudflare-location"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwv%2Fget-cloudflare-location","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwv%2Fget-cloudflare-location/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwv%2Fget-cloudflare-location/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwv%2Fget-cloudflare-location/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rwv","download_url":"https://codeload.github.com/rwv/get-cloudflare-location/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244227577,"owners_count":20419262,"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":["browser","cloudflare","javascript","location","network"],"created_at":"2024-10-14T03:43:59.635Z","updated_at":"2025-03-22T15:31:01.677Z","avatar_url":"https://github.com/rwv.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ☁️ get-cloudflare-location\n\n\u003e [!CAUTION]  \n\u003e `https://cf-ns.com/cdn-cgi/trace` returns `404 Not Found` now. **Don't** use this package!\n\nA JavaScript function to get user's location based on Cloudflare `/cdn-cgi/trace`\n\n[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/rwv/get-cloudflare-location/build.yml)](https://github.com/rwv/get-cloudflare-location/actions/workflows/build.yml)\n[![npm](https://img.shields.io/npm/v/get-cloudflare-location)](https://www.npmjs.com/package/get-cloudflare-location)\n![NPM](https://img.shields.io/npm/l/get-cloudflare-location)\n\n## How it works\n\nThis function will send a request to `https://www.cloudflare.com/cdn-cgi/trace` and `https://cf-ns.com/cdn-cgi/trace` and parse the response to get the user's location.\n\n## Usage\n\n```bash\nnpm install get-cloudflare-location\n```\n\n```ts\nimport getCloudflareLocation from \"get-cloudflare-location\";\n\ninterface GetCloudflareLocationOptions {\n  timeout?: number; // The timeout for the request in milliseconds. Defaults to 5000\n  cache?: string; // Whether to cache the result of the request. Defaults to true.\n}\n\nconst options: GetCloudflareLocationOptions | undefined = {\n  timeout: 5000,\n  cache: true,\n};\n\nconst location = await getCloudflareLocation(options);\n```\n\n## cf-ns.com\n\n`cf-ns.com` is the domain of the Cloudflare China Network, allowing users in mainland China to get location in low latency.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frwv%2Fget-cloudflare-location","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frwv%2Fget-cloudflare-location","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frwv%2Fget-cloudflare-location/lists"}