javascriptdata-structuresnode.jsnpm

npm-hosted libraries for circular/ring buffers


Are there any implementations of circular buffers/ring buffers on NPM (Node.JS Package Manager)? I can easily implement one by myself, but I'd like to have an easily deployable and maintained library.

My use case is storing time series in a fixed-size in-memory database a la RRDTool, but neither RRDTool nor its reimplementation in Javascript (I forgot the name) fit. I need to store large (50KB) JSON objects.


Solution

  • Realize this was asked almost 4 months ago, but figured I might as well share.

    Wrote one myself for another purpose a little while ago and threw it on npm today. It's named CBuffer. The README.md file has a link to a blog post about how to use it. Just install it by

    npm install CBuffer
    

    And use it in your scripts by:

    var CBuffer = require( 'CBuffer' ).CBuffer;
    

    I've spent a lot of time trying to get GC down to a minimum, and it's the quickest implementation I've been able to find.