npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

node-asuswrt

v2.1.5

Published

The `AsusWrt` NPM package is a powerful tool for interfacing with Asus routers, allowing you to manage your router and connected devices programmatically. This README provides an example of how to use the package and explains its main functionalities.

Readme

AsusWrt NPM Package

The AsusWrt NPM package is a powerful tool for interfacing with Asus routers, allowing you to manage your router and connected devices programmatically. This README provides an example of how to use the package and explains its main functionalities.

The 2.x release restructured the entire process of data management and optimized usage of the Axios client. Each router or access point is now its own 'instance' with operations instead of one singleton calling all methods.

Installation

To install the AsusWrt package, use the following command:

npm install asus-wrt

Usage

Below is an example of how to use the AsusWrt package in a TypeScript project:

import {AsusWrt} from "./src/asus-wrt";
import {AsusClient} from "./lib/classes/asus-client";

async function main() {
    const url = process.env.ASUS_URL!;
    const username = process.env.ASUS_USERNAME!;
    const password = process.env.ASUS_PASSWORD!;
    const asusWrt = new AsusWrt({
        baseURL: url,
        username: username,
        password: password,
    });

    const clients = await asusWrt.discoverClients();
    const router = asusWrt.asusRouter!;
    await asusWrt.updateConnectedDevices();

    asusWrt.allClients.forEach((client: AsusClient) => {
        console.log(client.setLeds(true));
        console.log(client.reboot());
        console.log(client.getCPUMemoryLoad());
        console.log(client.getUptimeSeconds());
        console.log(client.connectedDevices);
    });

    const vpnClient = await router.getVpnClients();
    const trafficData = await router.getTotalTrafficData();
    const wanStatus = await router.getWANStatus();
    const wakeOnLanDevices = await router.getWakeOnLanDevices();
    const vpnClients = await router.getVpnClients();
    const ooklaServers = await router.getOoklaServers();
    const speedTestResult = await router.runSpeedtest(ooklaServers[0]);
}

main().then(() => {
    console.log('Program done');
})

Environment Variables

Make sure to set the following environment variables with the correct values for connecting to your Asus router with the example code.

  • ASUS_URL: Base URL of the Asus router.
  • ASUS_USERNAME: Username for logging into the router.
  • ASUS_PASSWORD: Password for logging into the router.

Example Code Explanation

  1. Initialization:

    • Create an instance of AsusWrt with the necessary credentials by providing baseURL, username, and password.
  2. Discovering Clients:

    • Use discoverClients to get a list of connected clients.
    • Update connected devices with updateConnectedDevices.
  3. Accessing Router and Client Specific Functions:

    • Access client-specific functions such as setLeds, reboot, getCPUMemoryLoad, getUptimeSeconds, and connectedDevices for each client.
    • Get additional data from the router like VPN clients, total traffic data, WAN status, and Wake-on-LAN devices.
  4. Speed Test:

    • Retrieve Ookla speed test servers and run a speed test using runSpeedtest.

Functions

AsusWrt Methods

  • discoverClients(): Discovers connected clients on the network.
  • updateConnectedDevices(): Updates the list of connected devices.

AsusClient Methods

These methods are also available on the AsusRouter

  • setLeds(state: boolean): Sets the LED state.
  • reboot(): Reboots the client.
  • getCPUMemoryLoad(): Retrieves CPU and memory load.
  • getUptimeSeconds(): Retrieves uptime in seconds.
  • connectedDevices: Lists connected devices.

AsusRouter Methods

  • getVpnClients(): Retrieves VPN clients.
  • getTotalTrafficData(): Gets total traffic data.
  • getWANStatus(): Gets the WAN status.
  • getWakeOnLanDevices(): Retrieves devices that can be woken up using Wake-on-LAN.
  • getOoklaServers(): Gets Ookla speed test servers.
  • runSpeedtest(server): Runs a speed test using the specified Ookla server.