2.1.0 • Published 1 year ago

meatdb v2.1.0

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

meatdb / meat.db

Package that can store your data with easy, secure and fast

Installation ⏳

You can install via npm using this command:

npm i meatdb

Setup 🔨

const DB = require('meatdb'); // Common JS import

// or

import DB from 'meatdb'; // ESM import

Usage 📌

const db = new DB({
    path: './database', //optional
    waitForSetTime: 50, //(optional default to 50) wait for a given time in ms before set the data 
    maxDataInOneFile: 10000, //(optional default to 10000) maximum data in one file, it'll create a new file if it's reach the limit
    encrypt: true, // optional, default to false
    encryptionKey: "Very secret key, you must hide this key somewhere in the safe place like env", // required only if encrypt is true
    iv: 'my iv 123', //required only if encrypt is true
    salt: "salt", //optional only affected when encrypt is true
    encoding: "binary" //optional default to hex only affected when encrypt is true
})
db.once('ready', () => {
    console.log("Database ready!")
})
// NOTE: you need to use .then() if it's not in async function
// set data with provided name and value
await db.set('name', 'value') // return undefined

// get data with provided name
await db.get('name') // return json {key: 'name', value: 'value'} or value become undefined if it doesn't exist

// check if data with provided name exist
await db.has('name') // return true or false depend on if the data exist or not

// delete data with provided name
await db.delete('name') // return true or false depend on if the data exist or not (like db.has but it'll delete the data if exist)

// get all data that has been stored in the db
await db.all() // return array with json inside it. Actually like db.get


// get database ping
await db.ping() // return number in ms

//get database uptime
db.uptime // return number in ms

Why using this package?

because this package is fast and easy to store your data, need only 300 - 800ms to set 100k data in the same time, also you can encrypt your data with easy and your data will be secure

You can try this:

// not encrypt
const DB = require('meatdb')
const db = new DB()
for (let i = 0; i < 100000; i++) {
    db.set(i, i)
}
// encrypt
const DB = require('meatdb')
const db = new DB({
    encrypt: true,
    encryptionKey: 'secret key here',
    iv: 'this is iv'
})
for (let i = 0; i < 100000; i++) {
    db.set(i, i)
}

What's new on 2.1.0?

  • Support more node.js version
2.1.0

1 year ago

2.0.1

2 years ago

2.0.0

2 years ago

1.3.8

2 years ago

1.3.7

2 years ago

1.3.6

2 years ago

1.3.5

2 years ago

1.3.0

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago