1.0.8 • Published 9 months ago

@dyndns/ipify v1.0.8

Weekly downloads
-
License
LGPL-3.0-only
Repository
github
Last release
9 months ago

@dyndns/ipify

NPM version NPM downloads

This package consumes ipify.org APIs and retrieves the current machines public IP address (both v4 and v6). This can be used in both CLI and library (JS/Typescript in both NodeJS and browser) mode.

Installation

There are three different methods to install and use this package.

# 1) no installation
# npx (or similar package runners)
npx @dyndns/ipify@latest

# 2) install globally (usable in other apps and CLI)
# npm (or similar package runners)
npm i -g @dyndns/ipify@latest

# 3) install as a dependency in your application
# npm (or similar package runners)
npm i @dyndns/ipify@latest

Usage

Library (JS/TS)

If you've followed the library method in the first step, then the package is available as a dependency.

// javascript (CJS)

const ipRetriever = require('@dyndns/ipify');

const retrieveIP = ipRetriever.create();

retrieveIP('v4') // or "v6"
  .then((ipAddress) => console.log(ipAddress))
  .catch(console.error);
// typescript/javascript (module)

import * as ipRetriever from '@dyndns/ipify';

const retrieveIP = ipRetriever.create();

retrieveIP('v4') // or "v6"
  .then((ipAddress) => console.log(ipAddress))
  .catch(console.error);

CLI

If you've followed the CLI installation method in the first step, then the package is available as a command in your OS.

# using npx
npx @dyndns/ipify@latest

# if installed globally
dd-ipify --help


ipify.org command-line interface (CLI)

Options:
  --version  Show version number                                       [boolean]
  --help     Show help                                                 [boolean]
  --ip       IP address version            [choices: "v4", "v6"] [default: "v4"]

License

GPL-3.0

1.0.8

9 months ago

1.0.7

9 months ago

1.0.6

9 months ago

1.0.5

9 months ago

1.0.4

9 months ago

1.0.3

9 months ago

1.0.2

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago