{"_id":"@avalabs/country-to-aws-region","_rev":"27-41cdfece0e8938743262313085b0962f","name":"@avalabs/country-to-aws-region","dist-tags":{"latest":"1.0.7"},"versions":{"1.0.7":{"name":"@avalabs/country-to-aws-region","version":"1.0.7","keywords":["aws","region","country","code","iso","iso2","cdn","geoip"],"author":{"name":"Dov Brand","email":"dov.brand@avalabs.org"},"license":"MIT","_id":"@avalabs/country-to-aws-region@1.0.7","maintainers":[{"name":"dov_brand","email":"dov.brand@avalabs.org"}],"contributors":[{"url":"https://github.com/Zeryther","name":"Mehdi Baaboura","email":"mbaaboura@gigadrivegroup.com"}],"homepage":"https://github.com/ava-labs/country-to-aws-region#readme","bugs":{"url":"https://github.com/ava-labs/country-to-aws-region/issues"},"dist":{"shasum":"14fe1e9563e57c8fc9a8c348559f7b8d1577d3db","tarball":"https://registry.npmjs.org/@avalabs/country-to-aws-region/-/country-to-aws-region-1.0.7.tgz","fileCount":18,"integrity":"sha512-yuogsKWV/ufywVt/z+566TPTUYnLPYRSzYV/h+Yxc96DZb6T1ECvdCmdxr5PHuOsCe2YSw3TU8yW6PGHnNdcSQ==","signatures":[{"sig":"MEQCIDSthwmFt3Uo0wIDDAdale1Y7WAK/ur4aNQqiAEOQxPHAiBuEiNMrFxWpBOYFUNBWf6wGEpHMpCnADBqpDb3NaTZlg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":453071},"main":"lib/index.js","types":"./lib/index.d.ts","unpkg":"dist/country-to-aws-region.min.js","module":"esm/index.js","browser":"dist/country-to-aws-region.min.js","gitHead":"74b6f1185b50f389efb0b30ec411e43c4ac245f3","scripts":{"lint":"eslint src update-data.mjs --ext .js,.ts","size":"limit-size","test":"jest","build":"npm run build:cjs && npm run build:esm && npm run build:umd","lint-fix":"eslint src update-data.mjs --ext .js,.ts --fix","build:cjs":"rimraf ./lib && tsc --module commonjs --outDir lib","build:esm":"rimraf ./esm && tsc --module ESNext --outDir esm","build:umd":"rimraf ./dist && rollup -c && npm run size","update-data":"node update-data.mjs"},"summary":"JS library that helps get the closest AWS region from a country code","_npmUser":{"name":"dov_brand","email":"dov.brand@avalabs.org"},"limit-size":[{"gzip":true,"path":"dist/country-to-aws-region.min.js","limit":"8 Kb"}],"repository":{"url":"git+https://github.com/ava-labs/country-to-aws-region.git","type":"git"},"_npmVersion":"8.19.3","description":"JS library that helps get the closest AWS region from a country code. This library is a copy of [country-to-aws-region](https://github.com/Zeryther/country-to-aws-region)","directories":{},"_nodeVersion":"18.13.0","officialName":"country-to-aws-region","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.2.1","tslib":"^2.4.0","eslint":"^8.25.0","rimraf":"^3.0.2","rollup":"^3.2.3","ts-jest":"^29.0.3","limit-size":"^0.1.4","node-fetch":"^3.2.10","typescript":"^4.8.4","@types/jest":"^29.2.0","eslint-plugin-n":"^15.3.0","eslint-plugin-import":"^2.26.0","eslint-plugin-promise":"^6.1.1","@rollup/plugin-typescript":"^9.0.1","@rollup/plugin-node-resolve":"^15.0.0","@lopatnov/rollup-plugin-uglify":"^2.1.5","@typescript-eslint/eslint-plugin":"^5.40.1","eslint-config-standard-with-typescript":"^23.0.0"},"_npmOperationalInternal":{"tmp":"tmp/country-to-aws-region_1.0.7_1732740902077_0.5932626601222635","host":"s3://npm-registry-packages"}}},"time":{"created":"2024-11-27T20:55:02.077Z","modified":"2026-06-29T14:28:47.291Z","1.0.3":"2024-11-18T19:41:01.499Z","1.0.4":"2024-11-21T00:50:34.841Z","1.0.5":"2024-11-21T16:33:23.893Z","1.0.6":"2024-11-27T19:19:15.425Z","1.0.7":"2024-11-27T20:55:02.257Z"},"bugs":{"url":"https://github.com/ava-labs/country-to-aws-region/issues"},"author":{"name":"Dov Brand","email":"dov.brand@avalabs.org"},"license":"MIT","homepage":"https://github.com/ava-labs/country-to-aws-region#readme","keywords":["aws","region","country","code","iso","iso2","cdn","geoip"],"repository":{"url":"git+https://github.com/ava-labs/country-to-aws-region.git","type":"git"},"description":"JS library that helps get the closest AWS region from a country code. This library is a copy of [country-to-aws-region](https://github.com/Zeryther/country-to-aws-region)","contributors":[{"url":"https://github.com/Zeryther","name":"Mehdi Baaboura","email":"mbaaboura@gigadrivegroup.com"}],"maintainers":[{"email":"martin.prado@avalabs.org","name":"martin.prado"},{"email":"chris.elbring@avalabs.org","name":"chriselbring-avalabs"},{"email":"desmond.henderson@avalabs.org","name":"des-ava"}],"readme":"# country-to-aws-region\nJS library that helps get the closest AWS region from a country code\n\nI have created this library, as I have faced the issue of targeting specific AWS regional endpoints from a Cloudflare Worker. Cloudflare gives me the user's country code in a request header, so I thought I could use this to my advantage.\n\nThis simple library helps you translate a country code to the nearest AWS region. It heavily relies on the Regional Data Centers mapping made by the TurnKey Linux team. You can find their repository [here](https://github.com/turnkeylinux/aws-datacenters). They also published an article about it [here](https://www.turnkeylinux.org/blog/geoip-amazon-regions).\n\n## Installation\n\n```sh\nnpm i country-to-aws-region\n```\n\n## Usage\n\n### Resolving the nearest AWS region\n\n```js\nimport { countryToAwsRegion } from 'country-to-aws-region';\n\nconst countryCode = 'DE'; // Get the country code from your request headers for example\n\nconsole.log(countryToAwsRegion(countryCode)); // eu-central-1\n```\n\n### Filtering by specific AWS regions\n\nSometimes, you only want specific AWS regions to be available. In that case, you can pass an array of regions as the second parameter. The function will filter out all regions that do not match.\n\n```js\nimport { countryToAwsRegion } from 'country-to-aws-region';\n\nconst countryCode = 'DE'; // Get the country code from your request headers for example\nconst regions = ['us-east-2', 'af-south-1'];\n\nconsole.log(countryToAwsRegion(countryCode, regions)); // us-east-2\n```\n\n## Contributing\n\n### Updating the data\n\nThis repository contains an automatic script that will fetch and parse the data from the [TurnKey Linux repository](https://github.com/turnkeylinux/aws-datacenters):\n\n```\nnpm run update-data\n```\n\n# attribution\n\nThis library is a copy of [country-to-aws-region](https://github.com/Zeryther/country-to-aws-region)\n\n## License\n\nThis program was created and published by [Mehdi Baaboura](https://github.com/Zeryther) under the [MIT License](https://github.com/Zeryther/country-to-aws-region/blob/master/LICENSE).\n","readmeFilename":"README.md"}