A simple SQL-based storage system for Node.js applications requiring per-user file storage. Version 0.4.2 is current, released as part of the userland project. It provides a straightforward API to create, read, update, delete files identified by username and relative path, each with metadata, type, and access control (public/private). Unlike cloud storage SDKs, it is database-only and designed to be integrated with any identity system. The package is lightweight and relies on a MySQL/MariaDB database. It is not frequently updated; current release cadence is low.
npm install userlandstorageNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a Storage instance, initializes the database, and demonstrates CRUD operations on a file.
Ensure MySQL/MariaDB is accessible and the table 'storage' is created (use init() or run the SQL schema manually).
Avoid storing binary data or very large contents; consider using a BLOB column or external storage.
Ensure MySQL 8.0+ or MariaDB 10.2+ for automatic JSON default support.
Use import statements or set type: 'module' in package.json.
Run 'npm install userlandstorage' and ensure it is in package.json dependencies.
Use 'import { Storage } from 'userlandstorage'' instead of 'import storage from ...'Run MySQL command: ALTER USER 'youruser'@'localhost' IDENTIFIED WITH mysql_native_password BY 'yourpassword';
Ensure contents property is a string. Convert Buffer to string before passing.