@enzon3/txtdb
v1.3.2
Published
A database that utilizes text files to it's advantage by using some cool .split logic
Downloads
10
Readme
txtdb
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.