Notify President Madagascar

    node-rate-counter

    1.0.1 • Public • Published

    node-rate-counter

    Build Status npm version npm

    Calculate the incomming rate of anything.

    Installation

    npm install node-rate-counter

    Usage

    let counter = new rateCounter()
     
    setInterval(() => {
        counter.increment()
        rateCounter.clean_up(120000)//hold the last 120 seconds worth of data 
        console.log(counter.rate)
    }, 100) //increment counter every 100ms (i.e rate of 10/s)
     
     

    N.B.

    This module has a margin of error when using node js timers due to the nature of of node js. See this link for more detail


    Install

    npm i node-rate-counter

    DownloadsWeekly Downloads

    0

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    5.06 kB

    Total Files

    8

    Last publish

    Collaborators

    • gigaclank