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

@ruslankonev/yaml-db

v1.0.3

Published

YAML-based database with the ability to run as a service

Downloads

6

Readme

yaml-db

! Important !

Currently, the project is still in development, not all methods have been fully implemented yet and the API is subject to change. If you have a suggestion for improvement or a good idea - you can make a pull-request.

yaml-db is a simple YAML-based database with the ability to run as a service. It allows you to store data in the form of YAML files organized in folders. Each record is represented as a directory with meta.yaml and data.yaml files containing metadata and content.

Installation

To install yaml-db, you can use npm:

npm i -g @ruslankonev/yaml-db

Usage

After installation, you can use the yaml-db command-line interface to start the database server.

yaml-db start

Options

  • -c, --config [path]: Path to configuration file
  • -d, --dir [directory]: File storage path (default: ./data)
  • -p, --port [port]: The port on which the server is raised (default: 5701)

Configuration

You can provide a configuration file in YAML format to customize the database and server settings. The following fields are supported:

server:
  port: 5701 # The port on which the server is raised

database:
  dataPath: ./data # Path to the directory where data is stored

Programmatic Usage

In addition to running yaml-db as a standalone server, you can also use the Database module programmatically in your Node.js projects. This allows you to interact with the database functionality directly within your application code.

Example Usage

To use the Database module in your project, you can require it and create an instance of the database:

const fs = require('fs');
const { Database } = require('yaml-db');

const dataPath = './data/records'; // Change this to the appropriate data path
const db = new Database(dataPath);

// Initialize the database
db.init()
  .then(() => {
    // Create a new record
    const newRecordId = db.createRecord({ title: 'Sample Record' });

    // Upload a file to the record
    const fileBuffer = fs.readFileSync('path/to/your/file.pdf');
    db.uploadFile(newRecordId, fileBuffer, 'file.pdf');

    // Update a record
    db.updateRecord(newRecordId, { title: 'Updated Record Title' });

    // Retrieve record metadata
    const recordMeta = db.getRecordMeta(newRecordId);
    console.log('Record Metadata:', recordMeta);

    // Retrieve record data
    const recordData = db.getRecordData(newRecordId);
    console.log('Record Data:', recordData);
  })
  .catch((error) => {
    console.error('Error:', error.message);
  });

Remember to adjust the dataPath and the paths to your actual files accordingly. This example demonstrates creating records, uploading files, updating records, and searching records by directory.

For more detailed information about the available methods and their parameters, refer to the Documentation section.

Methods

  • init(): Initialize the database.
  • createRecord(recordData): Create a new record with the specified data.
  • uploadFile(recordId, fileBuffer, filename): Upload a file to a record.
  • updateRecord(recordId, updatedData): Update the data of a record.
  • getRecordMeta(recordId): Retrieve the metadata of a record.
  • getRecordData(recordId): Retrieve the data of a record.

For more detailed documentation on each method, refer to the inline comments in the /lib/database.js file.

Dependencies

  • body-parser: Middleware to parse request bodies.
  • commander: Command-line interface framework.
  • express: Web application framework for the server.
  • lodash: Utility library for working with data.
  • multer: Middleware for handling file uploads.
  • nanoid: Library for generating unique IDs.
  • yaml: Library for working with YAML files.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Author

Created by Ruslan Konev.

For inquiries, contact: [email protected]