@ronaldzav/local-storage

1.0.3 • Public • Published

@ronaldzav/local-storage

📁 Local storage system for your discord bot

Installation

npm install @ronaldzav/local-storage

If you are using yarn:

yarn add @ronaldzav/local-storage

You can use the latest version of local-storage setting this in your package.json:

    "dependencies": {
      "@ronaldzav/local-storage": "github:ronaldzav/local-storage"
    }

Usage

const { Database } = require('@ronaldzav/local-storage');

let myFirstDB = new Database()
.setFolder('./storage')
.setName('guild-123')
.setDebug(true);

myFirstDB.data = { 
  "1": { "name": "Mario", "age": 10 }, 
  "2": { "name": "Maria", "age": 10 }, 
  "3": { "name": "Luigi", "age": 10 } 
  };

myFirstDB.save(); // Save the database

console.log(myFirstDB.find(element => element.name == "Mario")); // Output: [ { name: 'Mario', age: 10 } ]

API

new Database()

setFolder(folder)

Set the folder where the database will be saved.

setName(name)

Set the name of the database.

setDebug(debug)

Set the debug mode.

METHODS

save()

Save the database.

find(filterFunction)

Find an element in the database.

Package Sidebar

Install

npm i @ronaldzav/local-storage

Weekly Downloads

5

Version

1.0.3

License

Apache-2.0

Unpacked Size

17.8 kB

Total Files

7

Last publish

Collaborators

  • ronaldzav