Registry / database / liburno_lib

liburno_lib

JSON →
library5.0.28jsnpmunverified

Liburno_lib (v5.0.28) is an Italian-language CLI utility library wrapping better-sqlite3 with helper functions for database management, string manipulation, and email sending. It provides a Database class with extended methods like multi-statement run, transaction stack, schema inspection, export/import, and FTS5 support. Also includes init for console colors, B for global utilities, and Post for HTTP requests and mail. Released on npm. Differentiators: full SQLite wrapper with FTS5, automatic transaction management, and all-in-one CLI toolset.

npm install liburno_lib
INSTALL
IMPORT
SIG · LIBURNO_LIB
L
liburno_lib
databasejavascriptv5.0.28
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

database
const { database } = require('liburno_lib')
const { db } = require('liburno_lib')
The export is named 'database', not 'db'.
init
const { init } = require('liburno_lib')
const init = require('liburno_lib'); init()
init is a named export; importing the whole module and calling init() works, but destructuring is clearer.
Post
const { Post } = require('liburno_lib')
const Post = require('liburno_lib').Post
Both work, but destructuring is idiomatic.
B
const { B } = require('liburno_lib')
B is a named export containing utility functions like random, clamp, shuffle.
database.db
const { database } = require('liburno_lib'); const db = database.db('test.db')
const db = database('test.db')
database is an object, not a function. Use database.db() to open a database.

Shows database creation, table insert, query, B.random usage, schema export, and Post class setup.

const { database, init, B, Post } = require('liburno_lib'); // Initialize console colors init(); // Create/open a SQLite database const db = database.db('example.db'); db.run('CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY, name TEXT)'); db.run("INSERT INTO users (name) VALUES ('Alice')"); const rows = db.prepare('SELECT * FROM users').all(); console.log(rows); // Use B utilities const randomNum = B.random(1, 100); console.log(randomNum); // Test schema export const schemaSQL = db.schema(null, false); console.log(schemaSQL); // Post example (replace with actual endpoint) // const post = new Post('https://api.example.com', 'user'); // post.post('login', {username: 'test'}).then(res => console.log(res)); db.chiudi();
Debug
Known issues
gotchaThe database.db() method creates or opens a file; if the file is locked by another process, it will throw.
fix
Ensure exclusive access or handle errors.
affects: *
gotchaThe run() method allows multiple statements separated by semicolons, but only returns the result of the first statement.
fix
Use separate prepare/run calls for each statement if you need all results.
affects: >=5.0
breakingVersion 5+ dropped support for callbacks; all methods return Promises where applicable.
fix
Use async/await or .then() for asynchronous operations.
affects: >=5.0
deprecatedThe 'fetchfile' method in Post is deprecated. Use 'fetchtxt' with file write instead.
fix
Replace fetchfile with fetchtxt and write to file manually.
affects: >=5.0
gotchainit() extends String, Number, and Date prototypes globally, which may conflict with other libraries.
fix
Call init() only once at app startup and be aware of prototype pollution.
affects: *
gotchabetter-sqlite3 is built natively; it requires build tools (Python, C++ compiler) on some systems.
fix
Pre-install build-essential or use prebuilt binaries via node-gyp.
affects: *
Errors
Common errors & fixes
Error: Cannot find module 'better-sqlite3'
The native module better-sqlite3 is not installed or failed to build.
fix
Run 'npm install' and ensure build tools are available. On Windows, try installing windows-build-tools.
TypeError: database.db is not a function
Importing incorrectly (e.g., using default import or wrong named export).
fix
Use const { database } = require('liburno_lib') and then database.db('file.db').
Error: SQLITE_BUSY: database is locked
Another process holds a lock on the SQLite file.
fix
Close other connections, use WAL mode, or retry after a short delay.
TypeError: init is not a function
init was imported as default instead of named export.
fix
Use const { init } = require('liburno_lib') instead of const init = require('liburno_lib').
Upgrade
Version history
5.0.28latest on npm
Audit
Dependencies
better-sqlite3requiredcore SQLite engine
node-fetchrequiredHTTP requests for Post class
nodemailerrequiredemail sending
Agent activity
8 hits · last 30 days
node
6
Resources
liburno_lib — npm install liburno_lib · libregistry