🚀. Socket Launch Week Day 2:Introducing Manifest Alerts.Learn more
Sign In

@tianyuio/worldbank-cli

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tianyuio/worldbank-cli

World Bank Open Data CLI

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

World Bank CLI 🌐

npm version License: MIT

World Bank CLI based on World Bank Open Data API, which provides query capabilities for global economic and social development data.

Features

  • List countries with optional region and income-level filters
  • Look up detailed metadata for a specific country
  • Search indicators by keyword
  • Query time-series data for a country and indicator
  • Use friendly indicator aliases such as GDP, POPULATION, and LIFE_EXPECTANCY
  • Show the latest available observation with --latest
  • List supported World Bank income-level codes directly in the terminal
  • List supported World Bank region codes directly in the terminal
  • Output either readable tables or raw JSON
  • Export list and time-series output as CSV

Installation

Install globally with npm

npm install -g @tianyuio/worldbank-cli
wb help

Run instantly with npx

npx @tianyuio/worldbank-cli help

Usage

wb countries [--region REGION] [--income-level LEVEL] [--limit N] [--json] [--format table|csv|json]
wb country <country-code> [--json]
wb indicators <keyword> [--limit N] [--json] [--format table|csv|json]
wb data <country-code> <indicator> [--years N] [--latest] [--json] [--format table|csv|json]
wb income-levels [--json] [--format table|csv|json]
wb regions [--json] [--format table|csv|json]
wb aliases

Examples

wb countries --limit 10
wb countries --region EAS --limit 20
wb country CN
wb indicators literacy
wb data US GDP --latest
wb data US GDP --years 5 --format csv
wb income-levels
wb regions
wb data IN SP.POP.TOTL --json
wb aliases

Commands

wb countries

List countries from the World Bank API.

Options:

  • --region <code>: Filter by region code
  • --income-level <code>: Filter by income level code
  • --limit <n>: Limit the number of returned rows
  • --json: Print raw JSON instead of a table
  • --format <type>: Print as table, csv, or json

wb country <country-code>

Show country metadata such as region, income level, capital city, and coordinates.

Examples:

wb country US
wb country BR --json

wb indicators <keyword>

Search for matching indicators.

Examples:

wb indicators gdp
wb indicators "life expectancy"
wb indicators gdp --format csv

wb data <country-code> <indicator>

Query time-series indicator data for a country.

The <indicator> argument accepts either:

  • A friendly alias like GDP, GDP_GROWTH, POPULATION, or LIFE_EXPECTANCY
  • A raw World Bank indicator id like SP.POP.TOTL

Options:

  • --years <n>: Number of years to fetch, default 10
  • --latest: Return only the latest available observation
  • --json: Print raw JSON instead of a table
  • --format <type>: Print as table, csv, or json

Examples:

wb data CN GDP --years 10
wb data US GDP --latest
wb data US GDP --years 5 --format csv
wb data KE LIFE_EXPECTANCY
wb data DE NY.GDP.PCAP.CD

wb income-levels

List the common World Bank income-level codes used by the wb countries --income-level ... filter.

Examples:

wb income-levels
wb income-levels --format csv

wb regions

List the common World Bank region codes used by the wb countries --region ... filter.

Examples:

wb regions
wb regions --format csv

wb aliases

Print the built-in alias table for common indicators.

Supported Indicators

Economic Indicators

Indicator CodeDescriptionUnit
GDPGross Domestic ProductCurrent US$
GDP_GROWTHGDP growth rateAnnual %
GDP_PER_CAPITAGDP per capitaCurrent US$
GNIGross National IncomeCurrent US$
GNI_PER_CAPITAGNI per capitaCurrent US$
EXPORTS_GDPExports of goods and services% of GDP
FDI_NETForeign direct investment, net inflowsCurrent US$
INFLATIONInflation rateAnnual %
UNEMPLOYMENTUnemployment rate% of total labor force

Social Indicators

Indicator CodeDescriptionUnit
POPULATIONPopulation, totalPeople
LIFE_EXPECTANCYLife expectancy at birthYears
BIRTH_RATEBirth rateper 1,000 people
DEATH_RATEDeath rateper 1,000 people
INTERNET_USERSInternet users% of population

Education Indicators

Indicator CodeDescriptionUnit
LITERACY_RATELiteracy rate% of people ages 15 and above
SCHOOL_ENROLLMENTSchool enrollment, primary% gross
SCHOOL_COMPLETIONPrimary completion rate% of relevant age group
TEACHERS_PRIMARYTeachers in primary educationCount
EDUCATION_EXPENDITUREGovernment expenditure on education% of GDP

Health and Nutrition Indicators

Indicator CodeDescriptionUnit
HEALTH_EXPENDITURECurrent health expenditure% of GDP
PHYSICIANSPhysiciansper 1,000 people
HOSPITAL_BEDSHospital bedsper 1,000 people
IMMUNIZATIONImmunization, measles% of children ages 12-23 months
HIV_PREVALENCEPrevalence of HIV% of population ages 15-49
MALNUTRITIONPrevalence of undernourishment% of population
TUBERCULOSISIncidence of tuberculosisper 100,000 people

Common Country Codes

CountryCodeCountryCode
ChinaCNUnited StatesUS
JapanJPGermanyDE
United KingdomGBFranceFR
IndiaINBrazilBR
RussiaRUAustraliaAU

Project Structure

worldbank-cli/
├── src/
│   ├── cli.js         # CLI entry point
│   ├── format.js      # Table and JSON output helpers
│   └── worldbank.js   # World Bank API client and indicator aliases
├── test/
│   └── basic.test.js  # Basic tests
├── package.json       # Package configuration
├── README.md          # Documentation
└── LICENSE            # MIT license

Technology Stack

  • Node.js - Runtime environment
  • Native Fetch API - HTTP requests to the World Bank API
  • Node Test Runner - Built-in test framework
  • Plain JavaScript (ES Modules) - Lightweight CLI implementation without external runtime dependencies

API Endpoints

This project uses the World Bank Open Data API:

  • Base URL: https://api.worldbank.org/v2
  • Country data: /country
  • Country details: /country/{code}
  • Indicator catalog: /indicator
  • Country indicator data: /country/{code}/indicator/{id}

Development

Run locally

node ./src/cli.js help

Install globally from a local checkout

npm install -g .
wb help

Run tests:

npm test

Run the CLI directly:

node ./src/cli.js help

Notes

  • The CLI uses the public World Bank Open Data API at https://api.worldbank.org/v2
  • API availability and response completeness depend on the World Bank service
  • Some indicators have missing values for recent years, so the CLI filters out null observations

License

MIT

Keywords

worldbank

FAQs

Package last updated on 19 Mar 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts