
Security News
Nx npm Packages Compromised in Supply Chain Attack Weaponizing AI CLI Tools
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
nsapi is a free and open source library that allows Node.js applications to easily access the NationStates API without worrying about making HTTP requests, decoding XML, caching or rate limiting.
nsapi features the following:
You can install nsapi using npm: npm install nsapi
.
You can also build nsapi locally using npm: npm run-script build
.
Consult the documentation for more information on API structure and methods.
nsapi targets ES5 but requires support for ES6 promises, so if you're not using a runtime that supports them natively, you'll have to use a polyfill.
The following is a simple example that retrieves a nation's full name and prints it to the console.
var nsapi = require("nsapi");
// TODO: Replace the user agent with your own
var api = new nsapi.NsApi("Your nation's name");
return api.nationRequest("Auralia", ["fullname"])
.then(function(data) {
console.log(data["fullname"]);
})
.then(function() {
api.cleanup();
});
For additional examples, consult the examples/example.js file.
nsapi is licensed under the Apache License 2.0.
FAQs
Provides access to the NationStates API
The npm package nsapi receives a total of 21 weekly downloads. As such, nsapi popularity was classified as not popular.
We found that nsapi 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.
Security News
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.