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

esk_db

v1.1.6

Published

Una base de datos simple que trabaja con archivos JSON para Node.JS

Readme

ESK_DB

Instalación

# npm
npm install esk_db

Descripción

Esk_DB es una libreria que te permite crear bases de datos y tablas de manera sencilla, ademas de poder añadir, buscar, editar y eliminar valores de las tablas, haciendo uso de la liberia fs de nodejs, guardando los datos en archivos json.

Importante

Este proyecto se hizo en una semana con fines educativos con el objetivo de aprender a hacer uso de la libreria fs de nodejs, por lo que no es recomendable usarlo en un proyecto real.

Uso

Puedes encontrar ejemplos en la carpeta examples

import Esk_DB from 'esk_db'

Crear una base de datos

const DB = new Esk_DB.Database('nombre')
const save = DB.save()

// devuelve un objeto json
console.log(save)

Crear una tabla

// type value = {
//   name: string
//   required: boolean
//   primaryKey?: boolean
//   type: string (string | boolean | number | object)
//   limit?: number
//   defaultValue?: any
// }

// Siendo value un arreglo con los atributos de la tabla

DB.addTable(nombre: string, []: Array<value>)
const Table = DB.addTable('nombre', [
  { /* Primer atributo */
    name: 'uuid',
    required: true,
    type: 'number',
    primaryKey: true
  },
  { /* Segundo atributo */
    name: 'name',
    required: true,
    type: 'string'
  } 
])

// devuelve un objeto json
const tableSave = Table.save()

console.log(tableSave)

Añadir un valor


//Teniendo en cuenta el ejemplo de arriba
const Persona = Table.addValue({
  uuid: "Persona",
  name: 'Juan'
})

// devuelve un objeto json
console.log(Persona)

Buscar un valor

// devuelve todos los valores de la tabla
Table.findAll()

// devuelve el valor como un json (si el valor existe)
// search: nombre del atributo
// value: valor del atributo

Table.findOne({
  search: 'valor_requerido',
  value: 223
})

// devuelve un array de los valores con el mismo valor
// name: nombre del atributo
// value: valor del atributo

Table.find({
  name: 'valor1',
  value: "Persona"
})

Editar un valor

// search: (buscar el valor en la tabla para editar) { 
//   valueName: nombre del atributo,
//   value: valor del atributo
// }
// newValue: (nuevo valor para el atributo) {
//   valueName: atributo a editar,
//   value: nuevo valor
// }

const edit = Table.editOne({
  search: {
    valueName: 'atributo',
    value: 223
  },
  newValue: {
    valueName: 'valor1',
    value: "nuevo_valor"
  }
})

// devuelve un objeto json
console.log(edit)

Eliminar valores

// eliminar por clave primaria
const eliminar = Table.deleteByKey({
  key: 'atributo',
  valueToRemove: 'valor'
})

// devuelve un objeto json
console.log(eliminar)

// eliminar por valor
// debes pasar un objeto con dos atributos:
// valueName: el atributo a buscar
// value: el valor a buscar
// la función elimina todos los datos que tengan el valor proporcionado

const eliminar = Table.deleteByValue({
  valueName: 'valor1',
  value: 'Persona'
})

// tambien es posible limitar la cantidad de datos a eliminar pasandole un atributo extra
// limit: cantidad de datos a eliminar
// parametros: (objeto a buscar, limite a eliminar)

const eliminar = Table.deleteByValue({
  valueName: 'valor1',
  value: 'Persona'
}, 3)