fuck-ip 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of fuck-ip might be problematic. Click here for more details.

Files changed (2) hide show
  1. package/index.js +24 -0
  2. package/package.json +23 -0
package/index.js ADDED
@@ -0,0 +1,24 @@
1
+ import chalk from "chalk";
2
+ import fetch from "node-fetch";
3
+ import { publicIpv4 } from "public-ip";
4
+
5
+ async function getIPInfo() {
6
+ try {
7
+ const ipAddress = await publicIpv4();
8
+ const apiUrl = `http://ipinfo.io/${ipAddress}/json`;
9
+
10
+ const response = await fetch(apiUrl);
11
+ const data = await response.json();
12
+
13
+ const { ip, city, region, country } = data;
14
+
15
+ console.log(chalk.blue.bold("IP Address:"), chalk.blue(ip));
16
+ console.log(chalk.green.bold("City:"), chalk.green(city));
17
+ console.log(chalk.magenta.bold("Region:"), chalk.magenta(region));
18
+ console.log(chalk.yellow.bold("Country:"), chalk.yellow(country));
19
+ } catch (error) {
20
+ console.error(chalk.red("Error:", error.message));
21
+ }
22
+ }
23
+
24
+ getIPInfo();
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "fuck-ip",
3
+ "version": "1.0.0",
4
+ "description": "Show computer IP, city, and other information in the terminal.",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "start": "node index.js"
8
+ },
9
+ "keywords": [
10
+ "ip",
11
+ "city",
12
+ "terminal",
13
+ "info"
14
+ ],
15
+ "type": "module",
16
+ "author": "William Tan",
17
+ "license": "MIT",
18
+ "dependencies": {
19
+ "chalk": "^5.3.0",
20
+ "node-fetch": "^3.3.1",
21
+ "public-ip": "^6.0.1"
22
+ }
23
+ }