npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

octavia-db

v2.0.3

Published

OctaviaDB - A lightweight, AES-encrypted NoSQL database for fast and secure local storage in Node.js.

Readme

Octavia DB

  • OctaviaDB - A lightweight, AES-encrypted NoSQL database for fast and secure local storage in Node.js.

Features

  • AES Encryption: Secure your data with robust AES encryption, ensuring privacy and safety for all stored information.
  • NoSQL Architecture: A flexible, schema-less NoSQL database that allows for easy storage of diverse data structures.
  • Auto-Commit: Automatically save changes at customizable intervals to prevent data loss and ensure consistent persistence.

Installation

  • To install the OctaviaDB module, run the following command in your terminal:
npm install octavia-db

Example 1: Initialize Database

  • This example shows how to initialize your database by specifying the database name, password, and auto-commit interval.
const OctaviaDB = require('octavia-db');

// Initialize the OctaviaDB instance
const db = new OctaviaDB({
    database: './my-database',        // Path to your database directory
    password: 'my-secret-password',    // Password for encryption
    autoCommitInterval: 5000          // Auto commit changes every 5 seconds
});

// Get information about the database
console.log(db.info());

Example 2: Work with Collections

  • This example demonstrates how to create a collection, insert data, update data, and perform other operations like finding and removing data.
const OctaviaDB = require('octavia-db');
const db = new OctaviaDB({
    database: './my-database',
    password: 'my-secret-password',
    autoCommitInterval: 5000
});

// Create a new collection
const collection = db.collection('users');

// Insert a single document
collection.insert({ id: 1, name: 'John Doe', age: 30 });
collection.insert({ id: 2, name: 'Jane Smith', age: 25 });

// Insert multiple documents
collection.insertMany([
    { id: 3, name: 'Michael Johnson', age: 35 },
    { id: 4, name: 'Sarah Lee', age: 40 }
]);

// Find a document by a query
const user = collection.find({ id: 1 });
console.log(user);  // Output: { id: 1, name: 'John Doe', age: 30 }

// Update a document
collection.update({ id: 1 }, { age: 31 });

// Remove a document
collection.remove({ id: 2 });

// Find multiple documents
const usersAbove30 = collection.findMany({ age: 30 });
console.log(usersAbove30);  // Output: [ { id: 1, name: 'John Doe', age: 31 }, { id: 3, name: 'Michael Johnson', age: 35 } ]

// Info about the collection
console.log(collection.info());

Example 3: Work with Data Objects

  • This example shows how to create and interact with a single data object that holds key-value pairs, similar to working with a JSON object.
const OctaviaDB = require('octavia-db');
const db = new OctaviaDB({
    database: './my-database',
    password: 'my-secret-password',
    autoCommitInterval: 5000
});

// Create a new data object
const dataObject = db.dataObject('settings');

// Set key-value pairs in the data object
dataObject.set('theme', 'dark');
dataObject.set('notifications', true);
dataObject.set('language', 'en');

// Get values from the data object
console.log(dataObject.get('theme'));  // Output: 'dark'
console.log(dataObject.get('notifications'));  // Output: true
console.log(dataObject.get('language'));  // Output: 'en'

// Update a value in the data object
dataObject.set('theme', 'light');

// Remove value
dataObject.remove('language');

// Info about the data object
console.log(dataObject.info());  // Outputs stats on the data object (size, creation time, etc.)

Example 4: Deleting Data

  • This example demonstrates how to delete a collection or data object and even the entire database.
const OctaviaDB = require('octavia-db');
const db = new OctaviaDB({
    database: './my-database',
    password: 'my-secret-password',
    autoCommitInterval: 5000
});

// Create a collection and insert data
const collection = db.collection('users');
collection.insert({ id: 1, name: 'John Doe', age: 30 });
collection.insert({ id: 2, name: 'Jane Smith', age: 25 });

// Delete a collection
collection.delete();

// Create a new data object
const dataObject = db.dataObject('settings');
dataObject.set('theme', 'dark');
dataObject.set('notifications', true);

// Delete a data object
dataObject.delete();

// Delete the entire database (be cautious with this!)
db.delete();

Example 5: Check if Collection or Document Exists

  • This example shows how to check whether a collection or document exists in the database before performing operations.
const OctaviaDB = require('octavia-db');
const db = new OctaviaDB({
    database: './my-database',
    password: 'my-secret-password',
    autoCommitInterval: 5000
});

// Check if a collection exists
const collectionExists = db.collectionExists('users');
console.log(`Collection 'users' exists: ${collectionExists}`);  // Output: true/false

// Check if a data object exists
const dataObjectExists = db.documentExists('settings');
console.log(`Data Object 'settings' exists: ${dataObjectExists}`);  // Output: true/false

OctaviaDB Methods

// database methods
db.info() // Returns information about the database
db.delete() // Deletes the entire database
db.collection(collectionName, encrypt) //  Creates a new collection within the database.
db.dataObject(dataObjectName, encrypt) // Creates a new data object within the database.
db.collectionExists(collectionName) // Checks if a collection exists.
db.documentExists(documentName) // Checks if a document exists.

// collection methods.
collection.info() // information about collection
collection.delete() // delete collection
collection.insert(data, immediateCommit) // Inserts a new item into the collection.
collection.insertMany(dataArray, immediateCommit) // Inserts multiple items into the collection.
collection.find(query) // Finds a single item that matches the query.
collection.findMany(query) // Finds multiple items that match the query.
collection.update(query, newData, immediateCommit) // Updates an item in the collection.
collection.updateMany(query, newData, immediateCommit) // Updates multiple items in the collection.
collection.remove(query, immediateCommit) // Removes an item from the collection.
collection.removeMany(query, immediateCommit) // Removes multiple items from the collection.

// DataObject Methods
dataObj.set(key, value, immediateCommit) // Sets a key-value pair in the data object.
dataObj.get(key) // Retrieves a value from the data object.
dataObj.remove(key) // remove a value from the data object.
dataObj.info() // Returns information about the data object.