# viperdb

> A simple data base in javascript

Latest version **0.0.5** (published 2022-01-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install viperdb
pnpm add viperdb
yarn add viperdb
bun add viperdb
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.5 |
| Published | 2022-01-06 |
| First published | 2022-01-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 8.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Lucas Amantino |
| Maintainers | light_shadow |
| Keywords | web, database, viper |

## Links

- npm: https://www.npmjs.com/package/viperdb
- Repository: https://github.com/Lucas-Amantino/viperdb
- Homepage: https://github.com/Lucas-Amantino/viperdb#readme
- Issues: https://github.com/Lucas-Amantino/viperdb/issues
- npm.io page: https://npm.io/package/viperdb

## Dependencies (1)

- [fsjs](https://npm.io/package/fsjs.md) ^0.0.6

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 0.0.5 (latest) — 2022-01-06
- 0.0.4 — 2022-01-05
- 0.0.3 — 2022-01-05
- 0.0.2 — 2022-01-04
- 0.0.1 — 2022-01-04

## README

# Viper data base

This Module makes it possible to store data on the user's pc.

## Installation

` npm install viperdb --save `

# How to use

## Create data

### DataBases

In viperdb we organize our data into tables and tables in databases, the following example shows how to create a database.

``` javascript
const viper = require("viperdb");

//             Database path   Database name
viper.NewDataBase('./storage', 'appconfig'); 
```

### table

Tables are essential for data storage, to create a table you need to create a database first.
Example of creating a table:

```javascript

const viper = require("viperdb");

viper.NewDataBase('./storage', 'appconfig');
//         Database path   Database name  table name
viper.NewTable('./storage', 'appconfig', 'userprefs');

```

### Data

We can store data in tables, so to store new data we need a table.
Example of how to save data:


```javascript

const viper = require("viperdb");

viper.NewDataBase('./storage', 'appconfig');

viper.NewTable('./storage', 'appconfig', 'userprefs');
//         Database path   Database name  table name      data
viper.AddData('./storage', 'appconfig', 'userprefs', '{name:shadow}');

```

Note: you can only store data in JSON format inside a string!

```javascript
    viper.AddData('databasepath', 'databasename', 'tablename','{dataname:datavalue}');
```

## Get data

### Taking data on a table

To get data from a table, you need to specify the database path, the database name, the name of the table where the data is located, and the name of the data.

```javascript
    viper.GetData('./storage', 'appconfig', 'userprefs', 'name');
```

The return will be a string containing the data.

` shadow `

### Taking a table from a database

It is also possible to receive data from a table with the "GetTable()" function

```javascript
    viper.getTable('./storage', 'appconfig', 'userprefs');
```

The return will be a string containing all the data stored in that table.

` {name:shadow} `

## Remove Data

In the same way that we can create databases and tables, it is also possible to delete them

### Delete Data

To remove data from a table, we use the "RemoveData()" function

```javascript
    viper.RemoveData('./storage', 'appconfig', 'userprefs', 'name');
```

### Delete Table

Using the "RemoveTable()" method we can delete a table at once.

```javascript
    viper.RemoveTable('./storage', 'appconfig', 'userprefs');
```

Be careful, keep in mind that by deleting a table, you will be losing all the data that was stored in it!

### Delete DataBase

If you want to delete the database at once, you can use the "RemoveDataBase()" method, but keep in mind that it will be lost forever.

```javascript
    viper.RemoveDataBase('./storage','appconfig');
```

## File Exist

The "FILEExist()" module returns a boolean, with it you can know if you have already created a database file.

```javascript

    var init = viper.FileExist('./storage','appconfig');

    init ? ... : ...

```

# Update Data

With the "DataUpdate()" module you can update the value of a data.

```javascript
//                   dbpath /  dbname / table name/ data name / inner value;                             
    viper.DataUpdate('./local','gameconfig','userdata','name','soul')
```

---
_Source: https://npm.io/package/viperdb · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
