https://github.com/enzon3/txtdb
A simple database utilizing text files
https://github.com/enzon3/txtdb
backend database db easy-to-use text
Last synced: 2 months ago
JSON representation
A simple database utilizing text files
- Host: GitHub
- URL: https://github.com/enzon3/txtdb
- Owner: EnZon3
- License: gpl-3.0
- Created: 2022-06-16T23:48:07.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2022-06-22T14:59:15.000Z (about 4 years ago)
- Last Synced: 2025-09-24T04:56:11.966Z (9 months ago)
- Topics: backend, database, db, easy-to-use, text
- Language: JavaScript
- Homepage:
- Size: 53.7 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
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](https://npmjs.com) to install txtdb.
```bash
npm i @enzon3/txtdb
```
## Usage
### Setup up txtdb
The second parameter is a boolean for whether or not to overwrite already existing keys.
```javascript
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
```javascript
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.
```javascript
db.setKey('key', 'value');
```
### Delete a value
```javascript
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.