open-index/open-npm huggingface dataset:
npm package: @gibme/depupdate
Description: Easily update package dependencies with a simple quick command
Author: Brandon Lehmann
Latest version: 22.0.0

# @gibme/depupdate

Easily update package dependencies with a single command.

`depupdate` automates the process of upgrading all dependency categories (dependencies, devDependencies, peerDependencies, and optionalDependencies) in a Node.js project, then runs audit checks and attempts to fix any discovered vulnerabilities automatically.

## Requirements

- Node.js >= 22

## Installation

```bash
npm install -g @gibme/depupdate
```

or

```bash
yarn global add @gibme/depupdate
```

## Usage

Run `depupdate` from the root of any Node.js project (where `package.json` lives).

### Update Dependencies (within semver range)

```bash
depupdate
```

Updates all dependencies to the latest version permitted by the version ranges in `package.json`. Automatically detects whether the project uses Yarn (`yarn.lock`) or npm (`package-lock.json`).

### Update Dependencies (latest)

```bash
depupdate latest
```

Ignores existing version ranges and updates every dependency to the absolute latest version.

### Setup Standard Dev Dependencies

```bash
depupdate setup
```

Installs a standard set of development dependencies:

- `@types/node`
- `@typescript-eslint/eslint-plugin`, `@typescript-eslint/parser`
- `eslint`, `eslint-config-standard`, `eslint-plugin-import`, `eslint-plugin-n`, `eslint-plugin-node`, `eslint-plugin-promise`
- `tsx`
- `typedoc`
- `typescript`

Combine with `latest` to install the latest versions:

```bash
depupdate setup latest
```

### Automatic Audit Fixes

After updating dependencies, `depupdate` automatically:

1. Runs `yarn audit` or `npm audit` to check for known vulnerabilities
2. If vulnerabilities are found, attempts to fix them (using `npm audit fix` or `yarn-audit-fix`)
3. Repeats the audit/fix cycle a second time to catch any cascading resolution changes

## License

MIT
npm package: @gibme/finance
Description: A simple collection of financial equations
Author: Brandon Lehmann
Latest version: 22.0.0

# @gibme/finance

A simple collection of financial equations for Node.js and the browser.

## Documentation

