# ip-utility

> Package that provides a basic set of function about your IP

Latest version **1.1.5** (published 2019-12-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install ip-utility
pnpm add ip-utility
yarn add ip-utility
bun add ip-utility
```

Provides the command `ip-utility`.

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.5 |
| Published | 2019-12-23 |
| First published | 2019-11-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=8 |
| Dependencies | 5 |
| Unpacked size | 190.9 KB |
| Known vulnerabilities | 0 (+25 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Michele Della Mea |
| Maintainers | arcanediver |
| Keywords | ip, ipv6, ipv4, address, internal, public, private, public-ip, private-ip, local, machine, system, net, gateway |

## Links

- npm: https://www.npmjs.com/package/ip-utility
- Repository: https://github.com/ArcaneDiver/ip-utility
- Homepage: https://github.com/ArcaneDiver/ip-utility#readme
- Issues: https://github.com/ArcaneDiver/ip-utility/issues
- npm.io page: https://npm.io/package/ip-utility

## Dependencies (5)

- [meow](https://npm.io/package/meow.md) ^5.0.0
- [axios](https://npm.io/package/axios.md) ^0.19.0
- [chalk](https://npm.io/package/chalk.md) ^3.0.0
- [default-gateway](https://npm.io/package/default-gateway.md) ^5.0.5
- [@types/default-gateway](https://npm.io/package/@types/default-gateway.md) ^3.0.0

## Alternatives

- [lodash.startswith](https://npm.io/package/lodash.startswith.md) — 769.7K weekly downloads
- [@tarojs/service](https://npm.io/package/@tarojs/service.md) — 33.9K weekly downloads
- [io.extendreality.tilia.indicators.spatialtargets.unity](https://npm.io/package/io.extendreality.tilia.indicators.spatialtargets.unity.md) — 131 weekly downloads
- [@rtarojs/taro](https://npm.io/package/@rtarojs/taro.md) — 90 weekly downloads
- [node-branch-io](https://npm.io/package/node-branch-io.md) — 50 weekly downloads

## Recent versions

- 1.1.5 (latest) — 2019-12-23
- 1.1.4 — 2019-12-23
- 1.1.3 — 2019-12-23
- 1.1.2 — 2019-12-23
- 1.1.1 — 2019-12-23
- 1.0.8 — 2019-11-28
- 1.0.7 — 2019-11-27
- 1.0.6 — 2019-11-27
- 1.0.5 — 2019-11-27
- 1.0.4 — 2019-11-27
- 1.0.3 — 2019-11-26
- 1.0.2 — 2019-11-26
- 1.0.1 — 2019-11-25
- 1.0.0 — 2019-11-25

## README

# IP UTILITY


[![npm version](https://badge.fury.io/js/ip-utility.svg)](https://badge.fury.io/js/ip-utility)
## Installation

You can install with npm:
```bash
$ npm install ip-utility --save
```

You can also install through yarn:
```bash
$ yarn add ip-utility
```


## Features
It`s written in Typescript then you can access to the relative data types.
This package exposes 2 functions
* getPublic
* getPrivate

### getPublic
This is an async function that return you a string with your public ip

Without async
```js
const { getPublic } = require(`ip-utility`);

getPublic()
.then( ip => {
    console.log("Public IP:", ip);
})
```

With async
```js
( async function () {
const { getPublic } = require(`ip-utility`);

const ip = await getPublic();
console.log("Public IP:", ip);
})()
```

### getPrivate( options )
* ##### options
    * ###### wifi
        * ###### not required
        * ###### boolean
        * ###### return an array of object or an single object that describes all Wi-Fi `interfaces`
    * ###### ethernet
        * ###### not required
        * ###### boolean
        * ###### return an array of object or an single object that describes all Ethernet `interfaces`
```js
const { getPrivate } = require(`ip-utility`);

// Only 1 wifi interface
const ip = getPrivate({
    wifi: true
});

console.log("my WI-FI local IP:", ip.wifi.ip.v4);
console.log("my WI-FI mac", ip.wifi.mac);
```

---
_Source: https://npm.io/package/ip-utility · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
