hfss
v1.0.2
Published
**HFSS.js** is a lightweight file-system-based hierarchical storage manager. It mimics databases and tables as directories, allowing you to:
Readme
HFSS.js
HFSS.js is a lightweight file-system-based hierarchical storage manager. It mimics databases and tables as directories, allowing you to:
- Create databases and nested tables (folders and subfolders)
- Add, edit, and delete files
- Join directories into one
- Perform numeric operations (
min,max,average,add,subtract) on JSON files containing arrays of numbers - Encrypt and decrypt file or directory names with:
AES-256,Base64,Base32(encryption + decryption)SHA-256,SHA-1,SHA-512,MD5(one-way hashing, no decryption)
📂 Installation
Copy hfss.js into your project directory.
Then, for Base32 encoding/decoding:
npm install base32.js
🎯 Usage
const HFSS = require('./hfss');
const hfss = new HFSS('./hfss_storage');
// ✅ Create a new database
hfss.createDatabase('mydb');
// ✅ Create tables
hfss.createLevelOneTable('mydb', 'customers');
hfss.createLevelTwoTable('mydb', 'customers', 'customer_addresses');
// ✅ Add a file
hfss.addFile('./hfss_storage/mydb/customers', 'data.json', '[1,2,3,4,5]');
// ✅ List files
hfss.select('mydb', 'customers');
// ✅ Numeric operations
const average = hfss.average('mydb', 'customers', 'data.json'); // returns 3
const sum = hfss.add('mydb', 'customers', 'data.json'); // returns 15
// ✅ Encryption and decryption
const encryptedPath = hfss.encrypt('./hfss_storage/mydb/customers', 'AES-256', 'my-secret-key');
const decryptedPath = hfss.decrypt(encryptedPath, 'AES-256', 'my-secret-key');
// ✅ Join directories
hfss.join('mydb/customers', 'mydb/orders', 'mydb/combined');
// ✅ Delete file
hfss.deleteFile('./hfss_storage/mydb/customers', 'data.json');
⚠️ Notes
- SHA-256, SHA-1, SHA-512, MD5 produce one-way hash outputs — these cannot be decrypted.
- AES-256 requires a key for both encryption and decryption.
- Base64 and Base32 can be decoded without a key.
- The min, max, average, add, and subtract functions only work on files containing a valid JSON array of numbers.
