@dyndns/ipify
TypeScript icon, indicating that this package has built-in type declarations

1.0.8 • Public • Published

@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

Readme

Keywords

none

Package Sidebar

Install

npm i @dyndns/ipify

Weekly Downloads

1

Version

1.0.8

License

LGPL-3.0-only

Unpacked Size

30.3 kB

Total Files

7

Last publish

Collaborators

  • dmanavi