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.
legacy-hubspot-bender-context
Advanced tools
The Earthquake Data Library is a Node.js SDK that provides an easy-to-use interface for fetching and analyzing earthquake data from the USGS (United States Geological Survey) Earthquake API. This library allows users to retrieve recent earthquake information, query earthquakes by geographic radius, and perform basic analysis on seismic events.
Please make sure you have a valid license prior to installing this library. To install the Earthquake Data Library, run the following command in your project directory:
npm install earthquake-data-library
Note: Make sure you have Node.js and npm installed on your system.
Here's a basic example of how to use the Earthquake Data Library:
const EarthquakeLibrary = require("earthquake-data-library");
const earthquakeLib = new EarthquakeLibrary();
async function main() {
try {
// Get recent earthquakes
const recentQuakes = await earthquakeLib.getEarthquakes({
startTime: "2023-06-01",
minMagnitude: 4.5,
limit: 10,
});
console.log("Recent significant earthquakes:", recentQuakes);
// Get earthquakes within 1000km of Tokyo
const tokyoQuakes = await earthquakeLib.getEarthquakesByRadius(
35.6762,
139.6503,
1000,
5
);
console.log("Recent earthquakes near Tokyo:", tokyoQuakes);
// Get magnitude description
console.log(
"A magnitude 6.5 earthquake is considered:",
earthquakeLib.getMagnitudeDescription(6.5)
);
} catch (error) {
console.error("Error:", error.message);
}
}
main();
getEarthquakes(options)
Fetches earthquake data based on specified parameters.
options
(Object):
startTime
(String): Start date for the query (default: '2023-01-01')endTime
(String): End date for the query (default: current date)minMagnitude
(Number): Minimum magnitude (default: 0)maxMagnitude
(Number): Maximum magnitude (default: 10)limit
(Number): Maximum number of results to return (default: 100)Returns a Promise that resolves to an array of earthquake objects.
getEarthquakesByRadius(latitude, longitude, maxRadiusKm, minMagnitude)
Fetches earthquakes within a specified radius of a geographic point.
latitude
(Number): Latitude of the center pointlongitude
(Number): Longitude of the center pointmaxRadiusKm
(Number): Maximum radius in kilometersminMagnitude
(Number): Minimum magnitude (default: 0)Returns a Promise that resolves to an array of earthquake objects.
getMostSignificantEarthquakes(limit)
Retrieves the most significant recent earthquakes.
limit
(Number): Maximum number of results to return (default: 10)Returns a Promise that resolves to an array of earthquake objects.
calculateDistance(lat1, lon1, lat2, lon2)
Calculates the distance between two geographic points.
lat1
, lon1
: Latitude and longitude of the first pointlat2
, lon2
: Latitude and longitude of the second pointReturns the distance in kilometers.
getMagnitudeDescription(magnitude)
Provides a descriptive category for an earthquake magnitude.
magnitude
(Number): The earthquake magnitudeReturns a string describing the magnitude category (e.g., "Minor", "Moderate", "Major").
The library uses a centralized error handling mechanism. All methods that interact with the USGS API will throw an error if the request fails or if there's an issue with the data. It's recommended to use try-catch blocks when calling these methods.
Contributions to the Earthquake Data Library are welcome! Please feel free to submit a Pull Request. Author: Incisiv3
This project is licensed under the MIT License! - see the LICENSE file for details.
FAQs
weather and gis aggregation library with a simple API
The npm package legacy-hubspot-bender-context receives a total of 0 weekly downloads. As such, legacy-hubspot-bender-context popularity was classified as not popular.
We found that legacy-hubspot-bender-context demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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.