# rammy-db

> Stores all data in ram and disk sync.

Latest version **2.0.0** (published 2022-11-12) · ISC license · 0 weekly downloads

## Install

```sh
npm install rammy-db
pnpm add rammy-db
yarn add rammy-db
bun add rammy-db
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2022-11-12 |
| First published | 2022-10-08 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 141.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | ErdemGKSL |
| Maintainers | erdemgoksel |

## Links

- npm: https://www.npmjs.com/package/rammy-db
- Repository: https://github.com/ErdemGKSL/rammy-db
- Homepage: https://github.com/ErdemGKSL/rammy-db#readme
- Issues: https://github.com/ErdemGKSL/rammy-db/issues
- npm.io page: https://npm.io/package/rammy-db

## Dependencies (2)

- [lodash](https://npm.io/package/lodash.md) ^4.17.21
- [stuffs](https://npm.io/package/stuffs.md) ^0.1.22

## Recent versions

- 2.0.0 (latest) — 2022-11-12
- 1.0.12 — 2022-11-09
- 1.0.11 — 2022-11-09
- 1.0.10 — 2022-11-08
- 1.0.9 — 2022-11-08
- 1.0.8 — 2022-11-08
- 1.0.7 — 2022-10-15
- 1.0.5 — 2022-10-08
- 1.0.4 — 2022-10-08
- 1.0.3 — 2022-10-08
- 1.0.2 — 2022-10-08
- 1.0.1 — 2022-10-08
- 1.0.0 — 2022-10-08

## README

![RammyDB Text](https://cdn.discordapp.com/attachments/887446333047312464/1028347470977191946/RammyLong.png "RammyDB Text")

# RammyDB

Stores data in disk and ram synchronously.

## Supports Custom Classes
Supports custom classes but only works if #toJSON() returns constructor argument.

## Example

```js
const { RamDB, toCustomClass } = require("rammy-db");
const path = require("path");

class Game { constructor(arg) { this.data = {}; for (let i in arg) { this.data[i] = arg[i] } }; toJSON() { return {...this.data} } }
class User { constructor(arg) { this.data = {}; for (let i in arg) { this.data[i] = arg[i] } }; toJSON() { return {...this.data} } }

const model = new RamDB({
	path: path.resolve(process.cwd(), "./data.json"),
	timeout: 5000,
	default: {
		/** @type {Game[]} */
		games: [],
		queueData: {
			/** @type {string[]} */
			players: [],
			size: 0
		},
		/** @type {User[]} */
		users: []
	},
	customClasses: [toCustomClass(User), toCustomClass(Game)]
});

module.exports = db;
```

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