https://github.com/aotuser/local-database
A Local Database.
https://github.com/aotuser/local-database
database databases javascript typescript
Last synced: 9 months ago
JSON representation
A Local Database.
- Host: GitHub
- URL: https://github.com/aotuser/local-database
- Owner: aotuser
- Created: 2025-05-24T18:00:12.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-11T03:34:36.000Z (about 1 year ago)
- Last Synced: 2025-09-24T02:43:56.640Z (9 months ago)
- Topics: database, databases, javascript, typescript
- Language: TypeScript
- Homepage:
- Size: 3.5 MB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# LocalDatabase
### A Local Database made with typescript
## Dependencies:
```ts
import fs from 'fs'
```
## NPM Dependency:
```ts
import * as Database from 'jerious-local-database'
```
## Features:
- Search for queries
- Edit queries
- Delete queries
- Add queries
## How it works:
Can search for objects, edit objects, etc (with json objects), using a .json file as a database (all locally)
## Usage example:
> JSON Object (representation)
| Key | Value |
| ------------- | ------------- |
| password: | "auserpassoword123" |
| e_mail: | "agoogleemail@gmail.com" |
| user_name: | "username123" |
### Getting object from query
```ts
Database.getFromQuery({
e_mail: "agoogleemail@gmail.com",
password: "auserpassoword123"
})
```
returns:
```ts
{
e_mail: "agoogleemail@gmail.com",
password: "auserpassoword123",
user_name: "username123"
}
```
### Updating object from query
```ts
Database.updateFromQuery({
e_mail: "agoogleemail@gmail.com",
password: "auserpassoword123"
}, {
user_name: "usernameupdated",
new_key: "astringvalue"
})
```
updated object:
```ts
{
e_mail: "agoogleemail@gmail.com",
password: "auserpassoword123",
user_name: "usernameupdated",
new_key: "astringvalue"
}
```
### Checking if database contains query
```ts
Database.containsQuery({
e_mail: "agoogleemail@gmail.com",
password: "auserpassoword123"
})
```
returns:
```ts
true
```
### Adding object to database
```ts
Database.addObject({
e_mail: "aoutlookemail@outlook.com",
password: "aoutlookuserpassoword123"
})
```
adds the object to the database.
## How to setup in node:
Importing
```ts
import * as Database from './path/to/the/database/main/file'
```
Initing
```ts
const a_db = new Database.Database('path/to/your/database/json/file')
```
## Database file example:
