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

vizier.db

v0.1.0

Published

Tablo desteği ve olay sistemi içeren hafif JSON dosya tabanlı veritabanı.

Readme

Vizier.DB

Basit ama esnek bir JSON dosya tabanlı database. Hem "fast" key-value işlemleri hem de tablo (table) yapısı sağlar. Event sistemiyle tablo ve veri değişikliklerini dinleyebilirsiniz.

Kurulum

npm install vizier.db
# veya lokal geliştirme için
npm install

Başlangıç

const { VizierDB, Table } = require('vizier.db');

// Dosya yolu vermek opsiyoneldir, verilmezse proje kökünde vizier.db.json oluşturur
const db = new VizierDB({
  filePath: './data/vizier.db.json',
  autoSave: true, // her değişiklikte otomatik kaydet
});

Fast (key–value) API

// set
db.set('username', 'furkan');

// get
const name = db.get('username');

// push (array)
db.push('logs', { message: 'ilk log' });

// unpush (array içinden ilk eşleşen elemanı siler)
db.unpush('logs', { message: 'ilk log' }); // Dikkat: referans eşleşmesi gerekir

// delete (key sil)
db.delete('username');

// all (tüm üst seviye key-value veriyi getirir)
const allFastData = db.all();

Table Sistemi

Tablo Oluşturma & Listeleme

// tablo oluşturma
db.createTable('users');

// tablo isimlerini listeleme
const tables = db.listTables();

// tabloyu düşürme (silme)
db.dropTable('users');

// tabloyu yeniden adlandırma
db.renameTable('oldName', 'newName');

Table Sarmalayıcı (Table class)

const users = new Table(db, 'users');

// insert
users.insert({ id: 1, name: 'Alice', age: 25 });
users.insert({ id: 2, name: 'Bob', age: 30 });

// fetch (tüm satırlar)
const allUsers = users.all();

// fetch (query object)
const age25 = users.fetch({ age: 25 });

// fetch (custom predicate)
const adults = users.fetch(user => user.age >= 18);

// update (object merge)
users.update({ id: 1 }, { age: 26 });

// update (custom function)
users.update({ id: 2 }, row => ({ ...row, name: 'Bobby' }));

// remove
users.remove({ id: 2 });
// veya predicate
users.remove(user => user.age > 40);

Event Sistemi

VizierDB bir EventEmitterdır. Aşağıdaki event’ler mevcut:

  • ready – database yüklendiğinde
  • save – dosya kaydedildiğinde
  • error – bir hata oluştuğunda
  • set – fast key-value set
  • delete – fast key-value delete
  • push – fast array push
  • unpush – fast array unpush
  • table:create – tablo oluşturulduğunda
  • table:drop – tablo silindiğinde
  • table:rename – tablo yeniden adlandırıldığında
  • table:insert – tabloya satır eklendiğinde
  • table:update – tabloda satır güncellendiğinde
  • table:remove – tablodan satır silindiğinde

Event Örneği

const db = new VizierDB({ filePath: './data/vizier.db.json' });

// fast events
db.on('set', ({ key, value }) => {
  console.log('[event] set', key, value);
});

// table events
db.on('table:insert', ({ table, row }) => {
  console.log(`[event] insert into ${table}`, row);
});

Örnek Çalıştırma

Repo içinde basit bir örnek bulunuyor:

node ./examples/basic.js

Bu komut ./data/vizier.db.json dosyasını oluşturur ve birkaç fast + table işlemi yapar.

Notlar

  • JSON dosyası küçük ve orta boy projeler için uygundur. Yüksek eşzamanlı yazma olan büyük projelerde klasik veritabanları tercih edilmelidir.
  • autoSave: false ayarlanıp, manuel olarak db._save() (public olmayan) yerine gelecekte eklenecek bir db.commit() tarzı API kullanılabilir. Şu an için her değişiklikte otomatik kaydetme tavsiye edilir.