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

netflow-traffic-accounter

v0.4.2

Published

IP traffic accounting with NetFlow and Node.js

Readme

netflow-traffic-accounter

NetFlow IP Traffic Accounting

This package provides a single class which exports aggregate traffic data of local networks at a regular interval (by default every 5 minutes).

This wouldn't be possible without the the still-under-development node-netflowv9 package, whose author deserves the most credit!

NetFlow version 1,5,7 and 9 are supported.

Support for IPv6 (requiring NetFlow version 9) is not yet supported.

This has been tested with the RouterOS 'Traffic Flow' feature, and at the time of writing node-netflowv9 has been tested with Cisco IOS XR.

Installation

npm install --save netflow-traffic-accounter

Usage

const NetflowTrafficAccounter = require('netflow-traffic-accounter');

const accounter = new NetflowTrafficAccounter({
    listenPort: 3000,
    exportInterval: 300,
    localNets: [
        "10.10.10.0/24",
        "192.168.0.0/24",
    ],
    ignoreNets: [
        "192.168.1.0/24",
    ],
    netflowOptions: {
        // options here are passed to node-netflowv9
    },
}, function(data, periodFrom, periodTo) {
    // called every exportInterval seconds with traffic data collected
    // since the last export.

    // periodFrom, periodTo contain Unix timestamps of the collection
    // period's start and end.
});

Traffic data is presented in the following format:

{
    "10.10.10.1": {
        "in_bytes": 123123,
        "out_bytes": 123123,
        "in_pkts": 1231,
        "out_pkts": 1231,
    },
    "10.10.10.2": {
        ....
    },
    ...
}

Options

The NetflowTrafficAccounter class is intialized with an options object as the first parameter and the data export callback as the second parameter.

The following options are available in the options object:

listenPort - Default: 3000. The port to listen for NetFlow data on.

exportInterval - Default: 300. How often to export aggregated traffic data (in seconds). Data is is exported when the following condition is true:

currentSystemTime % exportInterval == 0

localNets - Default: null. An array of subnets considered local, which we will account incoming and outgoing traffic for. Can be an array of strings or of Netmask objects from the Netmask package.

ignoreNets - Default: null. An array of subnets to ignore. We will not account traffic between localNets and ignoreNets. Can be an array of strings or of Netmask objects from the Netmask package.

netflowOptions - Default: {}. Used as the constructor of node-netflowv9's Collector. See here for available options. Useful for proxying netflow traffic to another collector with the proxy option. Note: Specifying port in netflowOptions overrides our own listenPort.