
Security News
MCP Community Begins Work on Official MCP Metaregistry
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
nuip
is a lightweight Node.js package that fetches user location details based on their IP address. It uses ip-api.com
to retrieve the data and supports both real and development modes.
Install nuip
using npm:
npm install nuip
If you're using TypeScript, you might also want to install the necessary types:
npm install --save-dev @types/node
You can import getNuip
in both JavaScript and TypeScript:
import { getNuip } from "nuip";
import { getNuip } from "nuip";
async function fetchIpInfo() {
const ipInfo = await getNuip();
console.log(ipInfo);
}
fetchIpInfo();
By default, this will return the IP details of the requesting client.
If you're using Express, you can create an API endpoint:
import express, { Request, Response } from "express";
import { getNuip } from "nuip";
const app = express();
const port = 3000;
app.get("/getNuip", async (req: Request, res: Response) => {
try {
const ipInfo = await getNuip(req);
res.json(ipInfo);
} catch (error) {
res.status(500).json({ error: "Failed to fetch IP info" });
}
});
app.listen(port, () => {
console.log(`Server running on http://localhost:${port}`);
});
You can pass an options object to getNuip
:
const ipInfo = await getNuip(req, { devMode: true, includeDetails: false });
Option | Type | Default | Description |
---|---|---|---|
req | Request | - | (Optional) Express request object to get real client IP. |
devMode | boolean | false | If true , returns mock data (0.0.0.0 ). |
includeDetails | boolean | true | If false , fetches only basic details. |
By default, getNuip
returns an object like this:
{
"devMode": false,
"ip": "0.0.0.0",
"continent": "Unknown",
"continentCode": "XX",
"country": "Unknown",
"countryCode": "XX",
"region": "X",
"regionName": "Unknown Region",
"city": "Unknown City",
"district": "",
"zip": "0000",
"lat": 0.0,
"lon": 0.0,
"timezone": "UTC",
"offset": 0,
"currency": "XXX",
"isp": "Unknown ISP",
"org": "Unknown Organization",
"as": "AS00000 Unknown ASN",
"asname": "UNKNOWN-ASN"
}
If devMode: true
, it returns mock data:
{
"devMode": false,
"ip": "0.0.0.0",
"continent": "Unknown",
"continentCode": "XX",
"country": "Unknown",
"countryCode": "XX",
"region": "X",
"regionName": "Unknown Region",
"city": "Unknown City",
"district": "",
"zip": "0000",
"lat": 0.0,
"lon": 0.0,
"timezone": "UTC",
"offset": 0,
"currency": "XXX",
"isp": "Unknown ISP",
"org": "Unknown Organization",
"as": "AS00000 Unknown ASN",
"asname": "UNKNOWN-ASN"
}
When running in a development environment, you can use:
const ipInfo = await getNuip(null, { devMode: true });
console.log(ipInfo);
This will return mock IP data (0.0.0.0
) instead of making an API request.
This project is licensed under the MIT License.
For questions or suggestions, feel free to open an issue on GitHub.
FAQs
Node.js package to get user details from IP address
The npm package nuip receives a total of 7 weekly downloads. As such, nuip popularity was classified as not popular.
We found that nuip 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.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.