@studiowebux/petitedb@2.2.2Built and signed on GitHub ActionsBuilt and signed on GitHub Actions
Built and signed on GitHub Actions
latest
studiowebux/petitedbIn-memory with persistance local JSON database
This package works with DenoIt is unknown whether this package works with Cloudflare Workers, Node.js, Bun, Browsers




JSR Score
100%
Published
2 months ago (2.2.2)
About
- Ideal for test, offline applications and Proof-of-Concept
- Manage data in memory
- Store and load data to/from a JSON file
- Uses Write-Ahead Logging (WAL) to increase performance
- Collection data is split into individual files.
- Configurable (see table below)ù
- Core operations:
- Create, update, upsert, delete records
insertOne/insertManyupdateOneupsertdeleteOne/deleteMany
- Drop Collection
drop
- Count
count
- Retrieve configurable amount of random records (
sample())sample
- Snapshot and Clear data
getDataclear
- Support Typescript Types: Data (
Schema) and Collections (string)
- Create, update, upsert, delete records
- Support Saving BigInt in JSON file
- Added
_metaobject for each record (not fully implemented)- createdAt
- updatedAt
- Version (increase when update and upsert)
- Added simple indexing (by _id)
Installation and Usage
- Install deno: https://deno.com
deno add @studiowebux/petitedbimport { PetiteDB } from "@studiowebux/petitedb@^2.1.2";
Version 2.2.0+ has breaking changes.
Example:
see demo/ directory, there are many examples.
Clean Shutdown
const db = new PetiteDB(...); await db.shutdown()
Options
| Parameter | Description | Default |
|---|---|---|
| autoCommit | If true, the database will be commited automatically when maxWritesBeforeFlush is reached |
true |
| walLogPath | WAL File name | db_name.wal.log |
| maxWritesBeforeFlush | Number of entries to store in the WAL before saving on-disk | 100 |
| memoryOnly | Ephemeral DB only | false |
| verbose | Enables all log levels | false |
Contributing
- Fork the project
- Create a Feature Branch
- Commit your changes
- Push your changes
- Create a PR
Working with your local branch
Branch Checkout:
git checkout -b <feature|fix|release|chore|hotfix>/prefix-name
Your branch name must starts with [feature|fix|release|chore|hotfix] and use a / before the name; Use hyphens as separator; The prefix correspond to your Kanban tool id (e.g. abc-123)
Keep your branch synced:
git fetch origin git rebase origin/master
Commit your changes:
git add . git commit -m "<feat|ci|test|docs|build|chore|style|refactor|perf|BREAKING CHANGE>: commit message"
Follow this convention commitlint for your commit message structure
Push your changes:
git push origin <feature|fix|release|chore|hotfix>/prefix-name
Examples:
git checkout -b release/v1.15.5 git checkout -b feature/abc-123-something-awesome git checkout -b hotfix/abc-432-something-bad-to-fix
git commit -m "docs: added awesome documentation" git commit -m "feat: added new feature" git commit -m "test: added tests"
License
Distributed under the MIT License. See LICENSE for more information.
Contact
- Tommy Gingras @ tommy@studiowebux.com | Studio Webux
|
|
Webux Lab
|
Built and signed on
GitHub Actions
Add Package
deno add jsr:@studiowebux/petitedb
Import symbol
import * as petitedb from "@studiowebux/petitedb";
Import directly with a jsr specifier
import * as petitedb from "jsr:@studiowebux/petitedb";
Add Package
pnpm i jsr:@studiowebux/petitedb
pnpm dlx jsr add @studiowebux/petitedb
Import symbol
import * as petitedb from "@studiowebux/petitedb";
Add Package
yarn add jsr:@studiowebux/petitedb
yarn dlx jsr add @studiowebux/petitedb
Import symbol
import * as petitedb from "@studiowebux/petitedb";
Add Package
vlt install jsr:@studiowebux/petitedb
Import symbol
import * as petitedb from "@studiowebux/petitedb";
Add Package
npx jsr add @studiowebux/petitedb
Import symbol
import * as petitedb from "@studiowebux/petitedb";
Add Package
bunx jsr add @studiowebux/petitedb
Import symbol
import * as petitedb from "@studiowebux/petitedb";