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 🙏

© 2026 – Pkg Stats / Ryan Hefner

gyo.db

v1.0.6

Published

Lightweight Node.js module for managing JSON-based databases

Readme

gyo.db

A lightweight Node.js module for managing JSON-based databases.

gyo.db is a simple and efficient module that provides easy-to-use functions for managing JSON-based databases. It allows you to store, retrieve, update, and delete data using a JSON file as the storage mechanism.

Features:

  • Lightweight and efficient data storage solution
  • Easy-to-use API for managing JSON-based databases
  • Supports key-value data storage
  • Provides functions for data retrieval, update, and deletion
  • Built-in support for JSON file as the database storage
  • Option to start a Web API server to access data over HTTP

Installation:

npm install gyo.db

Documentation:

For detailed usage instructions and API documentation, please refer to the GitHub repository.

License:

This project is licensed under the MIT License. See the LICENSE file for more information.

Support:

For bug reports, feature requests, or any other questions related to gyo.db, please use the issue tracker on GitHub.

Usage

Here is an example of how to use GyoDB in your Node.js application:

const GyoDB = require('gyodb');

// Create an instance of GyoDB with the path to your JSON database file
const db = new GyoDB('data.json');

// Set a value
db.set('name', 'Özcan Kasapoğlu');

// Get a value
const name = db.get('name');
console.log(name); // Output: Özcan Kasapoğlu

// Check if a key exists
const exists = db.has('name');
console.log(exists); // Output: true

// Remove a key-value pair
db.remove('name');

// Clear the entire database
db.clear();

// Get the size of the database
const size = db.size();
console.log(size); // Output: 0

// Search for values that include a specific query
const results = db.search('apple');
console.log(results); // Output: { fruit: 'apple', color: 'red' }

// Update a value using a custom update function
db.update('count', value => value + 1);

// Get the key(s) associated with a specific value
const key = db.getKeyByValue('Özcan Kasapoğlu');
console.log(key); // Output: name

const keys = db.getKeysByValue('apple');
console.log(keys); // Output: [ 'fruit' ]

// Merge an object into the database
db.merge({ city: 'New York', country: 'USA' });

// Validate a value using a custom validation function
const isValid = db.validate('age', value => value >= 18);
console.log(isValid); // Output: true

// Export the database to a JSON file
db.exportDatabase('backup.json');

// Start a web API server to expose the database data
db.startWebAPI(3000);

Api

new GyoDB(dbFilePath) Creates a new instance of GyoDB with the specified JSON database file path.

loadDatabase() Loads the JSON database file and returns its contents as an object. If the file does not exist or is empty, an empty object {} is returned.

saveDatabase() Saves the current state of the database to the JSON file.

get(key) Retrieves the value associated with the specified key.

set(key, value) Sets the value of the specified key.

has(key) Checks if the specified key exists in the database.

remove(key) Removes the key-value pair associated with the specified key.

clear() Clears the entire database.

getAll() Returns the entire database as an object.

size() Returns the number of key-value pairs in the database.

search(query) Searches for values that include the specified query and returns an object with matching key-value pairs.

update(key, updateFn) Updates the value associated with the specified key using a custom update function. The update function receives the current value as a parameter and should return the updated value.

getKeyByValue(value) Returns the key associated with the specified value. If multiple keys have the same value, only the first occurrence is returned.

getKeysByValue(value) Returns an array of keys associated with the specified value.

merge(dataObject) Merges the specified object into the database.

validate(key, validationFn) Validates the value associated with the specified key using a custom validation function. The validation function receives the value as a parameter and should return a boolean value indicating whether the value is valid or not.

exportDatabase(exportFilePath) Exports the current state of the database to a JSON file at the specified path.

startWebAPI(port) Starts a web API server to expose the database data. The server listens on the specified port and provides a JSON API endpoint at /api/data to retrieve the database contents.