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 🙏

© 2024 – Pkg Stats / Ryan Hefner

idre-array-cache

v0.3.1

Published

An appendable array with file persistance/listeners, producer/consumer and inter process capabilities

Downloads

22

Readme

Idre-array-cache

An appendable only array with file persistance/listeners, producer/consumer and inter process capabilities.

It is designed to work as an import logger for the Shatabang-project. Imported items are added to the array-cache and eventually persisted to disk. Another process reading from the same file presents the array in a Rest-API's. The tail of the array holds the latest imported item and the clients can poll this from the server, only providing the index of the lastly fetched item gives the delta with new items.

Supports only strings and numbers.

Install the module with npm or yarn

npm i --save idre-array-cache

or

yarn add idre-array-cache

Create the array-cache instance by requiring the idre-array-cache module and create a new instance of the object.

var IdreCache = require('idre-array-cache');
const cache = IdreCache();

Append new items

To append new items to the cache use the push function:

cache.push('NewItem')

New items can be pushed simultaneously from multiple processes and the new items will be appended to the files asynchronously.

Persistance

Persistance is handled only after the open(filename, options) method has been called.

  • Filename argument is the path to the file where the array should be persisted.
  • Options argument can configure delay(delay between file saves) and encoding (file encoding)

When you are completly done with the file you should call close to flush the changes and release the resources. The array-cache will hold an internal file cache so the same file will sync between instances in the same process.

TODO: Add info about event emmitter. Open request on github if needed.

Why Idre?

Idre is a familly ski resort in the nothern Dalarna county in Sweden. It's a nice place for skiing both downhill and cross country. If you are lucky you see some raindeers running around the mountains eating lichen. It's also close to where my grand mother was born.