@enzon3/txtdb

1.3.2 • Public • Published

txtdb GitHub npm GitHub package.json dynamic npm bundle size

logo

txtdb is a simple key-based database based on text files formatted in a special way.

Features

Key-based
Simple
Fast
Easy to use
Cache
Up to 2000 keys

Installation

Use the package manager npm to install txtdb.

npm i @enzon3/txtdb

Usage

Setup up txtdb

The second parameter is a boolean for whether or not to overwrite already existing keys.

const settings = {
    dbFile: '[db file location here].txt',
    allowOverwrite: true,
    delimiter: 'any delimiter you want, for example: "|"',
    enableCache: false
}
db.setup(settings);

Get a value

async function getKey(key) {
    const value = await db.getKey(key);
    return value;
}

var key = getKey('key');
// do something with key

Set a value

Quick warning, if the AllowOverwrite flag in the setup function is set to true, and if there was a key of the same name before, this command would overwrite it.

db.setKey('key', 'value');

Delete a value

db.deleteKey('key');

Contributing

Please don't request for write access to the repository, instead, fork the repository and open a PR describing what you would like to change in depth.

Readme

Keywords

Package Sidebar

Install

npm i @enzon3/txtdb

Weekly Downloads

1

Version

1.3.2

License

GPL-3.0-or-later

Unpacked Size

42.4 kB

Total Files

5

Last publish

Collaborators

  • enzon3