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

dbdjs.db-sql

v1.0.3

Published

A like package of dbdjs.db with better-sqlite3 wrapper.

Downloads

19

Readme

NPM Downloads Discord Server Repo License Package Version

dbdjs.db-sql

A SQLite version of dbdjs.db, wrapper of better-sqlite3

Table of Contents

Changelog

  • Added more Interfaces (Data, AllSQLData).
  • Renamed fetchAll to all (README.md).
  • Added Promised version of class Database for dbd.js database compatibility.
  • Changed returned data format to be the same as dbdjs.db.

About

dbdjs.db-sql is a SQLite version of dbdjs.db, which was a database for dbd.js version 3.0.0+. This package is a wrapper of better-sqlite3, a better version of node-sqlite3. This package was made with TypeScript and was compiled with typescript to JavaScript ES5, which it's JavaScript code was operateable in old browsers ( typescript package explanation ).

Setup

const Package = require("dbdjs.db-sql")
const db = new Package.Database("database.sql", { timeout: 5000 })

API

  • new Package.Database(filename: string[, Interfaces.Options]): Database - Initializing Synchronous class Database
  • new Package.PromisedDatabase(filename: string[, Interfaces.Options]): Database - Initializing Promised version of class Database
  • Database.set(table: string, key: string, value: any): Boolean - Creating/Updating the value of a created/existing data
  • Database.get(table: string, key: string): Interfaces.Data | null - Return a data with matching key from the Database
  • Database.delete(table:string, key: string): Boolean - Remove a data with matching key from the Database
  • Database.all(table: string): Interfaces.AllSQLData[] - Returns an Array of data in the Table
  • Database.getTables(): Interfaces.TableInformation[] - Returns an Array of Information about Tables from the Database
  • Database.clearTable(table: string): none - Removes the entire data of the Table
  • Database.clearDatabase(): Boolean - Removes the entire table from the Database with it's contents
  • Database.deleteTable(table: string): none - Remove table from the database
Note: Promised version will return a promise which can be handled using Promises API / Await Asynchronous.

Interfaces

Options ( BetterSqlite3.Options )

  • readonly?: boolean - open the database connection in readonly mode (default: false).
  • fileMustExist?: boolean - if the database does not exist, an Error will be thrown instead of creating a new file. This option does not affect in-memory or readonly database connections (default: false).
  • timeout?: number - the number of milliseconds to wait when executing queries on a locked database, before throwing a SQLITE_BUSY error (default: 5000).
  • verbose?: function | null - provide a function that gets called with every SQL string executed by the database connection (default: null).

Data

  • db: Database | PromisedDatabase - The database that is handling SQL
  • key: string - The key of data
  • value: any - The value of data

AllSQLData

  • key: string - The key of data
  • data: SQLData - Recevied data information

SQLData

  • key: string - The key of data
  • value: any - The value of data

TableInformation

  • type: string - The type of information
  • name: string - The table name
  • tbl_name: string - The table name
  • rootpage: number
  • sql: string - The query which creates the table

License

See LICENSE file in the Github Repository for License.