{"id":19240967,"url":"https://github.com/binocarlos/country-slice","last_synced_at":"2025-08-04T16:40:10.146Z","repository":{"id":14255413,"uuid":"16962958","full_name":"binocarlos/country-slice","owner":"binocarlos","description":"An array of country data with helper functions for generating lists of countries","archived":false,"fork":false,"pushed_at":"2014-02-18T21:18:39.000Z","size":168,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-02T23:52:01.529Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/binocarlos.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}},"created_at":"2014-02-18T20:40:15.000Z","updated_at":"2025-07-08T16:39:11.000Z","dependencies_parsed_at":"2022-08-27T11:12:15.744Z","dependency_job_id":null,"html_url":"https://github.com/binocarlos/country-slice","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/binocarlos/country-slice","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binocarlos%2Fcountry-slice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binocarlos%2Fcountry-slice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binocarlos%2Fcountry-slice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binocarlos%2Fcountry-slice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/binocarlos","download_url":"https://codeload.github.com/binocarlos/country-slice/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binocarlos%2Fcountry-slice/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268723143,"owners_count":24296548,"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","status":"online","status_checked_at":"2025-08-04T02:00:09.867Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-11-09T17:09:42.881Z","updated_at":"2025-08-04T16:40:10.062Z","avatar_url":"https://github.com/binocarlos.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"country-slice\n=============\n\nAn array of country data exposed that can be mapped or filtered\n\n## install\n\n```bash\n$ npm install country-slice\n```\n\n## source\n\nthe data was extracted from [mledoze/countries](https://github.com/mledoze/countries)\n\neach country object has the following fields:\n\n```js\n{ name: 'Afghanistan',\n  nativeName: 'Afġānistān',\n  tld: [ '.af' ],\n  cca2: 'AF',\n  ccn3: '004',\n  cca3: 'AFG',\n  currency: [ 'AFN' ],\n  callingCode: [ '93' ],\n  capital: 'Kabul',\n  altSpellings: [ 'AF', 'Afġānistān' ],\n  relevance: '0',\n  region: 'Asia',\n  subregion: 'Southern Asia',\n  language: [ 'Pashto', 'Dari' ],\n  languagesCodes: [ 'ps', 'uz', 'tk' ],\n  translations:\n   { de: 'Afghanistan',\n     en: 'Afghanistan',\n     es: 'Afganistán',\n     fr: 'Afghanistan',\n     it: 'Afghanistan',\n     ja: 'アフガニスタン',\n     nl: 'Afghanistan' },\n  population: 25500100,\n  latlng: [ 33, 65 ],\n  demonym: 'Afghan',\n  borders: [ 'IRN', 'PAK', 'TKM', 'UZB', 'TJK', 'CHN' ] }\n```\n\n## usage\n\nThere are a few ways to consume the list of countries:\n\n### raw()\n\nThis returns the json file by 'require'\n\n```js\nvar countries = require('country-slice');\n\nvar list = countries.raw();\n```\n\n### stream()\n\nThis returns an object stream that emits one country per data event:\n\n```js\nvar countries = require('country-slice');\n\nvar list = countries.stream();\n\nlist.on('data', function(country){\n\n\t// country is a JSON object\n})\n```\n\n### filepath()\n\nThis returns the full filepath to the .json file of countries\n\n```js\nvar countries = require('country-slice');\n\nvar filepath = countries.filepath();\n\n// e.g. /srv/projects/country-slice/src/countries.json\n\n```\n\n\n### filestream()\n\nThis returns a fs.createReadStream on the json file\n\n```js\nvar countries = require('country-slice');\n\nvar stream = countries.filestream();\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbinocarlos%2Fcountry-slice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbinocarlos%2Fcountry-slice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbinocarlos%2Fcountry-slice/lists"}