[https://gibme-npm.github.io/finance/](https://gibme-npm.github.io/finance/)

## Requirements

- Node.js >= 22

## Installation

```bash
npm install @gibme/finance
```

```bash
yarn add @gibme/finance
```

## Features

### Amortization

- **Payment** - Calculate monthly payment breakdown (principal, interest, balance)
- **Table** - Generate a full amortization schedule with optional extra payment support
- **Loan Information** - Summarize total interest, savings from extra payments, and effective rates
- **Principal from Payment** - Reverse-calculate the loan principal given a known payment amount

### Interest

- **Annual Percentage Yield (APY)** - Convert a nominal rate to its effective annual yield given a compounding period
- **Compound Interest** - Calculate the future value of a principal using the compound interest formula
- **Simple Interest** - Calculate the future value of a principal using the simple interest formula
- **Simple Interest Loan** - Summarize payment, total interest, and effective rate for a simple interest loan

### Pricing

- **Margin** - Calculate the margin on a product given cost and selling price
- **Markup** - Calculate the markup on a product given cost and selling price

### Valuation

- **Present Value from Future Value** - Discount a future value back to its present value at a constant rate

### Moving Averages

- **SMA** - Simple Moving Average
- **EMA** - Exponential Moving Average
- **LWMA** - Linearly Weighted Moving Average
- **EWMA** - Exponentially Weighted Moving Average
- **CMA** - Cumulative Moving Average

## Usage

```typescript
import {
    calculate_amortization_loan,
    calculate_compound_interest,
    calculate_apy,
    calculate_sma
} from '@gibme/finance';

// 30-year mortgage at 6% with $200 extra/month starting month 1
const loan = calculate_amortization_loan(200000, 0.06, 360, [
    { month: 1, amount: 200, fill: true }
]);
console.log(loan.payment);        // monthly payment
console.log(loan.months_saved);    // months saved by extra payments
console.log(loan.interest_saved);  // interest saved by extra payments

// Compound interest: $10,000 at 5% compounded monthly for 5 years
const futureValue = calculate_compound_interest(10000, 0.05, 'monthly', 60);
console.log(futureValue);

// APY for 5% compounded daily
const apy = calculate_apy(0.05, 'daily');
console.log(apy);

// Simple moving average with a 3-period window
const sma = calculate_sma([10, 20, 30, 40, 50], 3);
console.log(sma); // [20, 30, 40]
```

### Compounding Periods

The following compounding periods are supported wherever a `CompoundPeriod` is accepted:

`daily` | `weekly` | `biweekly` | `semimonthly` | `monthly` | `bimonthly` | `quarterly` | `semiannually` | `annually` | `biannually`

### APR Handling

Functions that accept an `apr` parameter will automatically convert values greater than 1 to a decimal (e.g. `5` becomes `0.05`). You can pass either form.

## License

MIT
npm package: @gibme/fontawesome
Description: Simple utilities for fontawesome
Author: Brandon Lehmann
Latest version: 22.0.0

# @gibme/fontawesome

Simple utilities for creating [Font Awesome](https://fontawesome.com/) icons and buttons programmatically with full TypeScript support.

## Installation

```bash
npm install @gibme/fontawesome
```

```bash
yarn add @gibme/fontawesome
```

## Requirements

- Node.js >= 22
- Font Awesome CSS must be loaded in your page separately

## Usage

### ES Module / TypeScript

```typescript
import FontAwesome, { createIcon, createButton } from '@gibme/fontawesome';
```

### Browser (UMD)

Include the bundled `FontAwesome.min.js` in your page. The library is available as a global `FontAwesome` object.

## API

### `createIcon(icon, options?)`

Creates an `<i>` element with the appropriate Font Awesome classes.

```typescript
// Simple icon
const icon = createIcon('star');

// Branded icon (string)
const twitter = createIcon('brand x-twitter');

// Branded icon (array)
const github = createIcon(['brand', 'github']);

// With options
const spinner = createIcon('spinner', {
    style: 'solid',
    animation: 'spin',
    size: 'xl',
    color: '#ff0000',
});

// With custom attributes
const icon = createIcon('bell', {
    attributes: {
        id: 'notification-bell',
        'data-count': 5,
        hidden: false,
    },
});
```

#### Options

| Option | Type | Default | Description |
|---|---|---|---|
| `style` | `'solid' \| 'regular' \| 'light' \| 'duotone' \| 'thin'` | `'solid'` | Icon style variant |
| `animation` | `Animation` | `'none'` | Animation effect |
| `rotation` | `Rotation` | `'none'` | Rotation or flip transformation |
| `size` | `'default' \| '2xs' \| 'xs' \| 'lg' \| 'xl' \| '2xl'` | `'default'` | Icon size |
| `color` | `Color` | — | CSS color (`#hex`, `rgb()`, or `rgba()`) |
| `class` | `string` | — | Additional CSS classes |
| `attributes` | `Record<string, string \| number \| boolean>` | `{}` | Custom HTML attributes |

### `createButton(icon, options?)`

Creates a `<button>` element with an embedded Font Awesome icon. Accepts all icon options plus:

| Option | Type | Description |
|---|---|---|
| `label` | `string \| HTMLElement` | Text or element to display alongside the icon |

```typescript
// Icon button
const btn = createButton('trash', {
    style: 'solid',
    color: '#dc3545',
});

// Icon button with text label
const saveBtn = createButton('floppy-disk', {
    label: 'Save',
});

// Icon button with custom label element
const label = document.createElement('span');
label.textContent = 'Download';
const dlBtn = createButton('download', { label });
```

### Types

#### `Animation`

```
'none' | 'beat' | 'beat-fade' | 'bounce' | 'fade' | 'flip' | 'shake' | 'spin' | 'spin-reverse' | 'spin-pulse'
```

#### `Rotation`

```
'none' | 'rotate-90' | 'rotate-180' | 'rotate-270' | 'flip-horizontal' | 'flip-vertical' | 'flip-both'
```

#### `Color`

```
`#${string}` | `rgb(${number},${number},${number})` | `rgba(${number},${number},${number},${number})`
```

## License

MIT
npm package: @gibme/fping
Description: A simple fping promise based wrapper
Author: Brandon Lehmann
Latest version: 22.0.0

# @gibme/fping

A simple promise-based wrapper around [fping](https://fping.org/) for Node.js.

## Requirements

- Node.js >= 22
- `fping` must be installed on the system
  - **Linux:** `sudo apt install fping`
  - **macOS:** `brew install fping`

## Installation

```bash
npm install @gibme/fping
```

or

```bash
yarn add @gibme/fping
```

## Usage

```typescript
import fping from '@gibme/fping';

const results = await fping(['1.1.1.1', '8.8.8.8']);

console.log(results);
```

### With Options

```typescript
const results = await fping(['1.1.1.1', '8.8.8.8'], {
    count: 3,
    timeout: 1000,
    retry: 5
});

for (const [host, result] of Object.entries(results)) {
    if (result) {
        console.log(`${host}: avg=${result.avg}ms, loss=${result.loss * 100}%`);
    }
}
```

## Options

All options are optional. Defaults are shown below.

| Option | Type | Default | Description |
|---|---|---|---|
| `bytes` | `number` | `56` | Amount of ping data to send (minimum 40) |
| `backoff` | `number` | `1.5` | Exponential backoff factor |
| `count` | `number` | `1` | Number of pings to send per target (minimum 1) |
| `interval` | `number` | `10` | Interval between ping packets in ms |
| `period` | `number` | `1000` | Interval between pings to one target in ms |
| `retry` | `number` | `3` | Number of retries |
| `random` | `boolean` | `true` | Use random packet data |
| `timeout` | `number` | `500` | Per-target initial timeout in ms |
| `digits` | `number` | `3` | Decimal digits for latency values |
| `lossDigits` | `number` | `4` | Decimal digits for loss percentage (minimum 2) |

## Result

Each target returns a `fping.Result` object:

```typescript
{
    target: string;    // The host that was pinged
    sent: number;      // Packets sent
    received: number;  // Packets received
    loss: number;      // Loss as a decimal (0.25 = 25%)
    avg: number;       // Average latency in ms
    min: number;       // Minimum latency in ms
    max: number;       // Maximum latency in ms
    stddev: number;    // Standard deviation of latencies
    times: number[];   // Individual ping times in ms
}
```

## Documentation

[https://gibme-npm.github.io/fping/](https://gibme-npm.github.io/fping/)

## License

MIT
npm package: @gibme/ipinfo
Description: A simple IP information lookup helper using Team CYMRU services
Author: Brandon Lehmann
Latest version: 22.0.0

# @gibme/ipinfo

A simple IP information lookup helper using [Team CYMRU](https://www.team-cymru.com/ip-asn-mapping) DNS services and a lightweight HTTP API.

Supports both IPv4 and IPv6 addresses.

## Requirements

- Node.js >= 22

## Installation

```bash
yarn add @gibme/ipinfo
```

or

```bash
npm install @gibme/ipinfo
```

## Usage

### IP Info (HTTP)

Looks up geolocation and network information for an IP address via HTTP. If no address is provided, returns information for the client's public IP.

```typescript
import { ipInfo } from '@gibme/ipinfo';

const info = await ipInfo('1.1.1.1');

console.log(info);
// {
//   query: '1.1.1.1',
//   country: 'Australia',
//   countryCode: 'AU',
//   region: 'QLD',
//   regionName: 'Queensland',
//   city: 'South Brisbane',
//   zip: '4101',
//   lat: -27.4766,
//   lon: 153.0166,
//   timezone: 'Australia/Brisbane',
//   isp: 'Cloudflare, Inc',
//   as: { asn: 13335, name: 'Cloudflare,' }
// }
```

### Prefix Lookup (DNS)

Queries Team CYMRU's DNS-based IP-to-ASN mapping to retrieve prefix, ASN, country, and registry information.

```typescript
import { getPrefix } from '@gibme/ipinfo';

const prefix = await getPrefix('8.8.8.8');

console.log(prefix);
// {
//   address: '8.8.8.8',
//   zone: '8.8.8.8.origin.asn.cymru.com',
//   asn: 15169,
//   prefix: '8.8.8.0/24',
//   country: 'US',
//   registry: 'ARIN',
//   allocated: 2023-12-28T00:00:00.000Z,
//   as: { asn: 15169, country: 'US', registry: 'ARIN', allocated: 2000-03-30T00:00:00.000Z, name: 'GOOGLE' }
// }
```

### ASN Lookup (DNS)

Retrieves information about an Autonomous System Number.

```typescript
import { getASN } from '@gibme/ipinfo';

const asn = await getASN(13335);

console.log(asn);
// {
//   asn: 13335,
//   country: 'US',
//   registry: 'ARIN',
//   allocated: 2010-07-14T00:00:00.000Z,
//   name: 'CLOUDFLARENET'
// }
```

### Browser Bundle

A webpack browser bundle is also available, exposing only the `ipInfo` HTTP method:

```html
<script src="ipinfo.min.js"></script>
```

## Documentation

Full API documentation is available at [https://gibme-npm.github.io/ipinfo/](https://gibme-npm.github.io/ipinfo/)

## License

MIT
npm package: @gibme/iptables
Description: A simple port iptables helper/wrapper
Author: Brandon Lehmann
Latest version: 22.0.0

# @gibme/iptables

A simple Node.js wrapper for managing iptables rules programmatically. Supports both IPv4 (`iptables`) and IPv6 (`ip6tables`), with built-in TTL-based expiration for host rules and automatic chain rebuilding.

## Requirements

- Linux with `iptables` / `ip6tables` installed
- Node.js >= 22
- Appropriate permissions to modify iptables rules (typically root)

## Installation

```bash
yarn add @gibme/iptables
```

or

```bash
npm install @gibme/iptables
```

## Documentation

[https://gibme-npm.github.io/iptables/](https://gibme-npm.github.io/iptables/)

## Usage

### Basic Example

```typescript
import IPTables from '@gibme/iptables';

const firewall = new IPTables({
    chain: 'INPUT'
});

// Add a host rule (default jump target: ACCEPT)
await firewall.add('192.168.1.100');

// Add a host rule with a specific jump target
await firewall.add('8.8.8.8', 'DROP');

// Add an interface rule
await firewall.addInterface('eth0', 'ACCEPT');

// Remove a host rule
await firewall.delete('8.8.8.8');

// Remove an interface rule
await firewall.deleteInterface('eth0');

// Flush the entire chain
await firewall.flush();
```

### IPv6 Support

```typescript
const firewall6 = new IPTables({
    chain: 'INPUT',
    family: 6
});

await firewall6.add('::1', 'ACCEPT');
```

### TTL-Based Expiration

Host rules are automatically removed after the configured TTL (default: 300 seconds). Use `keepAlive()` to reset the timer for a host.

```typescript
const firewall = new IPTables({
    chain: 'INPUT',
    stdTTL: 600 // rules expire after 10 minutes
});

await firewall.add('10.0.0.1', 'ACCEPT');

// Reset the expiration timer
await firewall.keepAlive('10.0.0.1');
```

### Options

| Option | Type | Default | Description |
|---|---|---|---|
| `chain` | `string` | *required* | The iptables chain to manage (e.g., `INPUT`, `FORWARD`, `OUTPUT`) |
| `stdTTL` | `number` | `300` | TTL in seconds for host rules (0 = no expiration) |
| `family` | `4 \| 6` | `4` | Address family — `4` for iptables, `6` for ip6tables |
| `iptables` | `string` | auto-detected | Path to the iptables binary |

### Events

The `IPTables` class extends `EventEmitter` and emits the following events:

- **`error`** — Emitted when an internal cache error occurs
- **`expired`** — Emitted when a host rule expires due to TTL

```typescript
firewall.on('error', (error) => {
    console.error('Firewall error:', error);
});

firewall.on('expired', (host) => {
    console.log(`Rule expired for: ${host}`);
});
```

## License

MIT
npm package: @gibme/logger
Description: A simple wrapper around the Winston logger
Author: Brandon Lehmann
Latest version: 22.0.1

# @gibme/logger

A simple [Winston](https://www.npmjs.com/package/winston) wrapper that provides a pre-configured singleton logger with console and file transports.

[![NPM](https://img.shields.io/npm/v/@gibme/logger)](https://www.npmjs.com/package/@gibme/logger)
[![License](https://img.shields.io/npm/l/@gibme/logger)](https://github.com/gibme-npm/logger/blob/master/LICENSE)
[![Node.js](https://img.shields.io/node/v/@gibme/logger)](https://nodejs.org/)

## Features

- Console transport with colorized output, enabled by default
- Debug-level console output automatically enabled when `NODE_ENV !== 'production'`
- Optional file transport with configurable path and filename
- Additional log files via `addLog()`
- Full access to underlying Winston `format`, `transports`, and `Winston` exports for advanced use

## Installation

```bash
yarn add @gibme/logger
```

or

```bash
npm install @gibme/logger
```

## Quick Start

```typescript
import Logger from '@gibme/logger';

Logger.info('Application started');
Logger.debug('Debug details here');
Logger.warn('Something looks off');
Logger.error('Something went wrong');
```

## File Logging

File logging is disabled by default. Enable it at runtime or via environment variable:

```typescript
// Enable the default file transport at runtime
Logger.enableDefaultLog();

// Disable it again
Logger.disableDefaultLog();
```

### Adding Additional Log Files

```typescript
// Add a custom log file with a specific level
Logger.addLog('errors.log', 'error');

// Specify a custom path
Logger.addLog('audit.log', 'info', '/var/log/myapp');
```

## Environment Variables

Configuration is handled through environment variables (with [dotenv](https://www.npmjs.com/package/dotenv) support):

| Variable | Default | Description |
|---|---|---|
| `NODE_ENV` | — | When set to `production`, console output is limited to `info` level and above |
| `ENABLE_DEFAULT_LOG` | `false` | Set to `true` to enable the default file transport on startup |
| `LOG_PATH` | `./logs/` | Directory for log files |
| `LOG_FILENAME` | `info.log` | Filename for the default file transport |
| `LOG_CREATE_PATH` | `true` | Set to `false` to skip automatic creation of the log directory |

## Properties

| Property | Type | Description |
|---|---|---|
| `Logger.path` | `string` | The resolved default log directory path |
| `Logger.defaultFilename` | `string` | The default log filename |
| `Logger.defaultFilenamePath` | `string` | The full resolved path to the default log file |

## Exports

The package re-exports Winston internals for advanced configuration:

```typescript
import Logger, { Winston, transports, format } from '@gibme/logger';
```

## Documentation

Full API documentation is available at [https://gibme-npm.github.io/logger/](https://gibme-npm.github.io/logger/).

## License

MIT - see [LICENSE](https://github.com/gibme-npm/logger/blob/master/LICENSE) for details.
npm package: @gibme/mikrotik
Description: A simple mikrotik helper/wrapper
Author: Brandon Lehmann
Latest version: 22.0.0

# @gibme/mikrotik

A TypeScript helper/wrapper for managing MikroTik RouterOS devices over SSH.

## Documentation

[https://gibme-npm.github.io/mikrotik/](https://gibme-npm.github.io/mikrotik/)

## Requirements

- Node.js >= 22

## Installation

```bash
npm install @gibme/mikrotik
```

```bash
yarn add @gibme/mikrotik
```

## Usage

```typescript
import Mikrotik from '@gibme/mikrotik';

const device = new Mikrotik({
    host: '192.168.1.1',
    username: 'admin',
    password: 'password'
});

await device.connect();

const identity = await device.identity();
console.log(`Connected to: ${identity}`);

const routes = await device.get_ip_routes();
console.log(`Route count: ${routes.length}`);

await device.destroy();
```

## API

### Connection

| Method | Description |
|--------|-------------|
| `connect()` | Connects to the device over SSH |
| `destroy()` | Closes the SSH connection and stops internal timers |

### Device Information

| Method | Return Type | Description |
|--------|-------------|-------------|
| `identity()` | `string` | Device identity name |
| `version()` | `string` | RouterOS version string |
| `semantic_version()` | `{major, minor, patch}` | Parsed semantic version |
| `routerboard()` | `Mikrotik.Response.Routerboard` | Board info (model, firmware, serial) |
| `resource()` | `Mikrotik.Response.Resource` | System resources (CPU, memory, uptime) |
| `health()` | `Mikrotik.Response.V6.Health \| V7.Health` | Temperature, voltage, fan data (version-aware) |

### Networking

| Method | Return Type | Description |
|--------|-------------|-------------|
| `get_interfaces(active_only?)` | `Mikrotik.Response.Interface[]` | Network interfaces with tunnel details |
| `get_ip_addresses(active_only?)` | `Mikrotik.Response.Address[]` | IP addresses assigned to interfaces |
| `get_ip_routes(min_distance?, vrf?, active_only?)` | `Mikrotik.Response.Route[]` | Routing table entries |
| `get_route_counts(min_distance?, vrf?)` | `Record<string, Route.Count>` | Route counts per IP with active marking |
| `ping(target, source?)` | `Mikrotik.Response.Ping` | Ping with latency measurement |
| `traceroute(target, source?)` | `Mikrotik.Response.Traceroute[]` | Traceroute with reverse DNS on hops |

### Bandwidth Testing

```typescript
const result = await device.bandwidth_test(
    'target-host',
    'username',
    'password',
    {
        duration: 10,
        direction: 'both',
        protocol: 'udp',
        callback: (update) => {
            console.log(`${update.status}: ${update.transmit?.current} bps`);
        }
    }
);
```

Supports `AbortSignal` for cancellation and real-time progress via callback.

### Raw Commands

| Method | Description |
|--------|-------------|
| `terse<Type>(command)` | Execute a command and parse terse (space-separated key=value) output |
| `kvs<Type>(command)` | Execute a command and parse colon-separated key-value output |

## License

MIT
npm package: @gibme/perf-monitor
Description: A very simple performance monitor
Author: Brandon Lehmann
Latest version: 22.0.0

# Simple Performance Monitoring

A lightweight, zero-dependency performance monitor for Node.js built on native `perf_hooks` for high-resolution timing.

## Requirements

- Node.js >= 22

## Installation

```bash
yarn add @gibme/perf-monitor
```

or

```bash
npm install @gibme/perf-monitor
```

## Documentation

[https://gibme-npm.github.io/perf-monitor/](https://gibme-npm.github.io/perf-monitor/)

## Usage

```typescript
import PerformanceMonitor from '@gibme/perf-monitor';

const timer = new PerformanceMonitor();

// do some work...

// measure time since creation (or last mark)
console.log(`Elapsed: ${timer.measure()}ms`);

// set a new checkpoint
timer.mark();

// do more work...

// measure since last mark AND advance the mark in one call
console.log(`Phase: ${timer.measureAndMark()}ms`);

// total time since the instance was created
console.log(`Total: ${timer.total()}ms`);
```

## API

### Properties

| Property | Type | Description |
|---|---|---|
| `genesis` | `number` | Timestamp when the instance was created |
| `current_mark` | `number` | The current checkpoint timestamp |

### Methods

| Method | Signature | Description |
|---|---|---|
| `mark()` | `(): void` | Sets a new checkpoint at the current time |
| `measure()` | `(decimals?: number): number` | Returns ms elapsed since the last mark (or creation) |
| `measureAndMark()` | `(decimals?: number): number` | Measures elapsed time and advances the mark |
| `total()` | `(decimals?: number): number` | Returns ms elapsed since instance creation |

All measurement methods accept an optional `decimals` parameter (default: `8`) to control rounding precision.

## License

MIT
npm package: @gibme/port-forwarder
Description: A simple port forward helper/service
Author: Brandon Lehmann
Latest version: 22.0.0

# Simple TCP Port Forwarding Server

A lightweight TCP port forwarding service for Node.js with session tracking, keepalive support, and both static and dynamic forwarding modes.

## Requirements

- Node.js >= 22

## Installation

```bash
npm install @gibme/port-forwarder
```

or

```bash
yarn add @gibme/port-forwarder
```

## Documentation

[https://gibme-npm.github.io/port-forwarder/](https://gibme-npm.github.io/port-forwarder/)

## Usage

### Static Forwarding

Forward all incoming connections on a local port to a fixed remote host and port.

```typescript
import PortForwarder from '@gibme/port-forwarder';

const server = new PortForwarder({
    port: 12345,
    remote: {
        ip: 'remotehost',
        port: 22
    }
});

await server.start();
```

### Dynamic Forwarding

Handle each incoming connection individually and decide where to forward it at runtime.

```typescript
import PortForwarder from '@gibme/port-forwarder';

const server = new PortForwarder({ port: 12345 });

server.on('connection', async (socket) => {
    if (await server.forward(socket, 'remotehost', 22)) {
        console.log('Forwarding established');
    } else {
        console.log('Forwarding failed');
    }
});

await server.start();
```

### Configuration Options

| Option | Type | Default | Description |
|---|---|---|---|
| `port` | `number` | *required* | Local port to listen on |
| `ip` | `string` | `'0.0.0.0'` | Local interface to bind to |
| `timeout` | `number` | `900000` (15 min) | Socket timeout in milliseconds |
| `keepalive` | `boolean` | `false` | Enable TCP keepalive on connections |
| `remote` | `{ ip: string, port: number }` | `undefined` | Remote endpoint for static forwarding |

### Events

| Event | Parameters | Description |
|---|---|---|
| `listening` | `(ip: string, port: number)` | Emitted when the server starts listening |
| `close` | | Emitted when the server closes |
| `connection` | `(socket: Socket, port: number)` | Emitted on each incoming connection |
| `forward` | `(remoteAddress, remotePort, forwardAddress, forwardPort)` | Emitted when a connection is forwarded |
| `error` | `(error: Error, ...args: any[])` | Emitted on error |

### Session Tracking

Active forwarding sessions can be listed at any time:

```typescript
const sessions = await server.list();

for (const session of sessions) {
    console.log(`${session.ip}:${session.port} -> ${session.forward.ip}:${session.forward.port}`);
}
```

### Stopping the Server

```typescript
await server.stop();
```

## License

MIT
npm package: @gibme/qrcode
Description: A simple qrcode helper
Author: Brandon Lehmann
Latest version: 22.0.0

# @gibme/qrcode

A lightweight QR code URL generator that builds requests against the [QuickChart.io](https://quickchart.io/qr) QR API. Rather than generating QR codes locally, it constructs a URL that returns the rendered QR code image when fetched.

## Installation

```bash
yarn add @gibme/qrcode
```

or

```bash
npm install @gibme/qrcode
```

**Requires Node.js >= 22**

## Usage

```typescript
import QRCode from '@gibme/qrcode';

// Basic usage — returns a URL to a PNG QR code image
const url = QRCode('https://github.com');

// With custom options
const customUrl = QRCode('https://example.com', {
    format: 'svg',
    size: 300,
    dark: '1a1a1a',
    light: 'f0f0f0',
    ecLevel: 'H',
    caption: 'Scan me'
});
```

The returned URL can be used directly in `<img>` tags, fetched via HTTP, or embedded anywhere a URL is accepted.

## Options

| Option | Type | Default | Description |
|---|---|---|---|
| `format` | `'png' \| 'svg' \| 'base64'` | `'png'` | Output image format |
| `size` | `number` | `150` | QR code size in pixels |
| `margin` | `number` | `4` | Quiet zone margin around the code |
| `dark` | `string` | `'000000'` | Dark module color (3 or 6-digit hex) |
| `light` | `string` | `'ffffff'` | Light module color (3 or 6-digit hex) |
| `ecLevel` | `'L' \| 'M' \| 'Q' \| 'H'` | `'M'` | Error correction level |
| `centerImageUrl` | `string` | — | URL of a logo/image to place in the center |
| `centerImageSizeRatio` | `number` | `0.3` | Size ratio of center image (0–1) |
| `centerImageWidth` | `number` | — | Override center image width |
| `centerImageHeight` | `number` | — | Override center image height |
| `caption` | `string` | — | Text caption below the QR code |
| `captionFontFamily` | `string` | `'sans-serif'` | Font family for caption text |
| `captionFontSize` | `number` | `10` | Font size for caption text |

## Error Correction Levels

| Level | Recovery |
|---|---|
| `L` | ~7% |
| `M` | ~15% |
| `Q` | ~25% |
| `H` | ~30% |

Higher levels allow more of the QR code to be damaged or obscured (e.g., by a center image) while remaining scannable.

## Documentation

Full API documentation is available at [https://gibme-npm.github.io/qrcode/](https://gibme-npm.github.io/qrcode/).

## License

[MIT](./LICENSE)
npm package: @gibme/snmp
Description: A simple SNMP helper/wrapper
Author: Brandon Lehmann
Latest version: 22.0.0

# @gibme/snmp

A simple async/await SNMP helper/wrapper built on top of [snmp-native](https://github.com/calmh/node-snmp-native).

## Requirements

- Node.js >= 22

## Installation

```bash
npm install @gibme/snmp
```

```bash
yarn add @gibme/snmp
```

## Usage

The package supports both **static methods** (shared session) and **instance methods** (dedicated session).

### Static Methods

Use static methods for simple operations that share a single underlying SNMP session:

```typescript
import SNMP from '@gibme/snmp';

const options: SNMP.Options = {
    host: '192.168.1.1',
    community: 'public'
};

// Get a single OID
const result = await SNMP.get(options, '.1.3.6.1.2.1.1.1.0');

// Get multiple OIDs
const results = await SNMP.getAll(options, [
    '.1.3.6.1.2.1.1.1.0',
    '.1.3.6.1.2.1.1.5.0'
]);

// Get next OID in the tree
const next = await SNMP.getNext(options, '.1.3.6.1.2.1.1');

// Walk a subtree
const subtree = await SNMP.getSubtree(options, ['.1.3.6.1.2.1.1']);

// Set a value
await SNMP.set(options, '.1.3.6.1.2.1.1.5.0', SNMP.DataType.OctetString, 'new-hostname');

// Close the shared session when done
SNMP.close();
```

### Instance Methods

Create instances when you need independent SNMP sessions:

```typescript
import SNMP from '@gibme/snmp';

const snmp = new SNMP();

const result = await snmp.get({
    host: '192.168.1.1',
    community: 'public'
}, '.1.3.6.1.2.1.1.1.0');

// Close the instance session when done
snmp.close();
```

## API

### Methods

All methods are available as both static and instance methods.

| Method | Description |
|---|---|
| `get(options, oid)` | Perform a GetRequest for a single OID |
| `getAll(options, oids)` | Perform GetRequests for multiple OIDs |
| `getNext(options, oid)` | Perform a GetNextRequest |
| `getSubtree(options, oids)` | Walk a subtree via repeated GetNextRequests |
| `set(options, oid, type?, value?)` | Perform a SetRequest |
| `close()` | Close the underlying SNMP session |

### Types

#### `SNMP.Options`

Connection options passed to the underlying snmp-native session. Common fields:

| Field | Type | Description |
|---|---|---|
| `host` | `string` | SNMP agent hostname or IP address |
| `community` | `string` | SNMP community string |
| `port` | `number` | UDP port (default: `161`) |
| `version` | `SNMP.Versions` | Protocol version (default: `SNMPv2c`) |

#### `SNMP.OID`

A string type that must start with a dot (e.g., `.1.3.6.1.2.1.1.1.0`).

#### `SNMP.Response<Type>`

A `Record<OID, Type | undefined>` mapping each OID to its result.

#### `SNMP.VarBind`

An SNMP variable binding containing the OID and its value.

#### `SNMP.DataType`

ASN.1 data type constants: `Integer`, `OctetString`, `Null`, `ObjectIdentifier`, `IPAddress`, `Counter`, `Gauge`, `TimeTicks`, `Opaque`, `NsapAddress`, `Counter64`, and others.

#### `SNMP.Versions`

Protocol version constants: `SNMPv1` and `SNMPv2c`.

## Documentation

Full API documentation is available at [https://gibme-npm.github.io/snmp/](https://gibme-npm.github.io/snmp/)

## License

MIT
npm package: @gibme/ssh
Description: A simple SSH helper/wrapper
Author: Brandon Lehmann
Latest version: 22.0.0

# @gibme/ssh

A simple SSH helper/wrapper built on [ssh2](https://github.com/mscdex/ssh2) with support for command execution and real-time streaming.

## Requirements

- Node.js >= 22

## Installation

```bash
yarn add @gibme/ssh
```

or

```bash
npm install @gibme/ssh
```

## Usage

### Basic Command Execution

```typescript
import SSH from '@gibme/ssh';

const client = new SSH({
    host: '192.168.1.1',
    username: 'admin',
    password: 'password'
});

await client.connect();

const output = await client.exec('ls -la');
console.log(output.toString());

await client.destroy();
```

### Streaming

For long-running or continuous commands, use `stream()` to receive data in real-time:

```typescript
const controller = await client.stream('tail -f /var/log/syslog', {
    separator: '\n',
    loopInterval: 50
});

controller.on('data', (chunk) => {
    console.log(chunk.toString());
});

controller.on('completed', () => {
    console.log('Stream finished');
});

// Cancel the stream at any time
controller.abort();
```

### Events

The SSH client emits the following events:

| Event | Description |
|-------|-------------|
| `ready` | Connection established and authenticated |
| `close` | Connection closed |
| `end` | Connection ended |
| `timeout` | Connection timed out |
| `error` | An error occurred |
| `banner` | Server sent a banner message |
| `greeting` | Server sent a greeting |
| `stream` | Data arrived from a stream command |
| `stream_cancelled` | Stream was cancelled |
| `stream_complete` | Stream completed |

## API Documentation

Full API documentation is available at [https://gibme-npm.github.io/ssh/](https://gibme-npm.github.io/ssh/)

## License

[MIT](https://choosealicense.com/licenses/mit/)
npm package: @gibme/websocket
Description: Simple Cross-Platform WebSocket Client Helper
Author: Brandon Lehmann
Latest version: 22.0.0

# @gibme/websocket

Simple cross-platform WebSocket client helper for Node.js and browsers.

Provides a unified, event-driven interface with automatic message buffering, auto-reconnect support, and consistent `Buffer`-based message delivery across platforms.

## Installation

```bash
npm install @gibme/websocket
# or
yarn add @gibme/websocket
```

## Requirements

- Node.js >= 22

## Quick Start

```typescript
import WebSocket from '@gibme/websocket';

const socket = new WebSocket({
    url: 'wss://echo.websocket.org/echo',
    autoReconnect: true
});

socket.connect();

socket.on('message', (message) => {
    console.log('Received:', message.toString());
});

socket.send(JSON.stringify({ hello: 'world' }));
```

## Constructor Options

| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `url` | `string` | *required* | WebSocket server URL |
| `protocols` | `string \| string[]` | `undefined` | WebSocket sub-protocols |
| `binaryType` | `'arraybuffer' \| 'nodebuffer' \| 'fragments'` | `'arraybuffer'` | Binary data representation |
| `autoReconnect` | `boolean` | `false` | Automatically reconnect on close |

## Methods

### `connect()` / `open()`

Opens the WebSocket connection. Can be called again to reconnect after a close.

### `send(data)`

Sends data through the WebSocket. If the connection is not yet open, messages are automatically queued and sent once the connection is ready.

Accepts `string`, `ArrayBufferLike`, `ArrayBufferView`, or `Buffer`.

### `close(code?, reason?)`

Closes the WebSocket connection. Prevents auto-reconnect from triggering.

## Properties

| Property | Type | Description |
|----------|------|-------------|
| `readyState` | `number` | Connection state: `0` CONNECTING, `1` OPEN, `2` CLOSING, `3` CLOSED |
| `bufferedAmount` | `number` | Bytes of data queued in the underlying WebSocket |
| `extensions` | `string` | Negotiated extensions |
| `protocol` | `string` | Negotiated sub-protocol |
| `url` | `string` | Remote WebSocket URL |
| `binaryType` | `string` | Get/set binary data representation |

## Events

| Event | Payload | Description |
|-------|---------|-------------|
| `open` | — | Connection established |
| `ready` | — | Connection confirmed ready; queued messages are flushed |
| `message` | `Buffer` | Message received (always delivered as a `Buffer`) |
| `close` | — | Connection closed |
| `error` | `Error` | An error occurred |

## Browser Support

This package uses [isomorphic-ws](https://github.com/nicolo-ribaudo/isomorphic-ws) to provide a consistent WebSocket API across Node.js and browser environments. A webpack bundle is available at `dist/websocket.min.js` for direct browser usage.

## License

MIT - see [LICENSE](LICENSE) for details.

## Documentation

Full API documentation is available at [https://gibme-npm.github.io/websocket/](https://gibme-npm.github.io/websocket/).
npm package: @gibme/xml
Description: A simple XML helper
Author: Brandon Lehmann
Latest version: 22.0.0

# @gibme/xml

A simple, typed XML helper for Node.js built on [fast-xml-parser](https://github.com/nicedaycode/fast-xml-parser).

## Requirements

- Node.js >= 22

## Installation

```bash
npm install @gibme/xml
# or
yarn add @gibme/xml
```

## Documentation

[https://gibme-npm.github.io/xml/](https://gibme-npm.github.io/xml/)

## API

### `XML.objToXML<Type>(obj, builderOptions?): string`

Converts a JavaScript object to an XML string.

```typescript
import XML from "@gibme/xml";

const obj = {
    root: {
        test: true,
        text: "hello",
        num: 42
    }
};

const xml = XML.objToXML(obj);
```

### `XML.parseXML<Type>(xml, parserOptions?, validatorOptions?): Promise<Type>`

Parses an XML string or Buffer into a typed JavaScript object.

```typescript
import XML from "@gibme/xml";

interface MyData {
    root: {
        test: boolean;
        text: string;
        num: number;
    };
}

const data = await XML.parseXML<MyData>(xmlString);
```

### Options Types

- `XML.ParserOptions` — Configuration for the XML parser
- `XML.BuilderOptions` — Configuration for the XML builder
- `XML.ValidatorOptions` — Configuration for XML validation

These map directly to [fast-xml-parser options](https://github.com/nicedaycode/fast-xml-parser#xml-parser).

## License

MIT