npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

globalexchangerates

v1.0.4

Published

A JavaScript/TypeScript client library for interacting with the Global Exchange Rates API. Works in both Node.js and browser environments.

Readme

Global Exchange Rates Client

This is a TypeScript/JavaScript library designed to interact with the Global Exchange Rates API.

It provides a set of methods for retrieving exchange rates, currency and providers information, and converting amounts between currencies. The library is compatible with both Node.js and browser environments.

Global Exchange Rates API

The Global Exchange Rates API provides a simple and reliable way to download official exchange rates from central banks and tax authorities (providers) worldwide.

You can check the updated list from the official website.

Daily exchange rates of all the available currencies are also provided, calculated using a proprietary algorithm blending the official data from central banks and the market rate from commercial institutions.

Ideal for accounting, CRM and ERP systems, business intelligence, auditing, tax compliance and reporting.

Getting Started

  1. Sign up to the Developer API Portal and start the 30 day free trial.
  2. Get your API key.
  3. Install via npm:
npm install globalexchangerates

Usage

TypeScript

import { GlobalExchangeRatesClient } from 'globalexchangerates';

// Create a client instance
const client = new GlobalExchangeRatesClient('your_api_key');

async function fetchLatestRates() {
  try {
    // Get the latest exchange rates
    const rates = await client.getLatest();
    console.log(rates);
    
    // Get currencies
    const currencies = await client.getCurrencies();
    console.log(currencies);
    
    // Convert
    const conversion = await client.convert(100, 'USD', ['EUR', 'GBP', 'JPY']);
    console.log(conversion);
  } catch (error) {
    console.error('Error fetching exchange rates:', error);
  }
}

fetchLatestRates();

JavaScript (ESM)

import { GlobalExchangeRatesClient } from 'globalexchangerates';

// Create a client instance
const client = new GlobalExchangeRatesClient('your_api_key');

// Get the latest exchange rates
client.getLatest()
  .then(rates => console.log(rates))
  .catch(error => console.error('Error fetching exchange rates:', error));

JavaScript (CommonJS)

const { GlobalExchangeRatesClient } = require('globalexchangerates');

// Create a client instance
const client = new GlobalExchangeRatesClient('your_api_key');

// Get the latest exchange rates
client.getLatest()
  .then(rates => console.log(rates))
  .catch(error => console.error('Error fetching exchange rates:', error));

Browser

<!-- Using CDN-->
<script src="https://cdn.jsdelivr.net/npm/globalexchangerates/dist/index.global.js"></script>
<script>
  // Get the latest exchange rates
  client.getLatest()
    .then(rates => console.log(rates))
    .catch(error => console.error('Error fetching exchange rates:', error));
</script>

API Reference

The client provides the following methods:

  • getCurrencies(codes?: string[]): Promise<Currency[]>
  • getLatest(provider?: string, currencies?: string[], baseCurrency?: string): Promise<ExchangeRateResponse>
  • getProviders(codes?: string[], countryCode?: string): Promise<Provider[]>
  • getHistorical(date: Date, latest?: boolean, provider?: string, currencies?: string[], baseCurrency?: string): Promise<ExchangeRateResponse>
  • convert(amount: number, baseCurrency?: string, toCurrencies?: string[], provider?: string, date?: Date): Promise<ConversionResponse>

All methods return promises that resolve to the corresponding data structure.

TypeScript types are included with the package for a better development experience with intelligent code completion.

License

This project is licensed under the MIT License.

Full Documentation

The full API documentation is available at doc.globalexchangerates.org.

Contacts and support

[email protected].