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

memorystore.js

v1.0.0

Published

<h2 style="text-align:center;" >MemoryStore.js</h2> <br>

Readme

Simple way to store your data inside a raw .json file . Built on top of the node.js , the filesystem and lodash library . You can use different json files as models . Again this needs more work and has some experimental methods available such as realtime methods and events ...

it only works on backend / pure node apps such as express / electron / API apps etc etc ...

Table of contents

Installation

npm i memorystore.js --save
yarn add memorystore.js

Usage

First init the main constructor

const MemoryStore = require('memorystore.js');
const memory = new MemoryStore('./data.json', { // Options is not required
  truncate: false // The truncate option is by default false
})

Add

Callback returns two parameters . First one is error and the second one is data itself . The data is schemaless and have an ID field .

const MemoryStore = require('memorystore.js');
const memory = new MemoryStore('./data.json') // PATH TO JSON FILE
memory.add({ title: 'Some demo content' }, function (err, data) { //ID IS AUTO GENERATED
  if(err) { console.error(err) } else {
    console.log(data); // data return { title: 'Some demo content', id: '3de422e44ed0bdde' }
  }
})

List

You can list all data or find a specific data . Here is a list of som useful methods .

List all

The listAll() function takes only a function as it's parameter and returns all the data as an array . Here is an example below .

const MemoryStore = require('memorystore.js');
const memory = new MemoryStore('./data.json') // PATH TO JSON FILE
memory.listAll(function (err, data) {
  if(err) { console.error(err) } else {
    console.log(data); // data return an array [{ title: 'Some demo content', id: '3de422e44ed0bdde' }, ...]
  }
})

Find

EXPERIMENTAL The find() function takes two parameters and then returns that object / multiple objects in an array responding / matching that specific object . An example is shown below . Here I searched for a data which has Some demo title as the content for field title . I got that data back with it's ID .

const MemoryStore = require('memorystore.js');
const memory = new MemoryStore('./data.json') // PATH TO JSON FILE
memory.find({title: 'Some demo content'} ,function (err, data) {
  if(err) { console.error(err) } else {
    console.log(data); // data return an object { title: 'Some demo content', id: '3de422e44ed0bdde' } or {} for nothing
  }
})

Find by ID

This function returns only one object responding to the matching ID

const MemoryStore = require('memorystore.js');
const memory = new MemoryStore('./data.json') // PATH TO JSON FILE
memory.find('3de422e44ed0bdde' ,function (err, data) {
  if(err) { console.error(err) } else {
    console.log(data); // data return an object { title: 'Some demo content', id: '3de422e44ed0bdde' } or {} for nothing
  }
})

Delete

You can delete some specific data using some useful methods exposed by this package

Delete by finding

EXPERIMENTAL This function deletes an object / an array of objects responding the where object please try to use the deleteById method as it's not fully functional yet / can be buggy

const MemoryStore = require('memorystore.js');
const memory = new MemoryStore('./data.json') // PATH TO JSON FILE
memory.delete({title: 'Some demo content'} ,function (err, data) {
  if(err) { console.error(err) } else {
    console.log(data); // data return an object { title: 'Some demo content', id: '3de422e44ed0bdde' } or {} for nothing
  }
});

Delete by ID

This function deletes an object responding the ID

const MemoryStore = require('memorystore.js');
const memory = new MemoryStore('./data.json') // PATH TO JSON FILE
memory.deleteById('3de422e44ed0bdde' ,function (err, data) {
  if(err) { console.error(err) } else {
    console.log(data); // data return an object { title: 'Some demo content', id: '3de422e44ed0bdde' } or {} for nothing
  }
})

Update

You can update some specific data using some useful methods exposed by this package

Update by finding

EXPERIMENTAL This method updates the object in the main array responding the where object

const MemoryStore = require('memorystore.js');
const memory = new MemoryStore('./data.json') // PATH TO JSON FILE
memory.update({title: 'Some demo content'} ,{ title: 'Demo content updated' },function (err, data) {
  if(err) { console.error(err) } else {
    console.log(data); // data return an object { title: 'Demo content updated', id: '3de422e44ed0bdde' }
  }
});

Update by ID

This function updates an object responding the ID

const MemoryStore = require('memorystore.js');
const memory = new MemoryStore('./data.json') // PATH TO JSON FILE
memory.updateById('3de422e44ed0bdde' ,{ title: 'Demo content updated' }, function (err, data) {
  if(err) { console.error(err) } else {
    console.log(data); // data return an object { title: 'Demo content updated', id: '3de422e44ed0bdde' } or {} for nothing
  }
})

MIT License . Created by Adib Mohsin