Skip to content

A simple storage mechanism for doing demos and stuff where you require some persistence.

Notifications You must be signed in to change notification settings

ali-master/easy-store

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A simple storage mechanism for doing demos and stuff where you require some persistence. Saves JSON files to disk in your OS's temp directory. Only works in Node.

Install

yarn add easy-store

Use

import store from 'easy-store';

const users = store('users');

await users.create({name: 'Fart', email: 'cooldude@example.com'});
/*
  {
    id: 'SJb2pWGOAe',
    name: 'Fart',
    email: 'cooldude@example.com',
    createdAt: 1492816324108,
    updatedAt: 1492816324108
  }
*/

await users.get('SJb2pWGOAe');
// { id: 'SJb2pWGOAe', ... }

await users.query()
// [{ id: 'SJb2pWGOAe', ... }]

await users.query(u => u.email === 'cooldude@example.com');
// [{ id: 'SJb2pWGOAe', ... }]

await users.update({id: 'SJb2pWGOAe', name: 'Next'});
// { id: 'SJb2pWGOAe', name: 'Next', ... }

await users.remove('SJb2pWGOAe')
// { id: 'SJb2pWGOAe' }

About

A simple storage mechanism for doing demos and stuff where you require some persistence.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%