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.
A node.js client library for Forecast.io API.
For explanation and more detailed info about endpoints and response format see Forecast.IO API documentation
npm install forecastio
Say you need a forecast for London, UK:
var ForecastIo = require('forecastio');
var forecastIo = new ForecastIo('<apiKey>');
forecastIo.forecast('51.506', '-0.127').then(function(data) {
console.log(JSON.stringify(data, null, 2));
});
Forecast.io also supports Time Machine requests. Quoting official documentation you can make request for "60 years in the past to 10 years in the future" for "many places". Example:
// What was the weather like in London on January 1st 2008?
forecastIo.timeMachine('51.506', '-0.127', '2008-01-01T00:00:01Z').then(function(data) {
console.log(JSON.stringify(data, null, 2));
});
Both #forecast()
and #timeMachine()
methods support passing additional options.
Below are some examples, for all options consult Options section of Forecast.IO API documentation.
Example of requesting ad forecast in Si(metric) units with only 'daily' fields:
var options = {
units: 'si',
exclude: 'currently,hourly,flags'
};
forecastIo.forecast('49.844', '24.028', options).then(function(data) {
console.log(JSON.stringify(data, null, 2));
});
Another example, a "Time Machine" request in UK units and localized in Italian:
var options = {
units: 'uk',
lang: 'it'
};
forecastIo.timeMachine('49.844', '24.028', '2008-01-01T00:00:01Z', options).then(function(data) {
console.log(JSON.stringify(data, null, 2));
});
To set timeout for requests pass a timeout option to constructor, example:
var forecastIo = new ForecastIo('<apiKey>', {timeout: 30*1000});
As a result all API request made with with this forecastIo
instance will have a timeout of 30 seconds.
Timeout option accepts time in milliseconds. If request will not finish in time - a callback will be fired with a timeout error.
Date
object in #timeMachine()
and convert it to string, for example)Fork the repo & commit changes
Make sure tests are not failing:
$ env FORECASTIO_API_KEY=your_api_key
npm test
Create a pull request
timeout
optionFAQs
A node.js wrapper for Forecast.io API
The npm package forecastio receives a total of 10 weekly downloads. As such, forecastio popularity was classified as not popular.
We found that forecastio demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.