🚀 Socket Launch Week 🚀 Day 5: Introducing Socket Fix.Learn More
Socket
Sign inDemoInstall
Socket

cached-open-exchange-rates

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

cached-open-exchange-rates

Open Exchange Rates SDK that caches results to avoid hitting the usage limit

0.1.0
latest
Source
npm
Version published
Weekly downloads
4
Maintainers
1
Weekly downloads
 
Created
Source

cached-open-exchange-rates-sdk

Open Exchange Rates SDK that caches results to avoid hitting the usage limit

Usage

const coxr = require('cached-open-exchange-rates');
const oxr = coxr(
  // Cache configurations
  {
    path: '.open-exchange-rates-cache.json', // cache file, for persistance even on restarts
    duration: 'PT12H' // 12 hour cache, must be an ISO duration -- https://en.wikipedia.org/wiki/ISO_8601#Durations
  },
  // Open Exchange Rate configurations
  // This object is passed to the OXR SDK -- https://github.com/openexchangerates/npm-exchange-rates
  {
    app_id: '1234...' // Open Exchange Rate App ID
  }
);

await oxr.request(); // Directly requests from OXR
await oxr.cached(); // Tries the cache, throws an error if there is no cached value
await oxr.cachedOrRequest(); // Tries the cache and requests from OXR if is not present

Keywords

oxr

FAQs

Package last updated on 22 Mar 2018

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