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 🙏

© 2024 – Pkg Stats / Ryan Hefner

octavia-db

v1.0.0

Published

OctaviaDB is a lightweight Node.js module for creating encrypted collections of data on the filesystem. It provides basic CRUD (Create, Read, Update, Delete) operations for collections and supports encryption for data security.

Downloads

55

Readme

Octavia DB

OctaviaDB is a lightweight Node.js module for creating encrypted collections of data on the filesystem. It provides basic CRUD (Create, Read, Update, Delete) operations for collections and supports encryption for data security.

Authors

Installation

To install the OctaviaDB module, run the following command in your terminal:

npm install octavia-db

Features

  • Encryption: OctaviaDB provides built-in encryption for your database to ensure data security.

  • CRUD Operations: Perform Create, Read, Update, and Delete operations on collections.

  • Database Information: Retrieve information about the database, collections, and file sizes.

Getting Started

Create a new database with a name and password

const myDatabase = new OctaviaDB({
	databaseName: 'myDatabase',
	databasePassword: 'mySecretPassword',
	logging: true // Set to false to disable logging
});

Create a collection. databaseName.collection()

const userCollection = myDatabase.collection(
	'users', // collection name
	true  // encryption, default true
);

Insert data into the collection. collectionName.insert()

const user1 = {
    username: 'john_doe',
    email: '[email protected]',
    age: 30
};

const result = userCollection.insert(user1);

if(result) {
	console.log(`inserted successfully`)
} else {
	console.log(`error while inserting the data`)
}

Insert multiple data objects into the collection. collectionName.insertMany()

const multipleUserData = [
	{
		username: "patrick_williams",
		email: "[email protected]",
		age: 25
  	},
	{
		username: "jane_smith",
		email: "[email protected]",
		age: 25
	},
	{
		username: "alex_johnson",
		email: "[email protected]",
		age: 35
	},
	{
		username: 'john_doe',
		email: '[email protected]',
		age: 25
	}
];

const insertResult = userCollection.insertMany(multipleUserData);

if(insertResult) {
	console.log("success")
} else {
	console.log(`error while inserting the data`)
}

Find a user in the collection. collectionName.find()

const foundUser = userCollection.find({ username: 'john_doe' });

if (foundUser) {
    console.log('Found User:', foundUser);
} else {
    console.log('User not found.');
}

Find many users in the collection. collectionName.findMany()

const foundUser = userCollection.findMany({ age: 25 });

if (foundUser) {
    console.log('Found User:', foundUser);
} else {
    console.log('User not found.');
}

Update user information. collectionName.update()

const updatedUserData = {
    age: 31,
    city: 'New York'
};

const updated = userCollection.update({ username: 'alex_johnson' }, updatedUserData);

if (updated) {
    console.log("success");
} else {
    console.log("failed");
}

Update many user information. collectionName.updateMany()

const updatedUserData = {
    status: "active"
};

const updated = userCollection.updateMany({ age: 25 }, updatedUserData);

if (updated) {
    console.log("success");
} else {
    console.log("failed");
}

Remove a user from the collection. collectionName.remove()

const removed = userCollection.remove({ username: 'alex_johnson' });

if (removed) {
    console.log("success");
} else {
    console.log("failed");
}

Remove many user from the collection. collectionName.removeMany()

const removed = userCollection.removeMany({ username: 'john_doe' });

if (removed) {
    console.log("success");
} else {
    console.log("failed");
}

Get information about the collection. collectionName.info()

const collectionInfo = userCollection.info();

if (collectionInfo) {
    console.log('Collection Information:', collectionInfo);
} else {
    console.log('Collection not found.');
}

Get information about the entire database. databaseName.info()

const databaseInfo = myDatabase.info();

if (databaseInfo) {
    console.log('Database Information:', databaseInfo);
} else {
    console.log('Database not found.');
}

Delete the collection

const isUserCollectionDeleted = userCollection.delete();

if (isUserCollectionDeleted) {
    console.log('Collection deleted successfully.');
} else {
    console.log('Error deleting collection.');
}

Delete the entire database

const isDatabaseDeleted = myDatabase.delete();

if (isDatabaseDeleted) {
    console.log('Database deleted successfully.');
} else {
    console.log('Error deleting database.');
}