Skip to content

npm package for the key-value data file store .

Notifications You must be signed in to change notification settings

devansh5/smalldb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Smalldb is npm package meant for key-value storage.

Features

  • For storing the key as file and value as content in specific key file.
  • Time To Live (TTL) based cache
  • Supports the current active LTS version of Node.js or higher

Usage

Install smalldb

npm install --save @devansh5/smalldb

Create a new Smalldb instance , as default this intialize a default values for ttl and directory.

const Smalldb=require('@devansh5/smalldb')

const db=Smalldb({optionals})

  • you can pass default one Smalldb()

  • specifying directory in optionals,

  • Smalldb({dir:'root/src/index',ttl:1000})

Methods

// async function init(){

// await db.create('hello','namaste')
// await db.create()
// await db2.create('name',{firstname:'devansh',lastname:'chaubey'},1000)
// await db.read('hello')
// await db2.read('name')

//} //init();

db.read(key)

read the specified key file from the data storage directory and returns it return the JSON value if it exist.

db.create(key,value,options={ttl:1000})

will create the new file with the name of key and the content as the value from the directories

db.delete(key)

will delete the key file from the directories

Package Link :=> Click Here

About

npm package for the key-value data file store .

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published