📁 Local storage system for your discord bot
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"
}
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 } ]
Set the folder where the database will be saved.
Set the name of the database.
Set the debug mode.
Save the database.
Find an element in the database.