Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
openexchangerates-api
Advanced tools
Yet another Node.js module to work with Open Exchange Rates
Yet another Node.js module to work with Open Exchange Rates API.
Existing implementations do not allow running of multiple client instances simultaneously. Also I added debugging output thanks to debug. And extended Error
object (RatesApiError
) is helpful when you get into trouble.
npm install openexchangerates-api --save
'use strict';
var RatesApi = require('openexchangerates-api');
var client = new RatesApi({
appId: 'YOUR_APP_ID'
});
client.currencies(function handleCurrencies(err, data) {
if (err) {
throw err;
}
else {
console.dir(data);
}
});
client.latest({base: 'EUR'}, function handleLatest(err, data) {
if (err) {
throw err;
}
else {
console.dir(data);
}
});
client.historical(new Date(2014, 0, 1), function handleHistorical(err, data) {
if (err) {
throw err;
}
else {
console.dir(data);
}
});
var start = new Date(2014, 11, 1);
var end = new Date(2014, 11, 10);
var options = {symbols: 'USD,EUR,RUB'};
client.timeSeries(start, end, options, function handleTimeSeries(err, data) {
if (err) {
throw err;
}
else {
console.dir(data);
}
});
client.convert(100, 'EUR', 'USD', function handleResult(err, data) {
if (err) {
throw err;
}
else {
console.dir(data);
}
});
Instantiate API client.
Arguments
object
- Client options
string
- Application ID. Mandatory if you want not only currencies.json.boolean
- Use HTTPS instead of HTTP. Defaults to true
string
- API base URL. Usually no need to change itobject
- Additional parameters for request
module. Read more hereSingle-Currency Conversion API call.
Arguments
number
- Amount in source currencystring
- Source currency 3-letter codestring
- Result currency 3-letter codeobject
- Additional query string options
number
- If you want pretty JSON, set it to 1
function
- Callback function which accepts (err, responseData)
Currencies request. For this you do not need options.appId
.
Arguments
function
- Callback function which accepts (err, responseData)
Historical Data call.
Arguments
Date
- Date for which you request ratesobject
- Additional query string options
string
- Base currency code. USD
by defaultstring
- Comma-separated list of currencies to returnfunction
- Callback function which accepts (err, responseData)
Latest Data call.
Arguments
object
- Additional query string options
string
- Base currency code. USD
by defaultstring
- Comma-separated list of currencies to returnfunction
- Callback function which accepts (err, responseData)
Time-Series / Bulk Download call.
Arguments
Date
- Start dateDate
- End dateobject
- Additional query string options
string
- Base currency code. USD
by defaultstring
- Comma-separated list of currencies to returnnumber
- If you want pretty JSON, set it to 1
function
- Callback function which accepts (err, responseData)
This Error class handles error responses.
Equals to errResponse.message
. Error code.
Equals to errResponse.status
. HTTP status code of call.
Equals to errResponse.description
.
The MIT License (MIT)
Copyright (c) 2014 Alexander Makarenko
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
Yet another Node.js module to work with Open Exchange Rates
The npm package openexchangerates-api receives a total of 35 weekly downloads. As such, openexchangerates-api popularity was classified as not popular.
We found that openexchangerates-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.