# jebase

> An easy way to store settings or small databases in Node.js

Latest version **2.0.0** (published 2019-01-16) · ISC license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2019-01-16 |
| First published | 2017-08-28 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 306.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | GeorgeNet |
| Maintainers | georgenet |
| Keywords | database, json |

## Links

- npm: https://www.npmjs.com/package/jebase
- npm.io page: https://npm.io/package/jebase

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 2.0.0 (latest) — 2019-01-16
- 1.2.3 — 2018-06-05
- 1.2.2 — 2018-05-29
- 1.2.0 — 2018-05-28
- 1.1.2 — 2018-03-24
- 1.1.1 — 2018-03-24
- 1.1.0 — 2018-03-24
- 1.0.1 — 2018-03-24
- 1.0.0 — 2017-08-28

## README

## Jebase - An easy way to store settings or small databases

[![Build Status](https://travis-ci.com/gbougakov/jebase.svg?branch=master)](https://travis-ci.com/gbougakov/jebase)
[![npm](https://img.shields.io/npm/dy/jebase.svg)](https://npmjs.org/package/jebase)
[![npm](https://img.shields.io/npm/v/jebase.svg)](https://npmjs.org/package/jebase)
[![license](https://img.shields.io/github/license/gbougakov/jebase.svg)](https://github.com/gbougakov/jebase/blob/master/LICENSE)
### First things - first
`npm i jebase`

### Initialization
```js
const { Jebase } = require('jebase')
const db = new Jebase("somewhweretostore.json", {
	accounts: [],
	something: true
})
```
#### What does this code do?
1. Includes Jebase
2. Loads the database from `somewheretostore.json`, or if the file does not exist, creates it with these contents: 
```json
{
	"accounts": [],
	"something": true
}
```
3. Done!
### Interacting with data
When you load a database, it is stored inside `db.data` object, so you can manipulate it, like it’s a regular JavaScript object.
```js
db.data.accounts.push("george@bygeorgenet.me")
if (db.data.something) {
		console.log("Something is enabled")
}
```
If you have changed something in the database and want to save it, just call `db.write();`!

### Methods
#### `new Jebase(file, defaults)`
_Returns `db`_

Loads a database file

- file - relative or absolute path to JSON file
- defaults - what to write to the database if the file does not exist
#### `db.data`
_Returns `object`_
DB contents
#### `db.write()`
_Returns void_
Writes JSON data to disk

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