https://github.com/wxn0brp/valtheradb-storage-bin
ValtheraDB Storage in Bin File (One) (WIP)
https://github.com/wxn0brp/valtheradb-storage-bin
database db storage valthera
Last synced: 6 months ago
JSON representation
ValtheraDB Storage in Bin File (One) (WIP)
- Host: GitHub
- URL: https://github.com/wxn0brp/valtheradb-storage-bin
- Owner: wxn0brP
- License: mit
- Created: 2025-07-11T21:26:54.000Z (12 months ago)
- Default Branch: master
- Last Pushed: 2025-10-14T13:28:57.000Z (9 months ago)
- Last Synced: 2025-10-19T17:38:00.198Z (9 months ago)
- Topics: database, db, storage, valthera
- Language: TypeScript
- Homepage: https://npmjs.org/@wxn0brp/db-storage-bin
- Size: 80.1 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# ValtheraDB Bin Plugin
The purpose of this experiment is to create a storage layer that allows ValtheraDB, which normally operates on a directory/file structure, to instead use a single binary file for data storage.
## Installation
```bash
yarn add @wxn0brp/db-storage-bin
```
## Usage
### Initialization
To get started, create a new `BinValthera` instance:
```typescript
import { createBinValthera } from "@wxn0brp/db-storage-bin";
const { db, actions, mgr } = await createBinValthera("test.val", { preferredSize: 4096 });
```
This will create a new binary file named `test.val` (if it doesn't exist) and initialize the database.
### Basic
The `db` object is an instance of `ValtheraClass` and supports the standard ValtheraDB methods.
### Optimizing the Database
This will reclaim unused space in the binary file.
```typescript
await mgr.optimize();
```
## API
### `createBinValthera(path, opts, init)`
- `path`: The path to the binary file.
- `opts`: Options for the `BinManager`.
- `init`: Whether to initialize the database upon creation (default: `true`).
Returns an object containing:
- `db`: An instance of `ValtheraClass`.
- `actions`: An instance of `BinFileAction`.
- `mgr`: An instance of `BinManager`.
### `BinManager(path, options)`
- `path`: The path to the binary file.
- `options`:
- `preferredSize`: The preferred block size for the database (default: `256`).
## Documentation
- [Data Structure](https://github.com/wxn0brP/ValtheraDB-storage-bin/blob/master/docs/data-structure.md)
- [ValtheraDB-Core](https://github.com/wxn0brP/ValtheraDB-core)
## License
This project is licensed under the MIT License.